|
using System;
namespace RegexFindAndReplace
{
public class FirstFindSucceededState : IFindState
{
/// <summary>
/// Finds the next match.
/// </summary>
/// <param name="finderAndReplacer">The FinderAndReplacer.</param>
public void FindNext( FinderAndReplacer finderAndReplacer )
{
if ( finderAndReplacer.AttemptMatch() )
{
finderAndReplacer.SelectMatchedText();
}
else
{
finderAndReplacer.SetState( new FirstFindSucceededAndBackToStartPointState() );
finderAndReplacer.MoveToStartInTextWindow();
finderAndReplacer.SetLatestFindStartPositionToStartOfDocument();
finderAndReplacer.FindNext();
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
I am a software developer currently working in Salt Lake City, Utah. I work primarily with C# for my job, but I mess around with C, Perl, and Windows PowerShell for fun.