FastColoredTextBoxNS.FindForm.TryFindNext C# (CSharp) Méthode

TryFindNext() private méthode

private TryFindNext ( string pattern, RegexOptions opt, FindNextDirection direction, Range range, Place &foundMatchPlace ) : bool
pattern string
opt RegexOptions
direction FindNextDirection
range Range
foundMatchPlace Place
Résultat bool
        private bool TryFindNext(string pattern, RegexOptions opt, FindNextDirection direction, Range range, out Place foundMatchPlace)
        {
            if (direction == FindNextDirection.Next)
            {
                foreach (var r in range.GetRangesByLines(pattern, opt))
                {
                    foundMatchPlace = r.Start;
                    tb.Selection = r;
                    tb.DoSelectionVisible();
                    tb.Invalidate();
                    return true; // always return on the first match
                }
            }
            else // find previous
            {
                foreach (var r in range.GetRangesByLinesReversed(pattern, opt))
                {
                    foundMatchPlace = r.Start;
                    tb.Selection = r;
                    tb.DoSelectionVisible();
                    tb.Invalidate();
                    return true; // always return on the first match
                }
            }
            foundMatchPlace = Place.Empty;
            return false;
        }