Exemple #1
0
        bool FindNext(bool quiet, bool didReplace = false)
        {
            FindFlags flags = FindFlags.Normal;

            if (this.checkBoxRegex.Checked)
            {
                flags |= FindFlags.Regex;
            }
            else if (this.checkBoxXPath.Checked)
            {
                flags |= FindFlags.XPath;
            }
            if (this.checkBoxMatchCase.Checked)
            {
                flags |= FindFlags.MatchCase;
            }
            if (this.checkBoxWholeWord.Checked)
            {
                flags |= FindFlags.WholeWord;
            }
            if (this.radioButtonUp.Checked)
            {
                flags |= FindFlags.Backwards;
            }

            string expr = this.Expression;

            if (expr.Contains(" ") && this.checkBoxWholeWord.Checked)
            {
                throw new Exception(SR.FindWholeWordOnlyFindsWords);
            }
            this._recentFindStrings.AddItem(expr);

            _lastFlags      = flags;
            _lastExpression = expr;

            FindResult rc = _target.FindNext(expr, flags, _filter);

            if (rc == FindResult.Found && !this.IsDisposed)
            {
                this.MoveFindDialog(_target.MatchRect);
            }
            if (!quiet)
            {
                if (didReplace && rc == FindResult.None)
                {
                    rc = FindResult.NoMore;
                }
                if (rc == FindResult.None)
                {
                    OnNotFound();
                }
                else if (rc == FindResult.NoMore)
                {
                    OnFindDone(didReplace);
                }
            }
            return(rc == FindResult.Found);
        }
Exemple #2
0
        bool FindNext(bool quiet)
        {
            FindFlags flags = FindFlags.Normal;

            if (this.checkBoxRegex.Checked)
            {
                flags |= FindFlags.Regex;
            }
            else if (this.checkBoxXPath.Checked)
            {
                flags |= FindFlags.XPath;
            }
            if (this.checkBoxMatchCase.Checked)
            {
                flags |= FindFlags.MatchCase;
            }
            if (this.checkBoxWholeWord.Checked)
            {
                flags |= FindFlags.WholeWord;
            }
            if (this.radioButtonUp.Checked)
            {
                flags |= FindFlags.Backwards;
            }

            string expr = this.Expression;

            if (!this.comboBoxFind.Items.Contains(expr))
            {
                this.comboBoxFind.Items.Add(expr);
                if (this.comboBoxFind.Items.Count > MaxRecentlyUsed)
                {
                    this.comboBoxFind.Items.RemoveAt(0);
                }
            }

            _lastFlags      = flags;
            _lastExpression = expr;

            FindResult rc = _target.FindNext(expr, flags, _filter);

            if (rc == FindResult.Found && !this.IsDisposed)
            {
                this.MoveFindDialog(_target.MatchRect);
            }
            if (!quiet)
            {
                if (rc == FindResult.None)
                {
                    OnNotFound();
                }
                else if (rc == FindResult.NoMore)
                {
                    OnFindDone();
                }
            }
            return(rc == FindResult.Found);
        }