public FilterPipe(FilterParams filterParams, LogWindow logWindow) { FilterParams = filterParams; LogWindow = logWindow; IsStopped = false; FileName = Path.GetTempFileName(); Logger.logInfo("Created temp file: " + FileName); }
public void DoFilter(FilterParams filterParams, int startLine, int maxCount, ProgressCallback progressCallback) { FilterResultLines.Clear(); LastFilterLinesList.Clear(); FilterHitList.Clear(); _filterHitDict.Clear(); _filterReadyList.Clear(); _filterResultDict.Clear(); _lastFilterLinesDict.Clear(); _filterReadyList.Clear(); _filterWorkerList.Clear(); _shouldStop = false; int interval = maxCount / ThreadCount; if (interval < 1) { interval = 1; } int workStartLine = startLine; List<WaitHandle> handleList = new List<WaitHandle>(); _progressLineCount = 0; _progressCallback = progressCallback; while (workStartLine < startLine + maxCount) { if (workStartLine + interval > maxCount) { interval = maxCount - workStartLine; if (interval == 0) { break; } } Logger.logInfo("FilterStarter starts worker for line " + workStartLine + ", lineCount " + interval); WorkerFx workerFx = new WorkerFx(DoWork); IAsyncResult ar = workerFx.BeginInvoke(filterParams, workStartLine, interval, ThreadProgressCallback, FilterDoneCallback, workerFx); workStartLine += interval; handleList.Add(ar.AsyncWaitHandle); } WaitHandle[] handles = handleList.ToArray(); // wait for worker threads completion if (handles.Length > 0) { WaitHandle.WaitAll(handles); } MergeResults(); }
private int DoFilter(FilterParams filterParams, int startLine, int maxCount, List<int> filterResultLines, List<int> lastFilterLinesList, List<int> filterHitList, ProgressCallback progressCallback) { int lineNum = startLine; int count = 0; int callbackCounter = 0; try { filterParams.Reset(); while ((count++ < maxCount || filterParams.isInRange) && !ShouldCancel) { if (lineNum >= _callback.GetLineCount()) { return count; } string line = _callback.GetLogLine(lineNum); if (line == null) { return count; } _callback.LineNum = lineNum; if (Classes.DamerauLevenshtein.TestFilterCondition(filterParams, line, _callback)) { AddFilterLine(lineNum, filterParams, filterResultLines, lastFilterLinesList, filterHitList); } lineNum++; callbackCounter++; if (lineNum % PROGRESS_BAR_MODULO == 0) { progressCallback(callbackCounter); callbackCounter = 0; } } } catch (Exception ex) { string message = string.Format("Exception while filtering. Please report to developer: \n\n{0}\n\n{1}", ex, ex.StackTrace); Logger.logError(message); MessageBox.Show(null, message, "LogExpert"); } return count; }
void FilterListBox_MouseDoubleClick(object sender, MouseEventArgs e) { if (filterListBox.SelectedIndex >= 0) { FilterParams filterParams = (FilterParams)filterListBox.Items[filterListBox.SelectedIndex]; FilterParams newParams = filterParams.CreateCopy(); //newParams.historyList = ConfigManager.Settings.filterHistoryList; _filterParams = newParams; ReInitFilterParams(_filterParams); ApplyFilterParams(); CheckForAdvancedButtonDirty(); CheckForFilterDirty(); filterSearchButton.Image = _searchButtonImage; saveFilterButton.Enabled = false; if (hideFilterListOnLoadCheckBox.Checked) { ToggleHighlightPanel(false); } if (filterOnLoadCheckBox.Checked) { FilterSearch(); } } }
public LogWindow(LogTabWindow parent, string fileName, bool isTempFile, bool forcePersistenceLoading) { _logEventHandlerThread = new Thread(new ThreadStart(LogEventWorker)); _logEventHandlerThread.IsBackground = true; _logEventHandlerThread.Start(); BookmarkProvider = new BookmarkDataProvider(); BookmarkColor = Color.FromArgb(165, 200, 225); TempTitleName = ""; SuspendLayout(); InitializeComponent(); columnNamesLabel.Text = ""; // no filtering on columns by default _parentLogTabWin = parent; IsTempFile = isTempFile; ColumnizerCallbackObject = new ColumnizerCallback(this); FileName = fileName; ForcePersistenceLoading = forcePersistenceLoading; selectedDataGridView.DefaultCellStyle.WrapMode = DataGridViewTriState.True; selectedDataGridView.DefaultCellStyle.Alignment = DataGridViewContentAlignment.TopLeft; selectedDataGridView.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; selectedDataGridView.SelectionChanged += selectedDataGridView_SelectionChanged; dataGridView.CellValueNeeded += DataGridView_CellValueNeeded; dataGridView.CellPainting += DataGridView_CellPainting; dataGridView.SelectionChanged += DataGridView_NewSelectionChanged; dataGridView.DoubleClick += DataGridView_DoubleClick; filterGridView.CellValueNeeded += FilterGridView_CellValueNeeded; filterGridView.CellPainting += FilterGridView_CellPainting; Closing += LogWindow_Closing; Disposed += LogWindow_Disposed; _timeSpreadCalc = new TimeSpreadCalculator(this); timeSpreadingControl1.TimeSpreadCalc = _timeSpreadCalc; timeSpreadingControl1.LineSelected += TimeSpreadingControl1_LineSelected; tableLayoutPanel1.ColumnStyles[1].SizeType = SizeType.Absolute; tableLayoutPanel1.ColumnStyles[1].Width = 20; tableLayoutPanel1.ColumnStyles[0].SizeType = SizeType.Percent; tableLayoutPanel1.ColumnStyles[0].Width = 100; _parentLogTabWin.HighlightSettingsChanged += Parent_HighlightSettingsChanged; SetColumnizer(PluginRegistry.GetInstance().RegisteredColumnizers[0]); _patternArgs.maxMisses = 5; _patternArgs.minWeight = 1; _patternArgs.maxDiffInBlock = 5; _patternArgs.fuzzy = 5; _filterParams = new FilterParams(); foreach (string item in ConfigManager.Settings.filterHistoryList) { filterComboBox.Items.Add(item); } filterRegexCheckBox.Checked = _filterParams.isRegex; filterCaseSensitiveCheckBox.Checked = _filterParams.isCaseSensitive; filterTailCheckBox.Checked = _filterParams.isFilterTail; splitContainer1.Panel2Collapsed = true; advancedFilterSplitContainer.SplitterDistance = FILTER_ADCANCED_SPLITTER_DISTANCE; _timeshiftSyncThread = new Thread(SyncTimestampDisplayWorker); _timeshiftSyncThread.IsBackground = true; _timeshiftSyncThread.Start(); _advancedButtonImage = advancedButton.Image; _searchButtonImage = filterSearchButton.Image; filterSearchButton.Image = null; dataGridView.EditModeMenuStrip = editModeContextMenuStrip; markEditModeToolStripMenuItem.Enabled = true; _panelOpenButtonImage = new Bitmap(GetType(), "Resources.PanelOpen.gif"); _panelCloseButtonImage = new Bitmap(GetType(), "Resources.PanelClose.gif"); Settings settings = ConfigManager.Settings; if (settings.appBounds != null && settings.appBounds.Right > 0) { Bounds = settings.appBounds; } _waitingForClose = false; dataGridView.Enabled = false; dataGridView.ColumnDividerDoubleClick += DataGridView_ColumnDividerDoubleClick; ShowAdvancedFilterPanel(false); filterKnobControl1.MinValue = 0; filterKnobControl1.MaxValue = SPREAD_MAX; filterKnobControl1.ValueChanged += FilterKnobControl1_CheckForFilterDirty; filterKnobControl2.MinValue = 0; filterKnobControl2.MaxValue = SPREAD_MAX; filterKnobControl2.ValueChanged += FilterKnobControl1_CheckForFilterDirty; fuzzyKnobControl.MinValue = 0; fuzzyKnobControl.MaxValue = 10; ToggleHighlightPanel(false); // hidden BookmarkProvider.BookmarkAdded += BookmarkProvider_BookmarkAdded; BookmarkProvider.BookmarkRemoved += BookmarkProvider_BookmarkRemoved; ResumeLayout(); _statusLineTrigger.Signal += StatusLineTrigger_Signal; _selectionChangedTrigger.Signal += SelectionChangedTrigger_Signal; PreferencesChanged(_parentLogTabWin.Preferences, true, SettingsFlags.GuiOrColors); }
public RangeFinder(FilterParams filterParams, LogExpert.ColumnizerCallback callback) { _filterParams = filterParams.CreateCopy2(); _callback = callback; }
bool IsFilterSearchDirty(FilterParams filterParams) { if (!filterParams.searchText.Equals(filterComboBox.Text)) { return true; } if (filterParams.isRangeSearch != rangeCheckBox.Checked) { return true; } if (filterParams.isRangeSearch && !filterParams.rangeSearchText.Equals(filterRangeComboBox.Text)) { return true; } if (filterParams.isRegex != filterRegexCheckBox.Checked) { return true; } if (filterParams.isInvert != invertFilterCheckBox.Checked) { return true; } if (filterParams.spreadBefore != filterKnobControl1.Value) { return true; } if (filterParams.spreadBehind != filterKnobControl2.Value) { return true; } if (filterParams.fuzzyValue != fuzzyKnobControl.Value) { return true; } if (filterParams.columnRestrict != columnRestrictCheckBox.Checked) { return true; } if (filterParams.isCaseSensitive != filterCaseSensitiveCheckBox.Checked) { return true; } return false; }
/// <summary> /// Returns a list with 'additional filter results'. This is the given line number /// and (if back spread and/or fore spread is enabled) some additional lines. /// This function doesn't check the filter condition! /// </summary> /// <param name="filterParams"></param> /// <param name="lineNum"></param> /// <param name="checkList"></param> /// <returns></returns> IList<int> GetAdditionalFilterResults(FilterParams filterParams, int lineNum, IList<int> checkList) { IList<int> resultList = new List<int>(); if (filterParams.spreadBefore == 0 && filterParams.spreadBehind == 0) { resultList.Add(lineNum); return resultList; } // back spread for (int i = filterParams.spreadBefore; i > 0; --i) { if (lineNum - i > 0) { if (!resultList.Contains(lineNum - i) && !checkList.Contains(lineNum - i)) { resultList.Add(lineNum - i); } } } // direct filter hit if (!resultList.Contains(lineNum) && !checkList.Contains(lineNum)) { resultList.Add(lineNum); } // after spread for (int i = 1; i <= filterParams.spreadBehind; ++i) { if (lineNum + i < CurrentLogFileReader.LineCount) { if (!resultList.Contains(lineNum + i) && !checkList.Contains(lineNum + i)) { resultList.Add(lineNum + i); } } } return resultList; }
void MultiThreadedFilter(FilterParams filterParams, List<int> filterResultLines, List<int> lastFilterLinesList, List<int> filterHitList) { ColumnizerCallback callback = new ColumnizerCallback(this); FilterStarter fs = new FilterStarter(callback, Environment.ProcessorCount + 2); fs.FilterHitList = _filterHitList; fs.FilterResultLines = _filterResultList; fs.LastFilterLinesList = _lastFilterLinesList; BackgroundProcessCancelHandler cancelHandler = new FilterCancelHandler(fs); RegisterCancelHandler(cancelHandler); long startTime = Environment.TickCount; fs.DoFilter(filterParams, 0, CurrentLogFileReader.LineCount, FilterProgressCallback); long endTime = Environment.TickCount; #if DEBUG Logger.logInfo("Multi threaded filter duration: " + ((endTime - startTime)) + " ms."); #endif DeRegisterCancelHandler(cancelHandler); StatusLineText("Filter duration: " + ((endTime - startTime)) + " ms."); }
private Filter DoWork(FilterParams filterParams, int startLine, int maxCount, ProgressCallback progressCallback) { Logger.logInfo(string.Format("Started Filter worker [{0}] for line {1}", Thread.CurrentThread.ManagedThreadId, startLine)); // Give every thread own copies of ColumnizerCallback and FilterParams, because the state of the objects changes while filtering FilterParams threadFilterParams = filterParams.CreateCopy2(); LogExpert.ColumnizerCallback threadColumnizerCallback = _callback.createCopy(); Filter filter = new Filter(threadColumnizerCallback); lock (_filterWorkerList) { _filterWorkerList.Add(filter); } if (_shouldStop) { return filter; } int realCount = filter.DoFilter(threadFilterParams, startLine, maxCount, progressCallback); Logger.logInfo(string.Format("Filter worker [{0}] for line {1} has completed.", Thread.CurrentThread.ManagedThreadId, startLine)); lock (_filterReadyList) { _filterReadyList.Add(filter); } return filter; }
private void AddFilterLine(int lineNum, FilterParams filterParams, List<int> filterResultLines, List<int> lastFilterLinesList, List<int> filterHitList) { filterHitList.Add(lineNum); IList<int> filterResult = GetAdditionalFilterResults(filterParams, lineNum, lastFilterLinesList); filterResultLines.AddRange(filterResult); lastFilterLinesList.AddRange(filterResult); if (lastFilterLinesList.Count > SPREAD_MAX * 2) { lastFilterLinesList.RemoveRange(0, lastFilterLinesList.Count - SPREAD_MAX * 2); } }
public int DoFilter(FilterParams filterParams, int startLine, int maxCount, ProgressCallback progressCallback) { return DoFilter(filterParams, startLine, maxCount, FilterResultLines, LastFilterLinesList, FilterHitList, progressCallback); }
// private static bool TestMatchSub(FilterParams filterParams, string line, string lowerSearchText, string searchText, Regex rex, bool exactMatch) { if (filterParams.isRegex) { if (rex.IsMatch(line)) { return(true); } } else { if (!filterParams.isCaseSensitive) { if (exactMatch) { if (line.ToLower().Trim().Equals(lowerSearchText)) { return(true); } } else { if (line.ToLower().Contains(lowerSearchText)) { return(true); } } } else { if (exactMatch) { if (line.Equals(searchText)) { return(true); } } else { if (line.Contains(searchText)) { return(true); } } } if (filterParams.fuzzyValue > 0) { int range = line.Length - searchText.Length; if (range > 0) { for (int i = 0; i < range; ++i) { string src = line.Substring(i, searchText.Length); if (!filterParams.isCaseSensitive) { src = src.ToLower(); } string dest = filterParams.isCaseSensitive ? searchText : lowerSearchText; int dist = DamerauLevenshteinDistance(src, searchText); if ((float)(searchText.Length + 1) / (float)(dist + 1) >= 11F / (float)(filterParams.fuzzyValue + 1F)) { return(true); } } } return(false); } } return(false); }
private static bool TestFilterMatch(FilterParams filterParams, ILogLine line, ILogLineColumnizerCallback columnizerCallback) { string lowerSearchText; string searchText; Regex rex; if (filterParams.isInRange) { lowerSearchText = filterParams.lowerRangeSearchText; searchText = filterParams.rangeSearchText; rex = filterParams.rangeRex; } else { lowerSearchText = filterParams.lowerSearchText; searchText = filterParams.searchText; rex = filterParams.rex; } if (searchText == null || lowerSearchText == null || searchText.Length == 0) { return(false); } if (filterParams.columnRestrict) { IColumnizedLogLine columns = filterParams.currentColumnizer.SplitLine(columnizerCallback, line); bool found = false; foreach (int colIndex in filterParams.columnList) { if (colIndex < columns.ColumnValues.Length ) // just to be sure, maybe the columnizer has changed anyhow { if (columns.ColumnValues[colIndex].FullValue.Trim().Length == 0) { if (filterParams.emptyColumnUsePrev) { string prevValue = (string)filterParams.lastNonEmptyCols[colIndex]; if (prevValue != null) { if (TestMatchSub(filterParams, prevValue, lowerSearchText, searchText, rex, filterParams.exactColumnMatch)) { found = true; } } } else if (filterParams.emptyColumnHit) { return(true); } } else { filterParams.lastNonEmptyCols[colIndex] = columns.ColumnValues[colIndex].FullValue; if (TestMatchSub(filterParams, columns.ColumnValues[colIndex].FullValue, lowerSearchText, searchText, rex, filterParams.exactColumnMatch)) { found = true; } } } } return(found); } else { return(TestMatchSub(filterParams, line.FullLine, lowerSearchText, searchText, rex, false)); } }
void RestoreFilters(PersistenceData persistenceData) { if (persistenceData.filterParamsList.Count > 0) { _filterParams = persistenceData.filterParamsList[0]; ReInitFilterParams(_filterParams); } ApplyFilterParams(); // re-loaded filter settingss BeginInvoke(new MethodInvoker(FilterSearch)); try { splitContainer1.SplitterDistance = persistenceData.filterPosition; splitContainer1.Panel2Collapsed = !persistenceData.filterVisible; } catch (InvalidOperationException e) { Logger.logError("Error setting splitter distance: " + e.Message); } ShowAdvancedFilterPanel(persistenceData.filterAdvanced); if (_filterPipeList.Count == 0) // don't restore if it's only a reload { RestoreFilterTabs(persistenceData); } }
public LogWindow(LogTabWindow parent, string fileName, bool isTempFile, bool forcePersistenceLoading) { SuspendLayout(); InitializeComponent(); columnNamesLabel.Text = ""; // no filtering on columns by default parentLogTabWin = parent; IsTempFile = isTempFile; //Thread.CurrentThread.Name = "LogWindowThread"; ColumnizerCallbackObject = new ColumnizerCallback(this); FileName = fileName; ForcePersistenceLoading = forcePersistenceLoading; dataGridView.CellValueNeeded += dataGridView_CellValueNeeded; dataGridView.CellPainting += dataGridView_CellPainting; filterGridView.CellValueNeeded += filterGridView_CellValueNeeded; filterGridView.CellPainting += filterGridView_CellPainting; Closing += LogWindow_Closing; Disposed += LogWindow_Disposed; timeSpreadCalc = new TimeSpreadCalculator(this); timeSpreadingControl1.TimeSpreadCalc = timeSpreadCalc; timeSpreadingControl1.LineSelected += timeSpreadingControl1_LineSelected; tableLayoutPanel1.ColumnStyles[1].SizeType = SizeType.Absolute; tableLayoutPanel1.ColumnStyles[1].Width = 20; tableLayoutPanel1.ColumnStyles[0].SizeType = SizeType.Percent; tableLayoutPanel1.ColumnStyles[0].Width = 100; parentLogTabWin.HighlightSettingsChanged += parent_HighlightSettingsChanged; SetColumnizer(PluginRegistry.GetInstance().RegisteredColumnizers[0]); patternArgs.maxMisses = 5; patternArgs.minWeight = 1; patternArgs.maxDiffInBlock = 5; patternArgs.fuzzy = 5; //InitPatternWindow(); //this.toolwinTabControl.TabPages.Add(this.patternWindow); //this.toolwinTabControl.TabPages.Add(this.bookmarkWindow); filterParams = new FilterParams(); foreach (string item in ConfigManager.Settings.filterHistoryList) { filterComboBox.Items.Add(item); } filterComboBox.DropDownHeight = filterComboBox.ItemHeight * ConfigManager.Settings.preferences.maximumFilterEntriesDisplayed; filterRegexCheckBox.Checked = filterParams.isRegex; filterCaseSensitiveCheckBox.Checked = filterParams.isCaseSensitive; filterTailCheckBox.Checked = filterParams.isFilterTail; splitContainer1.Panel2Collapsed = true; advancedFilterSplitContainer.SplitterDistance = FILTER_ADCANCED_SPLITTER_DISTANCE; timeshiftSyncThread = new Thread(SyncTimestampDisplayWorker); timeshiftSyncThread.IsBackground = true; timeshiftSyncThread.Start(); logEventHandlerThread = new Thread(LogEventWorker); logEventHandlerThread.IsBackground = true; logEventHandlerThread.Start(); //this.filterUpdateThread = new Thread(new ThreadStart(this.FilterUpdateWorker)); //this.filterUpdateThread.Start(); advancedButtonImage = advancedButton.Image; searchButtonImage = filterSearchButton.Image; filterSearchButton.Image = null; dataGridView.EditModeMenuStrip = editModeContextMenuStrip; markEditModeToolStripMenuItem.Enabled = true; panelOpenButtonImage = new Bitmap(GetType(), "Resources.PanelOpen.gif"); panelCloseButtonImage = new Bitmap(GetType(), "Resources.PanelClose.gif"); Settings settings = ConfigManager.Settings; if (settings.appBounds != null && settings.appBounds.Right > 0) { Bounds = settings.appBounds; } waitingForClose = false; dataGridView.Enabled = false; dataGridView.ColumnDividerDoubleClick += dataGridView_ColumnDividerDoubleClick; ShowAdvancedFilterPanel(false); filterKnobControl1.MinValue = 0; filterKnobControl1.MaxValue = SPREAD_MAX; filterKnobControl1.ValueChanged += filterKnobControl1_ValueChanged; filterKnobControl2.MinValue = 0; filterKnobControl2.MaxValue = SPREAD_MAX; filterKnobControl2.ValueChanged += filterKnobControl1_ValueChanged; fuzzyKnobControl.MinValue = 0; fuzzyKnobControl.MaxValue = 10; //PreferencesChanged(settings.preferences, true); AdjustHighlightSplitterWidth(); ToggleHighlightPanel(false); // hidden bookmarkProvider.BookmarkAdded += bookmarkProvider_BookmarkAdded; bookmarkProvider.BookmarkRemoved += bookmarkProvider_BookmarkRemoved; bookmarkProvider.AllBookmarksRemoved += bookmarkProvider_AllBookmarksRemoved; ResumeLayout(); statusLineTrigger.Signal += statusLineTrigger_Signal; selectionChangedTrigger.Signal += selectionChangedTrigger_Signal; PreferencesChanged(parentLogTabWin.Preferences, true, SettingsFlags.GuiOrColors); }
void ReInitFilterParams(FilterParams filterParams) { filterParams.searchText = filterParams.searchText; // init "lowerSearchText" filterParams.rangeSearchText = filterParams.rangeSearchText; // init "lowerRangesearchText" filterParams.currentColumnizer = CurrentColumnizer; if (filterParams.isRegex) { try { filterParams.CreateRegex(); } catch (ArgumentException) { StatusLineError("Invalid regular expression"); return; } } }
public RangeFinder(FilterParams filterParams, LogExpert.LogWindow.ColumnizerCallback callback) { this.filterParams = filterParams.CreateCopy2(); this.callback = callback; }
void Filter(FilterParams filterParams, List<int> filterResultLines, List<int> lastFilterLinesList, List<int> filterHitList) { long startTime = Environment.TickCount; try { filterParams.Reset(); int lineNum = 0; ColumnizerCallback callback = new ColumnizerCallback(this); while (true) { string line = CurrentLogFileReader.GetLogLine(lineNum); if (line == null) { break; } callback.LineNum = lineNum; if (Classes.DamerauLevenshtein.TestFilterCondition(filterParams, line, callback)) { AddFilterLine(lineNum, false, filterParams, filterResultLines, lastFilterLinesList, filterHitList); } lineNum++; if (lineNum % PROGRESS_BAR_MODULO == 0) { UpdateProgressBar(lineNum); } if (_shouldCancel) { break; } } } catch (Exception ex) { Logger.logError("Exception while filtering. Please report to developer: \n\n" + ex + "\n\n" + ex.StackTrace); MessageBox.Show(null, "Exception while filtering. Please report to developer: \n\n" + ex + "\n\n" + ex.StackTrace, "LogExpert"); } long endTime = Environment.TickCount; #if DEBUG Logger.logInfo("Single threaded filter duration: " + ((endTime - startTime)) + " ms."); #endif StatusLineText("Filter duration: " + ((endTime - startTime)) + " ms."); }
public Range FindRange(int startLine) { Logger.logInfo("Starting range search for " + this.filterParams.searchText + " ... " + this.filterParams.rangeSearchText); if (this.filterParams.rangeSearchText == null || this.filterParams.rangeSearchText.Trim().Length == 0) { Logger.logInfo("Range search text not set. Cancelling range search."); return(null); } if (this.filterParams.searchText == null || this.filterParams.searchText.Trim().Length == 0) { Logger.logInfo("Search text not set. Cancelling range search."); return(null); } this.filterParams.isRangeSearch = false; this.filterParams.isInRange = false; string line; int lineCount = this.callback.GetLineCount(); int lineNum = startLine; bool foundStartLine = false; Range range = new Range(); FilterParams tmpParam = this.filterParams.CreateCopy2(); tmpParam.searchText = this.filterParams.rangeSearchText; // search backward for starting keyword line = this.callback.GetLogLine(lineNum); while (lineNum >= 0) { this.callback.LineNum = lineNum; if (Util.TestFilterCondition(this.filterParams, line, this.callback)) { foundStartLine = true; break; } lineNum--; line = this.callback.GetLogLine(lineNum); if (lineNum < 0 || Util.TestFilterCondition(tmpParam, line, this.callback)) // do not crash on Ctrl+R when there is not start line found { // lower range bound found --> we are not in between a valid range break; } } if (!foundStartLine) { Logger.logInfo("Range start not found"); return(null); } range.StartLine = lineNum; this.filterParams.isRangeSearch = true; this.filterParams.isInRange = true; lineNum++; while (lineNum < lineCount) { line = this.callback.GetLogLine(lineNum); this.callback.LineNum = lineNum; if (!Util.TestFilterCondition(this.filterParams, line, this.callback)) { break; } lineNum++; } lineNum--; range.EndLine = lineNum; #if DEBUG Logger.logInfo("Range search finished. Found " + (range.EndLine - range.StartLine) + " lines"); #endif return(range); }
void AddFilterLine(int lineNum, bool immediate, FilterParams filterParams, List<int> filterResultLines, List<int> lastFilterLinesList, List<int> filterHitList) { lock (_filterResultList) { filterHitList.Add(lineNum); IList<int> filterResult = GetAdditionalFilterResults(filterParams, lineNum, lastFilterLinesList); filterResultLines.AddRange(filterResult); lastFilterLinesList.AddRange(filterResult); if (lastFilterLinesList.Count > SPREAD_MAX * 2) { lastFilterLinesList.RemoveRange(0, lastFilterLinesList.Count - SPREAD_MAX * 2); } } if (immediate) { TriggerFilterLineGuiUpdate(); } }
public int DoFilter(FilterParams filterParams, int startLine, int maxCount, ProgressCallback progressCallback) { return(DoFilter(filterParams, startLine, maxCount, this.FilterResultLines, this.LastFilterLinesList, this.FilterHitList, progressCallback)); }
/// <summary> /// Indicates which columns we are filtering on /// </summary> /// <param name="filter"></param> /// <returns></returns> string CalculateColumnNames(FilterParams filter) { string names = string.Empty; if (filter.columnRestrict) { foreach (int colIndex in filter.columnList) { if (colIndex < dataGridView.Columns.Count - 2) { if (names.Length > 0) { names += ", "; } names += dataGridView.Columns[2 + colIndex].HeaderText; // skip first two columns: marker + line number } } } return names; }