Alsing.Windows.Forms.SyntaxBox.EditViewControl.SelectNext C# (CSharp) 메소드

SelectNext() 공개 메소드

Selects next occurance of the given pattern.
public SelectNext ( string Pattern, bool MatchCase, bool WholeWords, bool UseRegEx ) : bool
Pattern string Pattern to find
MatchCase bool Case sensitive
WholeWords bool Match whole words only
UseRegEx bool
리턴 bool
        public bool SelectNext(string Pattern, bool MatchCase, bool WholeWords,
                               bool UseRegEx)
        {
            string pattern = Pattern;
            for (int i = Caret.Position.Y; i < Document.Count; i++)
            {
                Row r = Document[i];

                string t = r.Text;
                if (WholeWords)
                {
                    string s = " " + r.Text + " ";
                    t = "";
                    pattern = " " + Pattern + " ";
                    foreach (char c in s)
                    {
                        if (".,+-*^\\/()[]{}@:;'?£$#%& \t=<>".IndexOf(c) >= 0)
                            t += " ";
                        else
                            t += c;
                    }
                }

                if (!MatchCase)
                {
                    t = t.ToLowerInvariant();
                    pattern = pattern.ToLowerInvariant();
                }

                int Col = t.IndexOf(pattern);

                int StartCol = Caret.Position.X;
                int StartRow = Caret.Position.Y;
                if ((Col >= StartCol) || (i > StartRow && Col >= 0))
                {
                    SelectPattern(i, Col, Pattern.Length);
                    return true;
                }
            }
            return false;
        }