|
using System;
namespace RegexFindAndReplace
{
/// <summary>
/// Finds the next match.
/// </summary>
/// <param name="finderAndReplacer">The FinderAndReplacer.</param>
public class FirstFindSucceededAndBackToStartPointState : IFindState
{
public void FindNext( FinderAndReplacer finderAndReplacer )
{
if ( finderAndReplacer.AttemptMatch() )
{
if ( finderAndReplacer.WrappedToStartPoint() )
{
finderAndReplacer.SetState( new FirstFindState() );
finderAndReplacer.ResetLatestFindStartPosition();
finderAndReplacer.ShowMessage( "Passed the end of the document.", true );
}
else
{
finderAndReplacer.SelectMatchedText();
}
}
else
{
finderAndReplacer.ResetLatestFindStartPosition();
finderAndReplacer.SetState( new FirstFindState() );
finderAndReplacer.ShowMessage( "Passed the end of the document.", true );
}
}
}
}
|
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.