From ec19127676d7321fb5c16a5ee4666588145690ff Mon Sep 17 00:00:00 2001 From: Hirogen Date: Sat, 11 Jul 2026 17:42:47 +0200 Subject: [PATCH 1/2] refactor: remove abandoned pre-beta Pattern analysis feature Deletes the orphaned fuzzy block-detection feature (PatternWindow) that has had no UI entry point for years and whose own label said it does not work. Removes: - PatternWindow.cs / .Designer.cs / .resx - LogWindow.cs: PatternStatistic (both overloads), PatternStatisticSelectRange, InitPatternWindow, TestStatistic, DetectBlock, FindSimilarLine, PrepareDict, AddBlockTargetLinesToDict, GetMsgForLine, the commented FindExistingBlock/ResetCache blocks, the _patternWindow/_patternArgs/_lineHashList fields and the PatternStatisticFx delegate - Supporting types PatternArgs, PatternBlock, QualityInfo (only referenced by the deleted code) - PatternWindow_UI_* resource strings (en/de/zh-CN + generated Designer) Util.YetiLevenshtein stays: public Core utility, potentially used by plugins. Successor idea captured in .scratch/log-template-mining-issue.md (Drain-style template mining). Ref: .scratch/pattern-analysis-deletion-issue.md Co-Authored-By: Claude Fable 5 --- src/LogExpert.Core/Classes/PatternBlock.cs | 32 -- src/LogExpert.Core/Classes/QualityInfo.cs | 6 - .../EventArguments/PatternArgs.cs | 20 - src/LogExpert.Resources/Resources.Designer.cs | 111 ----- src/LogExpert.Resources/Resources.de.resx | 39 -- src/LogExpert.Resources/Resources.resx | 40 -- src/LogExpert.Resources/Resources.zh-CN.resx | 39 -- .../Controls/LogWindow/LogWindow.cs | 469 ------------------ .../LogWindow/PatternWindow.Designer.cs | 430 ---------------- .../Controls/LogWindow/PatternWindow.cs | 419 ---------------- .../Controls/LogWindow/PatternWindow.resx | 131 ----- 11 files changed, 1736 deletions(-) delete mode 100644 src/LogExpert.Core/Classes/PatternBlock.cs delete mode 100644 src/LogExpert.Core/Classes/QualityInfo.cs delete mode 100644 src/LogExpert.Core/EventArguments/PatternArgs.cs delete mode 100644 src/LogExpert.UI/Controls/LogWindow/PatternWindow.Designer.cs delete mode 100644 src/LogExpert.UI/Controls/LogWindow/PatternWindow.cs delete mode 100644 src/LogExpert.UI/Controls/LogWindow/PatternWindow.resx diff --git a/src/LogExpert.Core/Classes/PatternBlock.cs b/src/LogExpert.Core/Classes/PatternBlock.cs deleted file mode 100644 index 41d23bc1..00000000 --- a/src/LogExpert.Core/Classes/PatternBlock.cs +++ /dev/null @@ -1,32 +0,0 @@ -namespace LogExpert.Core.Classes; - -public class PatternBlock -{ - public int BlockId { get; set; } - - public int EndLine { get; set; } - - // key: line num - public Dictionary QualityInfoList { get; set; } = []; - - public SortedDictionary SrcLines { get; set; } = []; - - public int StartLine { get; set; } - - public int TargetEnd { get; set; } - - public SortedDictionary TargetLines { get; set; } = []; - - public int TargetStart { get; set; } - - public int Weigth { get; set; } - - #region Public methods - - public override string ToString () - { - return $"srcStart={StartLine}, srcEnd={EndLine}, targetStart={TargetStart}, targetEnd={TargetEnd}, weight={Weigth}"; - } - - #endregion -} \ No newline at end of file diff --git a/src/LogExpert.Core/Classes/QualityInfo.cs b/src/LogExpert.Core/Classes/QualityInfo.cs deleted file mode 100644 index 7e150c3d..00000000 --- a/src/LogExpert.Core/Classes/QualityInfo.cs +++ /dev/null @@ -1,6 +0,0 @@ -namespace LogExpert.Core.Classes; - -public class QualityInfo -{ - public int Quality { get; set; } -} diff --git a/src/LogExpert.Core/EventArguments/PatternArgs.cs b/src/LogExpert.Core/EventArguments/PatternArgs.cs deleted file mode 100644 index 3cfe2e69..00000000 --- a/src/LogExpert.Core/EventArguments/PatternArgs.cs +++ /dev/null @@ -1,20 +0,0 @@ -namespace LogExpert.Core.EventArguments; - -public class PatternArgs -{ - #region Properties - - public int EndLine { get; set; } - - public int Fuzzy { get; set; } = 6; - - public int MaxDiffInBlock { get; set; } = 5; - - public int MaxMisses { get; set; } = 5; - - public int MinWeight { get; set; } = 15; - - public int StartLine { get; set; } - - #endregion -} \ No newline at end of file diff --git a/src/LogExpert.Resources/Resources.Designer.cs b/src/LogExpert.Resources/Resources.Designer.cs index 9ea090e3..9dcec2fe 100644 --- a/src/LogExpert.Resources/Resources.Designer.cs +++ b/src/LogExpert.Resources/Resources.Designer.cs @@ -4264,117 +4264,6 @@ public static string ParamRequesterDialog_UI_Title { } } - /// - /// Looks up a localized string similar to Recalc. - /// - public static string PatternWindow_UI_Button_Recalc { - get { - return ResourceManager.GetString("PatternWindow_UI_Button_Recalc", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Set range. - /// - public static string PatternWindow_UI_Button_SetRange { - get { - return ResourceManager.GetString("PatternWindow_UI_Button_SetRange", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Block lines:. - /// - public static string PatternWindow_UI_Label_BlockLines { - get { - return ResourceManager.GetString("PatternWindow_UI_Label_BlockLines", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to This feature is pre-beta and does not work :) - /// Usage: Select a range in the log window and press "Recalc". - /// This will search for text ranges similar to the selected one.. - /// - public static string PatternWindow_UI_Label_FeatureDescription { - get { - return ResourceManager.GetString("PatternWindow_UI_Label_FeatureDescription", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Fuzzy. - /// - public static string PatternWindow_UI_Label_Fuzzy { - get { - return ResourceManager.GetString("PatternWindow_UI_Label_Fuzzy", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Max diff. - /// - public static string PatternWindow_UI_Label_MaxDiff { - get { - return ResourceManager.GetString("PatternWindow_UI_Label_MaxDiff", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Max misses. - /// - public static string PatternWindow_UI_Label_MaxMisses { - get { - return ResourceManager.GetString("PatternWindow_UI_Label_MaxMisses", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to (no range set). - /// - public static string PatternWindow_UI_Label_NoRangeSet { - get { - return ResourceManager.GetString("PatternWindow_UI_Label_NoRangeSet", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Number of blocks (pattern variants):. - /// - public static string PatternWindow_UI_Label_NumberOfBlocks { - get { - return ResourceManager.GetString("PatternWindow_UI_Label_NumberOfBlocks", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Start: {0} - /// End: {1}. - /// - public static string PatternWindow_UI_Label_RangeFormat { - get { - return ResourceManager.GetString("PatternWindow_UI_Label_RangeFormat", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Weigth. - /// - public static string PatternWindow_UI_Label_Weight { - get { - return ResourceManager.GetString("PatternWindow_UI_Label_Weight", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to Patterns. - /// - public static string PatternWindow_UI_Title { - get { - return ResourceManager.GetString("PatternWindow_UI_Title", resourceCulture); - } - } - /// /// Looks up a localized string similar to &Close. /// diff --git a/src/LogExpert.Resources/Resources.de.resx b/src/LogExpert.Resources/Resources.de.resx index adc90283..1d076172 100644 --- a/src/LogExpert.Resources/Resources.de.resx +++ b/src/LogExpert.Resources/Resources.de.resx @@ -1656,45 +1656,6 @@ Ein ausgewähltes Tool erscheint in der Iconbar. Alle anderen verfügbaren Tools Ein unbehandelter Fehler ist aufgetreten. Bitte melden Sie dies dem Entwickler. - - Muster - - - Anzahl der Blöcke (Mustervarianten): - - - Block Zeilen: - - - Diese Funktion befindet sich in der Pre-Beta-Phase und funktioniert nicht :) - Verwendung: Wählen Sie einen Bereich im Protokollfenster aus und klicken Sie auf „Recalc“. - Dadurch wird nach Textbereichen gesucht, die dem ausgewählten Bereich ähneln. - - - Fuzzy - - - Max diff - - - Max misses - - - Gewichtung - - - (keine Reichweite gesetzt) - - - Neuberechnen - - - Bereich setzen - - - Start: {0} - Ende: {1} - Sitzung laden diff --git a/src/LogExpert.Resources/Resources.resx b/src/LogExpert.Resources/Resources.resx index b6b804cd..b5e64674 100644 --- a/src/LogExpert.Resources/Resources.resx +++ b/src/LogExpert.Resources/Resources.resx @@ -1719,46 +1719,6 @@ Checked tools will appear in the icon bar. All other tools are available in the Copy to clipboard - - Patterns - - - Number of blocks (pattern variants): - - - Block lines: - - - This feature is pre-beta and does not work :) - Usage: Select a range in the log window and press "Recalc". - This will search for text ranges similar to the selected one. - @MutedRule(PunctuationTail) - - - Fuzzy - - - Max diff - - - Max misses - - - Weigth - - - (no range set) - - - Recalc - - - Set range - - - Start: {0} - End: {1} - Loading Session diff --git a/src/LogExpert.Resources/Resources.zh-CN.resx b/src/LogExpert.Resources/Resources.zh-CN.resx index 846b0563..28502ceb 100644 --- a/src/LogExpert.Resources/Resources.zh-CN.resx +++ b/src/LogExpert.Resources/Resources.zh-CN.resx @@ -1515,45 +1515,6 @@ 复制到剪贴板 - - 模式 - - - 块数量(模式变体): - - - 块行数: - - - 此功能处于预 Beta 阶段,尚不可用 :) -用法:在日志窗口中选择一个范围并按“重新计算”。 -这将会搜索与所选范围相似的文本范围。" - - - 模糊 - - - 最大差异 - - - 最大缺失 - - - 权重 - - - (未设定范围) - - - 重新计算 - - - 设定范围 - - - 起始: {0} - 结束: {1} - 正在加载会话 diff --git a/src/LogExpert.UI/Controls/LogWindow/LogWindow.cs b/src/LogExpert.UI/Controls/LogWindow/LogWindow.cs index 7ef5a109..7a1cc03c 100644 --- a/src/LogExpert.UI/Controls/LogWindow/LogWindow.cs +++ b/src/LogExpert.UI/Controls/LogWindow/LogWindow.cs @@ -71,8 +71,6 @@ internal partial class LogWindow : DockContent, ILogPaintContextUI, ILogView, IL private readonly Dictionary _freezeStateMap = []; private readonly GuiStateEventArgs _guiStateArgs = new(); - private readonly List _lineHashList = []; - private readonly EventWaitHandle _loadingFinishedEvent = new ManualResetEvent(false); private readonly EventWaitHandle _logEventArgsEvent = new AutoResetEvent(false); @@ -146,8 +144,6 @@ internal partial class LogWindow : DockContent, ILogPaintContextUI, ILogView, IL private LogfileReader _logFileReader; private MultiFileOptions _multiFileOptions = new(); private bool _noSelectionUpdates; - private PatternArgs _patternArgs = new(); - private PatternWindow _patternWindow; private ReloadMemento _reloadMemento; private int _reloadOverloadCounter; @@ -219,14 +215,6 @@ public LogWindow (ILogWindowCoordinator logWindowCoordinator, string fileName, b _logWindowCoordinator.HighlightSettingsChanged += OnParentHighlightSettingsChanged; SetColumnizer(PluginRegistry.PluginRegistry.Instance.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(); @@ -695,8 +683,6 @@ private void OnButtonSizeChanged (object sender, EventArgs e) private delegate void FunctionWith1BoolParam (bool arg); - private delegate void PatternStatisticFx (PatternArgs patternArgs); - private delegate void ActionPluginExecuteFx (string keyword, string param, ILogExpertCallbackMemory callback, ILogLineMemoryColumnizer columnizer); private delegate void PositionAfterReloadFx (ReloadMemento reloadMemento); @@ -3381,7 +3367,6 @@ private void SetColumnizerInternal (ILogLineMemoryColumnizer columnizer) SetColumnizer(columnizer, dataGridView); SetColumnizer(columnizer, filterGridView); - _patternWindow?.SetColumnizer(columnizer); _guiStateArgs.TimeshiftPossible = columnizer.IsTimeshiftImplemented(); SendGuiStateUpdate(); @@ -5352,418 +5337,6 @@ protected internal void AddTempFileTab (string fileName, string title) _ = _logWindowCoordinator.AddTempFileTab(fileName, title); } - private void InitPatternWindow () - { - //PatternStatistic(this.patternArgs); - _patternWindow = new PatternWindow(this); - _patternWindow.SetColumnizer(CurrentColumnizer); - //this.patternWindow.SetBlockList(blockList); - _patternWindow.SetFont(Preferences.Font); - _patternWindow.Fuzzy = _patternArgs.Fuzzy; - _patternWindow.MaxDiff = _patternArgs.MaxDiffInBlock; - _patternWindow.MaxMisses = _patternArgs.MaxMisses; - _patternWindow.Weight = _patternArgs.MinWeight; - //this.patternWindow.Show(); - } - - [SupportedOSPlatform("windows")] - private void TestStatistic (PatternArgs patternArgs) - { - var beginLine = patternArgs.StartLine; - //_logger.Info($"### TestStatistics: called with start line {beginLine}"); - - _patternArgs = patternArgs; - - var num = beginLine + 1; //this.dataGridView.RowCount; - - _progressEventArgs.MinValue = 0; - _progressEventArgs.MaxValue = dataGridView.RowCount; - _progressEventArgs.Value = beginLine; - _progressEventArgs.Visible = true; - SendProgressBarUpdate(); - - PrepareDict(); - //ResetCache(num); TODO REIPMLEMENT - - Dictionary processedLinesDict = []; - List blockList = []; - var blockId = 0; - _isSearching = true; - - // Per-job token, linked to the window's lifetime; ESC reaches it via the registry. - using var patternCts = CancellationTokenSource.CreateLinkedTokenSource(_windowCts.Token); - var cancelHandler = new FilterRunCancelHandler(patternCts); - OnRegisterCancelHandler(cancelHandler); - var cancellationToken = patternCts.Token; - - var searchLine = -1; - for (var i = beginLine; i < num && !cancellationToken.IsCancellationRequested; ++i) - { - if (processedLinesDict.ContainsKey(i)) - { - continue; - } - - PatternBlock block; - var maxBlockLen = patternArgs.EndLine - patternArgs.StartLine; - //int searchLine = i + 1; - //_logger.Debug($"TestStatistic(): i={i} searchLine={searchLine}"); - //bool firstBlock = true; - searchLine++; - UpdateProgressBar(searchLine); - while (!cancellationToken.IsCancellationRequested && - (block = - DetectBlock(i, - searchLine, - maxBlockLen, - _patternArgs.MaxDiffInBlock, - _patternArgs.MaxMisses, - processedLinesDict, - cancellationToken) - ) != null) - { - //_logger.Debug($"Found block: {block}"); - if (block.Weigth >= _patternArgs.MinWeight) - { - //PatternBlock existingBlock = FindExistingBlock(block, blockList); - //if (existingBlock != null) - //{ - // if (block.weigth > existingBlock.weigth) - // { - // blockList.Remove(existingBlock); - // blockList.Add(block); - // } - //} - //else - { - blockList.Add(block); - AddBlockTargetLinesToDict(processedLinesDict, block); - } - - block.BlockId = blockId; - //if (firstBlock) - //{ - // addBlockSrcLinesToDict(processedLinesDict, block); - //} - searchLine = block.TargetEnd + 1; - } - else - { - searchLine = block.TargetStart + 1; - } - - UpdateProgressBar(searchLine); - } - - blockId++; - } - - OnDeRegisterCancelHandler(cancelHandler); - _isSearching = false; - _progressEventArgs.MinValue = 0; - _progressEventArgs.MaxValue = 0; - _progressEventArgs.Value = 0; - _progressEventArgs.Visible = false; - SendProgressBarUpdate(); - //if (this.patternWindow.IsDisposed) - //{ - // this.Invoke(new MethodInvoker(CreatePatternWindow)); - //} - _patternWindow.SetBlockList(blockList, _patternArgs); - } - - private static void AddBlockTargetLinesToDict (Dictionary dict, PatternBlock block) - { - foreach (var lineNum in block.TargetLines.Keys) - { - _ = dict.TryAdd(lineNum, lineNum); - } - } - - //Well keep this for the moment because there is some other commented code which calls this one - //TODO REIMPLEMENT if needed, otherwise remove - //private static PatternBlock FindExistingBlock (PatternBlock block, List blockList) - //{ - // foreach (var searchBlock in blockList) - // { - // if (((block.StartLine > searchBlock.StartLine && block.StartLine < searchBlock.EndLine) || - // (block.EndLine > searchBlock.StartLine && block.EndLine < searchBlock.EndLine)) && - // block.StartLine != searchBlock.StartLine && - // block.EndLine != searchBlock.EndLine - // ) - // { - // return searchBlock; - // } - // } - - // return null; - //} - - private PatternBlock DetectBlock (int startNum, int startLineToSearch, int maxBlockLen, int maxDiffInBlock, int maxMisses, Dictionary processedLinesDict, CancellationToken cancellationToken) - { - var targetLine = FindSimilarLine(startNum, startLineToSearch, processedLinesDict); - if (targetLine == -1) - { - return null; - } - - PatternBlock block = new() - { - StartLine = startNum - }; - - var srcLine = block.StartLine; - block.TargetStart = targetLine; - var srcMisses = 0; - block.SrcLines.Add(srcLine, srcLine); - //block.targetLines.Add(targetLine, targetLine); - var len = 0; - QualityInfo qi = new() - { - Quality = block.Weigth - }; - block.QualityInfoList[targetLine] = qi; - - while (!cancellationToken.IsCancellationRequested) - { - srcLine++; - len++; - //if (srcLine >= block.targetStart) - // break; // prevent to search in the own block - if (maxBlockLen > 0 && len > maxBlockLen) - { - break; - } - - var nextTargetLine = FindSimilarLine(srcLine, targetLine + 1, processedLinesDict); - if (nextTargetLine > -1 && nextTargetLine - targetLine - 1 <= maxDiffInBlock) - { - block.Weigth += maxDiffInBlock - (nextTargetLine - targetLine - 1) + 1; - block.EndLine = srcLine; - //block.targetLines.Add(nextTargetLine, nextTargetLine); - block.SrcLines.Add(srcLine, srcLine); - if (nextTargetLine - targetLine > 1) - { - var tempWeight = block.Weigth; - for (var tl = targetLine + 1; tl < nextTargetLine; ++tl) - { - qi = new QualityInfo - { - Quality = --tempWeight - }; - block.QualityInfoList[tl] = qi; - } - } - - targetLine = nextTargetLine; - qi = new QualityInfo - { - Quality = block.Weigth - }; - block.QualityInfoList[targetLine] = qi; - } - else - { - srcMisses++; - block.Weigth--; - targetLine++; - qi = new QualityInfo - { - Quality = block.Weigth - }; - block.QualityInfoList[targetLine] = qi; - if (srcMisses > maxMisses) - { - break; - } - } - } - - block.TargetEnd = targetLine; - qi = new QualityInfo - { - Quality = block.Weigth - }; - - block.QualityInfoList[targetLine] = qi; - - for (var k = block.TargetStart; k <= block.TargetEnd; ++k) - { - block.TargetLines.Add(k, k); - } - - return block; - } - - private void PrepareDict () - { - _lineHashList.Clear(); - - var num = _logFileReader.LineCount; - for (var i = 0; i < num; ++i) - { - var msgMemory = GetMsgForLine(i); - if (!msgMemory.IsEmpty) - { - var span = msgMemory.Span; - var value = 0; - var numOfE = 0; - var numOfA = 0; - var numOfI = 0; - - foreach (var c in span) - { - var lower = char.ToLowerInvariant(c); - - // TODO: verify that the normalization semantics are correct and intended: - // Normalize: \d → '0', then \S (non-whitespace) → ' ' - // Note: original applies \d first, then \S. Since '0' is non-whitespace, - // digits also become ' '. Effectively ALL non-whitespace → ' '. - // Verification is need that this is the intended behavior. - // If \S was meant to be \s (whitespace → space) or \D (non-digit → space), - // the hash semantics would differ significantly. - var normalized = char.IsWhiteSpace(lower) ? lower : ' '; - - value += normalized; - - switch (lower) - { - case 'e': numOfE++; break; - case 'a': numOfA++; break; - case 'i': numOfI++; break; - } - } - - value += numOfE * 30 + numOfA * 20 + numOfI * 10; - _lineHashList.Add(value); - } - } - } - - //TODO Reimplement - //private int FindSimilarLine (int srcLine, int startLine) - //{ - // var value = _lineHashList[srcLine]; - - // var num = _lineHashList.Count; - // for (var i = startLine; i < num; ++i) - // { - // if (Math.Abs(_lineHashList[i] - value) < 3) - // { - // return i; - // } - // } - - // return -1; - //} - - //TODO Reimplement this cache to speed up the similar line search - // int[,] similarCache; - //private static void ResetCache (int num) - //{ - // //this.similarCache = new int[num, num]; - // //for (int i = 0; i < num; ++i) - // //{ - // // for (int j = 0; j < num; j++) - // // { - // // this.similarCache[i, j] = -1; - // // } - // //} - //} - - private int FindSimilarLine (int srcLine, int startLine, Dictionary processedLinesDict) - { - var threshold = _patternArgs.Fuzzy; - - var prepared = false; - string msgToFind = null; - var culture = CultureInfo.CurrentCulture; - - char[] normalizedBuffer = null; - - var num = _logFileReader.LineCount; - for (var i = startLine; i < num; ++i) - { - if (processedLinesDict.ContainsKey(i)) - { - continue; - } - - //if (this.similarCache[srcLine, i] != -1) - //{ - // if (this.similarCache[srcLine, i] < threshold) - // { - // return i; - // } - //} - //else - { - if (!prepared) - { - var srcMemory = GetMsgForLine(srcLine); - msgToFind = string.Create(srcMemory.Length, srcMemory, static (dest, src) => - { - var source = src.Span; - for (var j = 0; j < source.Length; ++j) - { - var c = char.ToLowerInvariant(source[j]); - dest[j] = char.IsDigit(c) ? '0' // \d -> '0', - : !char.IsLetterOrDigit(c) && c != '_' ? ' ' // \W -> ' ' - : c; - } - }); - - prepared = true; - } - - var msgMemory = GetMsgForLine(i); - if (!msgMemory.IsEmpty) - { - // Early length check — normalization preserves length, so check on span directly. - // Both \d→'0' and \W→' ' are 1:1 char replacements, length is unchanged. - var lenDiff = Math.Abs(msgMemory.Length - msgToFind.Length); - if (lenDiff > threshold) - { - continue; - } - - if (normalizedBuffer == null || normalizedBuffer.Length < msgMemory.Length) - { - normalizedBuffer = new char[msgMemory.Length]; - } - - var normalized = normalizedBuffer.AsSpan(0, msgMemory.Length); - - var source = msgMemory.Span; - for (var j = 0; j < source.Length; j++) - { - var c = char.ToLowerInvariant(source[j]); - normalized[j] = char.IsDigit(c) ? '0' - : !char.IsLetterOrDigit(c) && c != '_' ? ' ' - : c; - } - - var distance = Util.YetiLevenshtein(msgToFind.AsSpan(), normalized); - if (distance < threshold) - { - return i; - } - } - } - } - - return -1; - } - - private ReadOnlyMemory GetMsgForLine (int i) - { - var line = _logFileReader.GetLogLineMemory(i); - var columnizer = CurrentColumnizer; - ColumnizerCallback callback = new(this); - var cols = columnizer.SplitLine(callback, line); - return cols.ColumnValues.Last().FullValue; - } - [SupportedOSPlatform("windows")] private void ChangeRowHeight (bool decrease) { @@ -8109,48 +7682,6 @@ public void ShowLineColumn (bool show) filterGridView.Columns[1].Visible = show; } - // ================================================================= - // Pattern statistics - // ================================================================= - - public void PatternStatistic () - { - InitPatternWindow(); - } - - public void PatternStatisticSelectRange (PatternArgs patternArgs) - { - if (dataGridView.SelectionMode == DataGridViewSelectionMode.FullRowSelect) - { - List lineNumList = []; - foreach (DataGridViewRow row in dataGridView.SelectedRows) - { - if (row.Index != -1) - { - lineNumList.Add(row.Index); - } - } - - lineNumList.Sort(); - patternArgs.StartLine = lineNumList[0]; - patternArgs.EndLine = lineNumList[^1]; - } - else - { - patternArgs.StartLine = dataGridView.CurrentCellAddress.Y != -1 - ? dataGridView.CurrentCellAddress.Y - : 0; - patternArgs.EndLine = dataGridView.RowCount - 1; - } - } - - public void PatternStatistic (PatternArgs patternArgs) - { - //var fx = new PatternStatisticFx(TestStatistic); - _ = Task.Run(() => TestStatistic(patternArgs)); - //_ = fx.BeginInvoke(patternArgs, null, null); - } - public void ExportBookmarkList () { SaveFileDialog dlg = new() diff --git a/src/LogExpert.UI/Controls/LogWindow/PatternWindow.Designer.cs b/src/LogExpert.UI/Controls/LogWindow/PatternWindow.Designer.cs deleted file mode 100644 index f560726e..00000000 --- a/src/LogExpert.UI/Controls/LogWindow/PatternWindow.Designer.cs +++ /dev/null @@ -1,430 +0,0 @@ -namespace LogExpert.UI.Controls.LogWindow -{ - partial class PatternWindow - { - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(PatternWindow)); - this.splitContainer1 = new System.Windows.Forms.SplitContainer(); - this.panel3 = new System.Windows.Forms.Panel(); - this.splitContainer2 = new System.Windows.Forms.SplitContainer(); - this.panel2 = new System.Windows.Forms.Panel(); - this.blockCountLabel = new System.Windows.Forms.Label(); - this.labelNumberOfBlocks = new System.Windows.Forms.Label(); - this.panel1 = new System.Windows.Forms.Panel(); - this.labelBlockLines = new System.Windows.Forms.Label(); - this.blockLinesLabel = new System.Windows.Forms.Label(); - this.panel4 = new System.Windows.Forms.Panel(); - this.buttonSetRange = new System.Windows.Forms.Button(); - this.labelWeight = new System.Windows.Forms.Label(); - this.buttonRecalculate = new System.Windows.Forms.Button(); - this.labelMaxMisses = new System.Windows.Forms.Label(); - this.labelMaxDiff = new System.Windows.Forms.Label(); - this.labelFuzzy = new System.Windows.Forms.Label(); - this.labelFeatureDescription = new System.Windows.Forms.Label(); - this.labelNoRangeSet = new System.Windows.Forms.Label(); - this.weigthKnobControl = new KnobControl(); - this.maxMissesKnobControl = new KnobControl(); - this.maxDiffKnobControl = new KnobControl(); - this.fuzzyKnobControl = new KnobControl(); - this.patternHitsDataGridView = new LogExpert.UI.Controls.BufferedDataGridView(); - this.contentDataGridView = new LogExpert.UI.Controls.BufferedDataGridView(); - this.splitContainer1.Panel1.SuspendLayout(); - this.splitContainer1.Panel2.SuspendLayout(); - this.splitContainer1.SuspendLayout(); - this.splitContainer2.Panel1.SuspendLayout(); - this.splitContainer2.Panel2.SuspendLayout(); - this.splitContainer2.SuspendLayout(); - this.panel2.SuspendLayout(); - this.panel1.SuspendLayout(); - this.panel4.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.patternHitsDataGridView)).BeginInit(); - ((System.ComponentModel.ISupportInitialize)(this.contentDataGridView)).BeginInit(); - this.SuspendLayout(); - // - // splitContainer1 - // - this.splitContainer1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.splitContainer1.BackColor = System.Drawing.SystemColors.Control; - this.splitContainer1.IsSplitterFixed = true; - this.splitContainer1.Location = new System.Drawing.Point(2, 1); - this.splitContainer1.Name = "splitContainer1"; - this.splitContainer1.Orientation = System.Windows.Forms.Orientation.Horizontal; - // - // splitContainer1.Panel1 - // - this.splitContainer1.Panel1.Controls.Add(this.panel3); - this.splitContainer1.Panel1Collapsed = true; - this.splitContainer1.Panel1MinSize = 0; - // - // splitContainer1.Panel2 - // - this.splitContainer1.Panel2.Controls.Add(this.splitContainer2); - this.splitContainer1.Panel2MinSize = 0; - this.splitContainer1.Size = new System.Drawing.Size(795, 106); - this.splitContainer1.SplitterDistance = 106; - this.splitContainer1.TabIndex = 3; - // - // panel3 - // - this.panel3.Dock = System.Windows.Forms.DockStyle.Fill; - this.panel3.Location = new System.Drawing.Point(0, 0); - this.panel3.Name = "panel3"; - this.panel3.Size = new System.Drawing.Size(150, 106); - this.panel3.TabIndex = 1; - // - // splitContainer2 - // - this.splitContainer2.Dock = System.Windows.Forms.DockStyle.Fill; - this.splitContainer2.Location = new System.Drawing.Point(0, 0); - this.splitContainer2.Name = "splitContainer2"; - // - // splitContainer2.Panel1 - // - this.splitContainer2.Panel1.Controls.Add(this.panel2); - // - // splitContainer2.Panel2 - // - this.splitContainer2.Panel2.Controls.Add(this.panel1); - this.splitContainer2.Size = new System.Drawing.Size(795, 106); - this.splitContainer2.SplitterDistance = 294; - this.splitContainer2.TabIndex = 2; - // - // panel2 - // - this.panel2.Controls.Add(this.blockCountLabel); - this.panel2.Controls.Add(this.labelNumberOfBlocks); - this.panel2.Controls.Add(this.patternHitsDataGridView); - this.panel2.Dock = System.Windows.Forms.DockStyle.Fill; - this.panel2.Location = new System.Drawing.Point(0, 0); - this.panel2.Name = "panel2"; - this.panel2.Size = new System.Drawing.Size(294, 106); - this.panel2.TabIndex = 2; - // - // blockCountLabel - // - this.blockCountLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.blockCountLabel.AutoSize = true; - this.blockCountLabel.Location = new System.Drawing.Point(184, 89); - this.blockCountLabel.Name = "blockCountLabel"; - this.blockCountLabel.Size = new System.Drawing.Size(13, 13); - this.blockCountLabel.TabIndex = 3; - this.blockCountLabel.Text = "0"; - // - // label1 - // - this.labelNumberOfBlocks.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.labelNumberOfBlocks.AutoSize = true; - this.labelNumberOfBlocks.Location = new System.Drawing.Point(0, 89); - this.labelNumberOfBlocks.Name = "label1"; - this.labelNumberOfBlocks.Size = new System.Drawing.Size(175, 13); - this.labelNumberOfBlocks.TabIndex = 2; - this.labelNumberOfBlocks.Text = "Number of blocks (pattern variants):"; - // - // panel1 - // - this.panel1.Controls.Add(this.labelBlockLines); - this.panel1.Controls.Add(this.blockLinesLabel); - this.panel1.Controls.Add(this.contentDataGridView); - this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; - this.panel1.Location = new System.Drawing.Point(0, 0); - this.panel1.Name = "panel1"; - this.panel1.Size = new System.Drawing.Size(497, 106); - this.panel1.TabIndex = 1; - // - // label2 - // - this.labelBlockLines.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.labelBlockLines.AutoSize = true; - this.labelBlockLines.Location = new System.Drawing.Point(3, 89); - this.labelBlockLines.Name = "label2"; - this.labelBlockLines.Size = new System.Drawing.Size(61, 13); - this.labelBlockLines.TabIndex = 2; - this.labelBlockLines.Text = "Block lines:"; - // - // blockLinesLabel - // - this.blockLinesLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.blockLinesLabel.Location = new System.Drawing.Point(70, 89); - this.blockLinesLabel.Name = "blockLinesLabel"; - this.blockLinesLabel.Size = new System.Drawing.Size(69, 13); - this.blockLinesLabel.TabIndex = 1; - this.blockLinesLabel.Text = "0"; - // - // panel4 - // - this.panel4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.panel4.Controls.Add(this.buttonSetRange); - this.panel4.Controls.Add(this.labelWeight); - this.panel4.Controls.Add(this.buttonRecalculate); - this.panel4.Controls.Add(this.weigthKnobControl); - this.panel4.Controls.Add(this.labelMaxMisses); - this.panel4.Controls.Add(this.maxMissesKnobControl); - this.panel4.Controls.Add(this.labelMaxDiff); - this.panel4.Controls.Add(this.maxDiffKnobControl); - this.panel4.Controls.Add(this.labelFuzzy); - this.panel4.Controls.Add(this.fuzzyKnobControl); - this.panel4.Location = new System.Drawing.Point(3, 106); - this.panel4.Name = "panel4"; - this.panel4.Size = new System.Drawing.Size(345, 57); - this.panel4.TabIndex = 5; - // - // setRangeButton - // - this.buttonSetRange.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonSetRange.Location = new System.Drawing.Point(267, 5); - this.buttonSetRange.Name = "setRangeButton"; - this.buttonSetRange.Size = new System.Drawing.Size(75, 23); - this.buttonSetRange.TabIndex = 12; - this.buttonSetRange.Text = "Set range"; - this.buttonSetRange.UseVisualStyleBackColor = true; - this.buttonSetRange.Click += new System.EventHandler(this.OnSetRangeButtonClick); - // - // label7 - // - this.labelWeight.AutoSize = true; - this.labelWeight.Location = new System.Drawing.Point(192, 41); - this.labelWeight.Name = "label7"; - this.labelWeight.Size = new System.Drawing.Size(41, 13); - this.labelWeight.TabIndex = 11; - this.labelWeight.Text = "Weigth"; - // - // recalcButton - // - this.buttonRecalculate.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.buttonRecalculate.Location = new System.Drawing.Point(267, 30); - this.buttonRecalculate.Name = "recalcButton"; - this.buttonRecalculate.Size = new System.Drawing.Size(75, 23); - this.buttonRecalculate.TabIndex = 6; - this.buttonRecalculate.Text = "Recalc"; - this.buttonRecalculate.UseVisualStyleBackColor = true; - this.buttonRecalculate.Click += new System.EventHandler(this.OnRecalcButtonClick); - // - // label6 - // - this.labelMaxMisses.AutoSize = true; - this.labelMaxMisses.Location = new System.Drawing.Point(113, 41); - this.labelMaxMisses.Name = "label6"; - this.labelMaxMisses.Size = new System.Drawing.Size(61, 13); - this.labelMaxMisses.TabIndex = 9; - this.labelMaxMisses.Text = "Max misses"; - // - // label5 - // - this.labelMaxDiff.AutoSize = true; - this.labelMaxDiff.Location = new System.Drawing.Point(57, 41); - this.labelMaxDiff.Name = "label5"; - this.labelMaxDiff.Size = new System.Drawing.Size(44, 13); - this.labelMaxDiff.TabIndex = 7; - this.labelMaxDiff.Text = "Max diff"; - // - // label4 - // - this.labelFuzzy.AutoSize = true; - this.labelFuzzy.Location = new System.Drawing.Point(6, 41); - this.labelFuzzy.Name = "label4"; - this.labelFuzzy.Size = new System.Drawing.Size(34, 13); - this.labelFuzzy.TabIndex = 5; - this.labelFuzzy.Text = "Fuzzy"; - // - // label3 - // - this.labelFeatureDescription.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); - this.labelFeatureDescription.Location = new System.Drawing.Point(483, 110); - this.labelFeatureDescription.Name = "label3"; - this.labelFeatureDescription.Size = new System.Drawing.Size(303, 49); - this.labelFeatureDescription.TabIndex = 12; - this.labelFeatureDescription.Text = "This feature is pre-beta and does not work :)\r\nUsage: Select a range in the log w" + - "indow and press \"Recalc\". \r\nThis will search for text ranges similar to the sele" + - "cted one."; - // - // rangeLabel - // - this.labelNoRangeSet.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left))); - this.labelNoRangeSet.Location = new System.Drawing.Point(352, 114); - this.labelNoRangeSet.Name = "rangeLabel"; - this.labelNoRangeSet.Size = new System.Drawing.Size(125, 42); - this.labelNoRangeSet.TabIndex = 13; - this.labelNoRangeSet.Text = "(no range set)"; - // - // weigthKnobControl - // - this.weigthKnobControl.Location = new System.Drawing.Point(202, 5); - this.weigthKnobControl.MaxValue = 30; - this.weigthKnobControl.MinValue = 1; - this.weigthKnobControl.Name = "weigthKnobControl"; - this.weigthKnobControl.Size = new System.Drawing.Size(21, 35); - this.weigthKnobControl.TabIndex = 10; - this.weigthKnobControl.Value = 0; - // - // maxMissesKnobControl - // - this.maxMissesKnobControl.Location = new System.Drawing.Point(134, 5); - this.maxMissesKnobControl.MaxValue = 30; - this.maxMissesKnobControl.MinValue = 0; - this.maxMissesKnobControl.Name = "maxMissesKnobControl"; - this.maxMissesKnobControl.Size = new System.Drawing.Size(22, 35); - this.maxMissesKnobControl.TabIndex = 8; - this.maxMissesKnobControl.Value = 0; - // - // maxDiffKnobControl - // - this.maxDiffKnobControl.Location = new System.Drawing.Point(69, 5); - this.maxDiffKnobControl.MaxValue = 30; - this.maxDiffKnobControl.MinValue = 0; - this.maxDiffKnobControl.Name = "maxDiffKnobControl"; - this.maxDiffKnobControl.Size = new System.Drawing.Size(21, 35); - this.maxDiffKnobControl.TabIndex = 6; - this.maxDiffKnobControl.Value = 0; - // - // fuzzyKnobControl - // - this.fuzzyKnobControl.Location = new System.Drawing.Point(9, 5); - this.fuzzyKnobControl.MaxValue = 20; - this.fuzzyKnobControl.MinValue = 0; - this.fuzzyKnobControl.Name = "fuzzyKnobControl"; - this.fuzzyKnobControl.Size = new System.Drawing.Size(22, 35); - this.fuzzyKnobControl.TabIndex = 4; - this.fuzzyKnobControl.Value = 0; - // - // patternHitsDataGridView - // - this.patternHitsDataGridView.AllowUserToAddRows = false; - this.patternHitsDataGridView.AllowUserToDeleteRows = false; - this.patternHitsDataGridView.AllowUserToResizeRows = false; - this.patternHitsDataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.patternHitsDataGridView.BackgroundColor = System.Drawing.SystemColors.Window; - this.patternHitsDataGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; - this.patternHitsDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.patternHitsDataGridView.EditMode = System.Windows.Forms.DataGridViewEditMode.EditProgrammatically; - this.patternHitsDataGridView.EditModeMenuStrip = null; - this.patternHitsDataGridView.Location = new System.Drawing.Point(3, 3); - this.patternHitsDataGridView.MultiSelect = false; - this.patternHitsDataGridView.Name = "patternHitsDataGridView"; - this.patternHitsDataGridView.ReadOnly = true; - this.patternHitsDataGridView.RowHeadersVisible = false; - this.patternHitsDataGridView.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.patternHitsDataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.patternHitsDataGridView.ShowCellToolTips = false; - this.patternHitsDataGridView.Size = new System.Drawing.Size(289, 83); - this.patternHitsDataGridView.TabIndex = 1; - this.patternHitsDataGridView.VirtualMode = true; - this.patternHitsDataGridView.MouseDoubleClick += new System.Windows.Forms.MouseEventHandler(this.OnPatternHitsDataGridViewMouseDoubleClick); - this.patternHitsDataGridView.CellValueNeeded += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnPatternHitsDataGridViewCellValueNeeded); - this.patternHitsDataGridView.ColumnDividerDoubleClick += new System.Windows.Forms.DataGridViewColumnDividerDoubleClickEventHandler(this.OnPatternHitsDataGridViewColumnDividerDoubleClick); - this.patternHitsDataGridView.CellPainting += new System.Windows.Forms.DataGridViewCellPaintingEventHandler(this.OnPatternHitsDataGridViewCellPainting); - this.patternHitsDataGridView.CurrentCellChanged += new System.EventHandler(this.OnPatternHitsDataGridViewCurrentCellChanged); - // - // contentDataGridView - // - this.contentDataGridView.AllowUserToAddRows = false; - this.contentDataGridView.AllowUserToDeleteRows = false; - this.contentDataGridView.AllowUserToResizeRows = false; - this.contentDataGridView.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) - | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); - this.contentDataGridView.BackgroundColor = System.Drawing.SystemColors.Window; - this.contentDataGridView.CellBorderStyle = System.Windows.Forms.DataGridViewCellBorderStyle.None; - this.contentDataGridView.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; - this.contentDataGridView.EditModeMenuStrip = null; - this.contentDataGridView.Location = new System.Drawing.Point(3, 3); - this.contentDataGridView.Name = "contentDataGridView"; - this.contentDataGridView.ReadOnly = true; - this.contentDataGridView.RowHeadersVisible = false; - this.contentDataGridView.RowTemplate.DefaultCellStyle.Font = new System.Drawing.Font("Courier New", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.contentDataGridView.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; - this.contentDataGridView.ShowCellToolTips = false; - this.contentDataGridView.Size = new System.Drawing.Size(491, 83); - this.contentDataGridView.TabIndex = 0; - this.contentDataGridView.VirtualMode = true; - this.contentDataGridView.CellValueNeeded += new System.Windows.Forms.DataGridViewCellValueEventHandler(this.OnContentDataGridViewCellValueNeeded); - this.contentDataGridView.ColumnDividerDoubleClick += new System.Windows.Forms.DataGridViewColumnDividerDoubleClickEventHandler(this.OnContentDataGridViewColumnDividerDoubleClick); - this.contentDataGridView.CellPainting += new System.Windows.Forms.DataGridViewCellPaintingEventHandler(this.OnContentDataGridViewCellPainting); - this.contentDataGridView.CellMouseDoubleClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.OnContentDataGridViewCellMouseDoubleClick); - // - // PatternWindow - // - this.ClientSize = new System.Drawing.Size(798, 165); - this.Controls.Add(this.labelNoRangeSet); - this.Controls.Add(this.labelFeatureDescription); - this.Controls.Add(this.panel4); - this.Controls.Add(this.splitContainer1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None; - this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); - this.MaximizeBox = false; - this.Name = "PatternWindow"; - this.Text = "Patterns"; - this.splitContainer1.Panel1.ResumeLayout(false); - this.splitContainer1.Panel2.ResumeLayout(false); - this.splitContainer1.ResumeLayout(false); - this.splitContainer2.Panel1.ResumeLayout(false); - this.splitContainer2.Panel2.ResumeLayout(false); - this.splitContainer2.ResumeLayout(false); - this.panel2.ResumeLayout(false); - this.panel2.PerformLayout(); - this.panel1.ResumeLayout(false); - this.panel1.PerformLayout(); - this.panel4.ResumeLayout(false); - this.panel4.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.patternHitsDataGridView)).EndInit(); - ((System.ComponentModel.ISupportInitialize)(this.contentDataGridView)).EndInit(); - this.ResumeLayout(false); - - } - - #endregion - - private LogExpert.UI.Controls.BufferedDataGridView patternHitsDataGridView; - private System.Windows.Forms.SplitContainer splitContainer1; - private System.Windows.Forms.SplitContainer splitContainer2; - private LogExpert.UI.Controls.BufferedDataGridView contentDataGridView; - private System.Windows.Forms.Panel panel1; - private System.Windows.Forms.Label labelBlockLines; - private System.Windows.Forms.Label blockLinesLabel; - private System.Windows.Forms.Panel panel2; - private System.Windows.Forms.Label labelNumberOfBlocks; - private System.Windows.Forms.Label blockCountLabel; - private System.Windows.Forms.Panel panel3; - private KnobControl fuzzyKnobControl; - private System.Windows.Forms.Panel panel4; - private System.Windows.Forms.Label labelFuzzy; - private System.Windows.Forms.Label labelMaxDiff; - private KnobControl maxDiffKnobControl; - private System.Windows.Forms.Label labelMaxMisses; - private KnobControl maxMissesKnobControl; - private System.Windows.Forms.Label labelWeight; - private KnobControl weigthKnobControl; - private System.Windows.Forms.Button buttonRecalculate; - private System.Windows.Forms.Label labelFeatureDescription; - private System.Windows.Forms.Button buttonSetRange; - private System.Windows.Forms.Label labelNoRangeSet; - } -} \ No newline at end of file diff --git a/src/LogExpert.UI/Controls/LogWindow/PatternWindow.cs b/src/LogExpert.UI/Controls/LogWindow/PatternWindow.cs deleted file mode 100644 index 0e10d330..00000000 --- a/src/LogExpert.UI/Controls/LogWindow/PatternWindow.cs +++ /dev/null @@ -1,419 +0,0 @@ -using System.ComponentModel; -using System.Globalization; -using System.Runtime.Versioning; - -using ColumnizerLib; - -using LogExpert.Core.Classes; -using LogExpert.Core.EventArguments; - -namespace LogExpert.UI.Controls.LogWindow; - -[SupportedOSPlatform("windows")] -internal partial class PatternWindow : Form //TODO: Can this be changed to UserControl? -{ - #region Fields - - private readonly List> _blockList = []; - private PatternBlock _currentBlock; - private List _currentList; - - private readonly LogWindow _logWindow; - private PatternArgs _patternArgs = new(); - - #endregion - - #region cTor - - public PatternWindow () - { - SuspendLayout(); - - AutoScaleDimensions = new SizeF(96F, 96F); - AutoScaleMode = AutoScaleMode.Dpi; - - InitializeComponent(); - ApplyResources(); - - ResumeLayout(); - } - - public PatternWindow (LogWindow logWindow) - { - SuspendLayout(); - - AutoScaleDimensions = new SizeF(96F, 96F); - AutoScaleMode = AutoScaleMode.Dpi; - - _logWindow = logWindow; - - InitializeComponent(); - ApplyResources(); - - buttonRecalculate.Enabled = false; - - ResumeLayout(); - } - - #endregion - - #region Properties - - [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] - public int Fuzzy - { - set => fuzzyKnobControl.Value = value; - get => fuzzyKnobControl.Value; - } - - [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] - public int MaxDiff - { - set => maxDiffKnobControl.Value = value; - get => maxDiffKnobControl.Value; - } - - [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] - public int MaxMisses - { - set => maxMissesKnobControl.Value = value; - get => maxMissesKnobControl.Value; - } - - [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] - public int Weight - { - set => weigthKnobControl.Value = value; - get => weigthKnobControl.Value; - } - - #endregion - - #region Private Methods - - private void ApplyResources () - { - // Form title - Text = Resources.PatternWindow_UI_Title; - - // Labels - labelNumberOfBlocks.Text = Resources.PatternWindow_UI_Label_NumberOfBlocks; - labelBlockLines.Text = Resources.PatternWindow_UI_Label_BlockLines; - labelFeatureDescription.Text = Resources.PatternWindow_UI_Label_FeatureDescription; - labelFuzzy.Text = Resources.PatternWindow_UI_Label_Fuzzy; - labelMaxDiff.Text = Resources.PatternWindow_UI_Label_MaxDiff; - labelMaxMisses.Text = Resources.PatternWindow_UI_Label_MaxMisses; - labelWeight.Text = Resources.PatternWindow_UI_Label_Weight; - labelNoRangeSet.Text = Resources.PatternWindow_UI_Label_NoRangeSet; - - // Buttons - buttonRecalculate.Text = Resources.PatternWindow_UI_Button_Recalc; - buttonSetRange.Text = Resources.PatternWindow_UI_Button_SetRange; - } - - #endregion - - #region Public methods - - public void SetBlockList (List flatBlockList, PatternArgs patternArgs) - { - _patternArgs = patternArgs; - _blockList.Clear(); - List singeList = []; - //int blockId = -1; - - for (var i = 0; i < flatBlockList.Count; ++i) - { - var block = flatBlockList[i]; - singeList.Add(block); - //if (block.blockId != blockId) - //{ - // singeList = new List(); - // PatternBlock selfRefBlock = new PatternBlock(); - // selfRefBlock.targetStart = block.startLine; - // selfRefBlock.targetEnd = block.endLine; - // selfRefBlock.blockId = block.blockId; - // singeList.Add(selfRefBlock); - // singeList.Add(block); - // this.blockList.Add(singeList); - // blockId = block.blockId; - //} - //else - //{ - // singeList.Add(block); - //} - } - - _blockList.Add(singeList); - _ = Invoke(new MethodInvoker(SetBlockListGuiStuff)); - } - - - public void SetColumnizer (ILogLineMemoryColumnizer columnizer) - { - _logWindow.SetColumnizer(columnizer, patternHitsDataGridView); - _logWindow.SetColumnizer(columnizer, contentDataGridView); - patternHitsDataGridView.Columns[0].Width = 20; - contentDataGridView.Columns[0].Width = 20; - - DataGridViewTextBoxColumn blockInfoColumn = new() - { - HeaderText = "Weight", - AutoSizeMode = DataGridViewAutoSizeColumnMode.NotSet, - Resizable = DataGridViewTriState.False, - DividerWidth = 1, - ReadOnly = true, - Width = 50 - }; - - DataGridViewTextBoxColumn contentInfoColumn = new() - { - HeaderText = "Diff", - AutoSizeMode = DataGridViewAutoSizeColumnMode.NotSet, - Resizable = DataGridViewTriState.False, - DividerWidth = 1, - ReadOnly = true, - Width = 50 - }; - - patternHitsDataGridView.Columns.Insert(1, blockInfoColumn); - contentDataGridView.Columns.Insert(1, contentInfoColumn); - } - - public void SetFont (Font font) - { - //var lineSpacing = font.FontFamily.GetLineSpacing(FontStyle.Regular); - //var lineSpacingPixel = font.Size * lineSpacing / font.FontFamily.GetEmHeight(FontStyle.Regular); - - patternHitsDataGridView.DefaultCellStyle.Font = font; - contentDataGridView.DefaultCellStyle.Font = font; - //this.lineHeight = font.Height + 4; - patternHitsDataGridView.RowTemplate.Height = font.Height + 4; - contentDataGridView.RowTemplate.Height = font.Height + 4; - } - - #endregion - - #region Private Methods - - private void SetBlockListGuiStuff () - { - patternHitsDataGridView.RowCount = 0; - blockCountLabel.Text = Resources.LogWindow_UI_Common_ZeroValue; - contentDataGridView.RowCount = 0; - blockLinesLabel.Text = Resources.LogWindow_UI_Common_ZeroValue; - buttonRecalculate.Enabled = true; - buttonSetRange.Enabled = true; - if (_blockList.Count > 0) - { - SetCurrentList(_blockList[0]); - } - } - - private void SetCurrentList (List patternList) - { - patternHitsDataGridView.RowCount = 0; - _currentList = patternList; - patternHitsDataGridView.RowCount = _currentList.Count; - patternHitsDataGridView.Refresh(); - blockCountLabel.Text = "" + _currentList.Count; - } - - private int GetLineForHitGrid (int rowIndex) - { - int line; - line = _currentList[rowIndex].TargetStart; - return line; - } - - private int GetLineForContentGrid (int rowIndex) - { - int line; - line = _currentBlock.TargetStart + rowIndex; - return line; - } - - #endregion - - #region Events handler - - private void OnPatternHitsDataGridViewCellValueNeeded (object sender, DataGridViewCellValueEventArgs e) - { - if (_currentList == null || e.RowIndex < 0) - { - return; - } - - var rowIndex = GetLineForHitGrid(e.RowIndex); - var colIndex = e.ColumnIndex; - - if (colIndex == 1) - { - e.Value = _currentList[e.RowIndex].Weigth; - } - else - { - if (colIndex > 1) - { - colIndex--; // correct the additional inserted col - } - - e.Value = _logWindow.GetCellValue(rowIndex, colIndex); - } - } - - private void OnPatternHitsDataGridViewCellPainting (object sender, DataGridViewCellPaintingEventArgs e) - { - if (_currentList == null || e.RowIndex < 0) - { - return; - } - - if (e.ColumnIndex == 1) - { - e.PaintBackground(e.CellBounds, false); - var selCount = _patternArgs.EndLine - _patternArgs.StartLine; - var maxWeight = (_patternArgs.MaxDiffInBlock * selCount) + selCount; - - if (maxWeight > 0) - { - var width = (int)((int)e.Value / (double)maxWeight * e.CellBounds.Width); - Rectangle rect = new(e.CellBounds.X, e.CellBounds.Y, width, e.CellBounds.Height); - var alpha = 90 + (int)((int)e.Value / (double)maxWeight * 165); - - using var brush = new SolidBrush(Color.FromArgb(alpha, 170, 180, 150));//gray green - rect.Inflate(-2, -1); - e.Graphics.FillRectangle(brush, rect); - } - - e.PaintContent(e.CellBounds); - e.Handled = true; - } - else - { - var gridView = (BufferedDataGridView)sender; - var rowIndex = GetLineForHitGrid(e.RowIndex); - _logWindow.CellPainting(gridView.Focused, rowIndex, e.ColumnIndex, false, e); - } - } - - private void OnPatternHitsDataGridViewMouseDoubleClick (object sender, MouseEventArgs e) - { - //if (this.currentList == null || patternHitsDataGridView.CurrentRow == null) - // return; - //int rowIndex = GetLineForHitGrid(patternHitsDataGridView.CurrentRow.Index); - - //this.logWindow.SelectLogLine(rowIndex); - } - - private void OnPatternHitsDataGridViewCurrentCellChanged (object sender, EventArgs e) - { - if (_currentList == null || patternHitsDataGridView.CurrentRow == null) - { - return; - } - - if (patternHitsDataGridView.CurrentRow.Index > _currentList.Count - 1) - { - return; - } - - contentDataGridView.RowCount = 0; - _currentBlock = _currentList[patternHitsDataGridView.CurrentRow.Index]; - contentDataGridView.RowCount = _currentBlock.TargetEnd - _currentBlock.TargetStart + 1; - contentDataGridView.Refresh(); - contentDataGridView.CurrentCell = contentDataGridView.Rows[0].Cells[0]; - blockLinesLabel.Text = $"{contentDataGridView.RowCount}"; - } - - private void OnContentDataGridViewCellValueNeeded (object sender, DataGridViewCellValueEventArgs e) - { - if (_currentBlock == null || e.RowIndex < 0) - { - return; - } - - var rowIndex = GetLineForContentGrid(e.RowIndex); - var colIndex = e.ColumnIndex; - - if (colIndex == 1) - { - e.Value = _currentBlock.QualityInfoList.TryGetValue(rowIndex, out var qi) - ? qi.Quality - : string.Empty; - } - else - { - if (colIndex != 0) - { - colIndex--; // adjust the inserted column - } - - e.Value = _logWindow.GetCellValue(rowIndex, colIndex); - } - } - - private void OnContentDataGridViewCellPainting (object sender, DataGridViewCellPaintingEventArgs e) - { - if (_currentBlock == null || e.RowIndex < 0) - { - return; - } - - var gridView = (BufferedDataGridView)sender; - var rowIndex = GetLineForContentGrid(e.RowIndex); - _logWindow.CellPainting(gridView.Focused, rowIndex, e.ColumnIndex, false, e); - } - - private void OnContentDataGridViewCellMouseDoubleClick (object sender, DataGridViewCellMouseEventArgs e) - { - if (_currentBlock == null || contentDataGridView.CurrentRow == null) - { - return; - } - - var rowIndex = GetLineForContentGrid(contentDataGridView.CurrentRow.Index); - - _logWindow.SelectLogLine(rowIndex); - } - - private void OnRecalcButtonClick (object sender, EventArgs e) - { - _patternArgs.Fuzzy = fuzzyKnobControl.Value; - _patternArgs.MaxDiffInBlock = maxDiffKnobControl.Value; - _patternArgs.MaxMisses = maxMissesKnobControl.Value; - _patternArgs.MinWeight = weigthKnobControl.Value; - _logWindow.PatternStatistic(_patternArgs); - buttonRecalculate.Enabled = false; - buttonSetRange.Enabled = false; - } - - private void OnCloseButtonClick (object sender, EventArgs e) - { - Close(); - } - - private void OnContentDataGridViewColumnDividerDoubleClick (object sender, DataGridViewColumnDividerDoubleClickEventArgs e) - { - e.Handled = true; - contentDataGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.DisplayedCells); - } - - private void OnPatternHitsDataGridViewColumnDividerDoubleClick (object sender, DataGridViewColumnDividerDoubleClickEventArgs e) - { - e.Handled = true; - patternHitsDataGridView.AutoResizeColumns(DataGridViewAutoSizeColumnsMode.DisplayedCells); - } - - private void OnSetRangeButtonClick (object sender, EventArgs e) - { - _logWindow.PatternStatisticSelectRange(_patternArgs); - buttonRecalculate.Enabled = true; - labelNoRangeSet.Text = string.Format(CultureInfo.InvariantCulture, - Resources.PatternWindow_UI_Label_RangeFormat, - _patternArgs.StartLine, - _patternArgs.EndLine); - } - - #endregion -} \ No newline at end of file diff --git a/src/LogExpert.UI/Controls/LogWindow/PatternWindow.resx b/src/LogExpert.UI/Controls/LogWindow/PatternWindow.resx deleted file mode 100644 index e97451d5..00000000 --- a/src/LogExpert.UI/Controls/LogWindow/PatternWindow.resx +++ /dev/null @@ -1,131 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - - - AAABAAEAEBAQAAAABAAoAQAAFgAAACgAAAAQAAAAIAAAAAEABAAAAAAAgAAAAAAAAAAAAAAAEAAAABAA - AAAAAAAAAACAAACAAAAAgIAAgAAAAIAAgACAgAAAwMDAAICAgAAAAP8AAP8AAAD//wD/AAAA/wD/AP// - AAD///8AAAAAAAAAAAAP////////8A/////////wD/AAAAAAD/AP////////8A/wAAAAAA/wD/////// - //AP8ADwAAAP8A////D////wD/AA8AAP//AP///w////8A//APAAAP/wD/////////AP////////8AAA - AAAAAAAAAAAAAAAAAACAAQAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA - AAAAAAAAAAAAAIABAAD//wAA - - - \ No newline at end of file From e9e02a93e1e81471d4843149926172ec7211d1b8 Mon Sep 17 00:00:00 2001 From: "github-actions[bot]" Date: Sat, 11 Jul 2026 16:16:08 +0000 Subject: [PATCH 2/2] chore: update plugin hashes [skip ci] --- .../PluginHashGenerator.Generated.cs | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/PluginRegistry/PluginHashGenerator.Generated.cs b/src/PluginRegistry/PluginHashGenerator.Generated.cs index f39f98ad..4f5e3603 100644 --- a/src/PluginRegistry/PluginHashGenerator.Generated.cs +++ b/src/PluginRegistry/PluginHashGenerator.Generated.cs @@ -10,7 +10,7 @@ public static partial class PluginValidator { /// /// Gets pre-calculated SHA256 hashes for built-in plugins. - /// Generated: 2026-07-11 15:26:05 UTC + /// Generated: 2026-07-11 16:16:07 UTC /// Configuration: Release /// Plugin count: 21 /// @@ -18,27 +18,27 @@ public static Dictionary GetBuiltInPluginHashes() { return new Dictionary(StringComparer.OrdinalIgnoreCase) { - ["AutoColumnizer.dll"] = "1A1D4B6181F93955C71CB0591779628EDCCBCD4D46891DD2FF36828086C883C9", + ["AutoColumnizer.dll"] = "BE97EF8EA8722C979D374A02E53FA9FDBE19EA15D0FB28835B72DBEFD64D7CF8", ["BouncyCastle.Cryptography.dll"] = "E5EEAF6D263C493619982FD3638E6135077311D08C961E1FE128F9107D29EBC6", ["BouncyCastle.Cryptography.dll (x86)"] = "E5EEAF6D263C493619982FD3638E6135077311D08C961E1FE128F9107D29EBC6", - ["CsvColumnizer.dll"] = "6A2FD7BA67EE1DF94CF11D326E6E66EF341B3E4025B1EDA0ED599F4A256817E4", - ["CsvColumnizer.dll (x86)"] = "6A2FD7BA67EE1DF94CF11D326E6E66EF341B3E4025B1EDA0ED599F4A256817E4", - ["DefaultPlugins.dll"] = "8CFAC3764C109FFB1292B3DF62BABDFFDCF9025DAD09A93D9EDA60B322624237", - ["FlashIconHighlighter.dll"] = "A1F84BF9CB7A061719633CA879B65A7EB3D6A7E48C1C0B2BCEFEF2A461347941", - ["GlassfishColumnizer.dll"] = "1A70A1C2498170F21674B5891A93631AC9DDCE3D1D8CC547E3755DA91F8E897D", - ["JsonColumnizer.dll"] = "7FA4DABA1E29841B0DC254BA9047E96C70E10A086F063F6D1089E94D567CE110", - ["JsonCompactColumnizer.dll"] = "52F762DFBDA5771FEFE65E8A4A326F23D5FB33F69933E33A4FB9A236953B38B7", - ["Log4jXmlColumnizer.dll"] = "1A50FF0ED6C60D934B05058987F8A2C19300449E95AD2324B42432FF20339FB6", - ["LogExpert.Resources.dll"] = "EF96F863858116E94F7FF4C635CEE3AF2A43FCACC2EEE89E081E2CC5C739874A", + ["CsvColumnizer.dll"] = "4D5C0510D1EBF57B78D29D2EEDAFCC46F4389A1483CCEA100583D38179513AB0", + ["CsvColumnizer.dll (x86)"] = "4D5C0510D1EBF57B78D29D2EEDAFCC46F4389A1483CCEA100583D38179513AB0", + ["DefaultPlugins.dll"] = "7B1253DA6F4E5692C905D224E020107B50A3A2272840BD5919CA25BC1EBC8D52", + ["FlashIconHighlighter.dll"] = "5FF2344266318C436ED2519E8F4584CD1BC677B41BB5CC83846D14A4FC097B95", + ["GlassfishColumnizer.dll"] = "63F7EA7BC7A60B9896D6F45EC4F7676DAF4BB169F2EC6B3548075AAD61C56A13", + ["JsonColumnizer.dll"] = "C0C2E835028A2A8EF55BC81F5A8B09918918F349C23D52C09FED19FB2C93C786", + ["JsonCompactColumnizer.dll"] = "07CACA23CE4D4DA75A182F8C809CE3EC6635EDE575E054036FE3EB9751CE35D0", + ["Log4jXmlColumnizer.dll"] = "A919564C63E425155146D7DB777D2E1F59D0EFCFBBA975B58CCA6F26B05712AB", + ["LogExpert.Resources.dll"] = "95E86A298153DABA3D66889E1E30F1DF8DC5EA702C797F1DED66170C727348E3", ["Microsoft.Extensions.DependencyInjection.Abstractions.dll"] = "67FA4325000DB017DC0C35829B416F024F042D24EFB868BCF17A895EE6500A93", ["Microsoft.Extensions.DependencyInjection.Abstractions.dll (x86)"] = "67FA4325000DB017DC0C35829B416F024F042D24EFB868BCF17A895EE6500A93", ["Microsoft.Extensions.Logging.Abstractions.dll"] = "BB853130F5AFAF335BE7858D661F8212EC653835100F5A4E3AA2C66A4D4F685D", ["Microsoft.Extensions.Logging.Abstractions.dll (x86)"] = "BB853130F5AFAF335BE7858D661F8212EC653835100F5A4E3AA2C66A4D4F685D", - ["RegexColumnizer.dll"] = "C6D70682B1708E8EF4479D105CBC6F3A92E9C5A6FB7E1C5D68C4B6ECB5CDD75F", - ["SftpFileSystem.dll"] = "E2551A64D602C59F069B6600FABDA8ACB49E9D6B9697C82DE8166BAF0E3836B9", - ["SftpFileSystem.dll (x86)"] = "37F2E09661274513A2B2418BD0CFE6012C8704F74B041A118B125CCB90CC4E14", - ["SftpFileSystem.Resources.dll"] = "A8934B9231E463B7A9ED62589523FF045489721AF1A4E6F941241CA1D285FC7F", - ["SftpFileSystem.Resources.dll (x86)"] = "A8934B9231E463B7A9ED62589523FF045489721AF1A4E6F941241CA1D285FC7F", + ["RegexColumnizer.dll"] = "7C41428A3CA5D68D4CA4BDE3D6E043276467B2B46F0F9118867653B97630F506", + ["SftpFileSystem.dll"] = "9A8BCA76877E0CD86C8FBFC2D4B40478FAB5097E3E9554A110AB0BACBB485896", + ["SftpFileSystem.dll (x86)"] = "57CACE749999F7412B5ACC608A4844EB3C3077668E8827CDF651D939BAF26810", + ["SftpFileSystem.Resources.dll"] = "47C83AB62174AD5F747A2DB43040B099AE8CE64E790C2806AECBA05CED61B9A8", + ["SftpFileSystem.Resources.dll (x86)"] = "47C83AB62174AD5F747A2DB43040B099AE8CE64E790C2806AECBA05CED61B9A8", }; }