From 86d2d83fbe121d14962984b4d5108313ffd93262 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Mon, 25 Sep 2023 15:27:25 -0400 Subject: [PATCH] Remove EnableLogFormatting --- CHANGELIST.md | 1 + MPF.Core/Data/Options.cs | 13 -------- MPF/ViewModels/LogViewModel.cs | 55 ++-------------------------------- MPF/Windows/OptionsWindow.xaml | 5 ---- 4 files changed, 3 insertions(+), 71 deletions(-) diff --git a/CHANGELIST.md b/CHANGELIST.md index db04b856..8a1731b7 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -19,6 +19,7 @@ - Move Constants - Move WPFCustomMessageBox - Remove EnableProgressProcessing +- Remove EnableLogFormatting ### 2.6.3 (2023-08-15) diff --git a/MPF.Core/Data/Options.cs b/MPF.Core/Data/Options.cs index 82519040..302e317c 100644 --- a/MPF.Core/Data/Options.cs +++ b/MPF.Core/Data/Options.cs @@ -520,19 +520,6 @@ namespace MPF.Core.Data set { _settings["OpenLogWindowAtStartup"] = value.ToString(); } } - /// - /// Enable fancy formatting of log statements - /// - /// - /// This is mainly for outputting redirected console outputs. Not many - /// other bits of the logs include any specially handled outputs. - /// - public bool EnableLogFormatting - { - get { return GetBooleanSetting(_settings, "EnableLogFormatting", false); } - set { _settings["EnableLogFormatting"] = value.ToString(); } - } - #endregion #region Redump Login Information diff --git a/MPF/ViewModels/LogViewModel.cs b/MPF/ViewModels/LogViewModel.cs index 66aa5f81..5fda5346 100644 --- a/MPF/ViewModels/LogViewModel.cs +++ b/MPF/ViewModels/LogViewModel.cs @@ -405,61 +405,10 @@ namespace MPF.UI.ViewModels try { - // If we're not processing log formatting, just append and continue - if (!App.Options.EnableLogFormatting) - { - if (nextText.StartsWith("\r")) - ReplaceLastLine(nextLogLine); - else - AppendToTextBox(nextLogLine); - - return; - } - - // Get last line - lastLine = lastLine ?? GetLastLine(); - - // Always append if there's no previous line - if (lastLine == null) - { - AppendToTextBox(nextLogLine); - lastUsedMatcher = _matchers.FirstOrDefault(m => m?.Matches(nextText) == true); - } - // Return always means overwrite - else if (nextText.StartsWith("\r")) - { + if (nextText.StartsWith("\r")) ReplaceLastLine(nextLogLine); - lastUsedMatcher = _matchers.FirstOrDefault(m => m?.Matches(nextText.TrimStart('\r')) == true); - } - // If we have a cached matcher and we match - else if (lastUsedMatcher?.Matches(nextText) == true) - { - ReplaceLastLine(nextLogLine); - } else - { - // Get the first matching Matcher - var firstMatcher = _matchers.FirstOrDefault(m => m?.Matches(nextText) == true); - if (firstMatcher.HasValue) - { - string lastText = Parent.Dispatcher.Invoke(() => { return lastLine.Text; }); - if (firstMatcher.Value.Matches(lastText)) - ReplaceLastLine(nextLogLine); - else if (string.IsNullOrWhiteSpace(lastText)) - ReplaceLastLine(nextLogLine); - else - AppendToTextBox(nextLogLine); - - // Cache the last used Matcher - lastUsedMatcher = firstMatcher; - } - // Default case for all other text - else - { - AppendToTextBox(nextLogLine); - lastUsedMatcher = null; - } - } + AppendToTextBox(nextLogLine); } catch (Exception ex) { diff --git a/MPF/Windows/OptionsWindow.xaml b/MPF/Windows/OptionsWindow.xaml index 6f103d46..05443941 100644 --- a/MPF/Windows/OptionsWindow.xaml +++ b/MPF/Windows/OptionsWindow.xaml @@ -396,11 +396,6 @@ IsChecked="{Binding Options.OpenLogWindowAtStartup}" ToolTip="Open the log panel when the program launches" Margin="0,4" /> - -