Пример #1
0
        private void DoSearch(bool bookmark)
        {
            Cursor restoreCursor = this.Cursor;

            this.Cursor = Cursors.WaitCursor;

            UpdateComboList();

            try {
                StringComparison sc           = StringComparison.CurrentCultureIgnoreCase;
                RegexOptions     regexOptions = RegexOptions.Compiled | RegexOptions.IgnoreCase;
                Regex            regex        = null;

                if (matchCase.Checked)
                {
                    sc           = StringComparison.CurrentCulture;
                    regexOptions = RegexOptions.Compiled;
                }

                if (useWildcards.Checked)
                {
                    regex = new Regex(FilterDialog.WildcardToRegex(comboBox1.Text), regexOptions);
                }

                _mainForm.DoSearch(comboBox1.Text, sc, regex, searchUp.Checked, bookmark);
            } finally {
                this.Cursor = restoreCursor;
            }
        }
Пример #2
0
        // Sets FirstRowIndex, IsVisible and RowIndices based on current filter settings and collapsed depth.
        // Creates or sets an element in the rows array for each visible line in this Record.
        // Parameter curRowIndex will be the row index of the first visible
        // line in this record, if there is one.  If any lines are visible, this increments
        // curRowIndex and returns the index of the next row to be set.
        public int SetVisibleRows(List <Row> rows, int curRowIndex)
        {
            int firstRowIndex = curRowIndex;

            FirstRowIndex = -1; // None visible for now.

            try
            {
                if (CollapsedDepth == 0 &&
                    Session.Visible &&
                    ThreadName.Visible &&
                    Thread.Visible &&
                    Logger.Visible &&
                    (MethodName.Visible || CallerIsVisible()) &&
                    (Level & MainForm.TheMainForm.VisibleTraceLevels) != 0) //
                {
                    if (HasNewlines && IsCollapsed)
                    {
                        // Test all the lines appended together, as the user will see it.
                        string allTogether = GetLine(0, ' ', 0, false);
                        if (FilterDialog.TextFilterTestString(allTogether))
                        {
                            SetRow(rows, curRowIndex, 0);
                            RowIndices[0] = curRowIndex; // Maybe we should set all of them?
                            FirstRowIndex = curRowIndex;
                            ++curRowIndex;
                        }
                    }
                    else
                    {
                        // Check if each line passes the text filter and associate each
                        // visible line with a Row in the rows array.
                        for (int lineNum = 0; lineNum < Lines.Length; ++lineNum)
                        {
                            if (FilterDialog.TextFilterTestString(Lines[lineNum]))
                            {
                                SetRow(rows, curRowIndex, lineNum);
                                RowIndices[lineNum] = curRowIndex;
                                FirstRowIndex       = firstRowIndex;
                                ++curRowIndex;
                            }
                            else
                            {
                                RowIndices[lineNum] = -1;
                            }
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                Debug.Print(ex.ToString());
            }

            return(curRowIndex);
        }