Skip to content

Issue31 missing again #336

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Mar 11, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/LogExpert/Classes/Columnizer/ColumnizerPicker.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public static ILogLineColumnizer CloneColumnizer(ILogLineColumnizer columnizer)
object o = cti.Invoke(new object[] { });
if (o is IColumnizerConfigurator configurator)
{
configurator.LoadConfig(ConfigManager.Settings.preferences.PortableMode ? ConfigManager.PortableModeDir : ConfigManager.ConfigDir);
configurator.LoadConfig(ConfigManager.Settings.Preferences.PortableMode ? ConfigManager.PortableModeDir : ConfigManager.ConfigDir);
}
return (ILogLineColumnizer)o;
}
Expand Down
2 changes: 1 addition & 1 deletion src/LogExpert/Classes/Log/LogFileInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public bool FileExists

public int PollInterval
{
get { return ConfigManager.Settings.preferences.pollingInterval; }
get { return ConfigManager.Settings.Preferences.pollingInterval; }
}

public long LengthWithoutRetry
Expand Down
2 changes: 1 addition & 1 deletion src/LogExpert/Classes/Log/PositionAwareStreamReaderBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public sealed override long Position

public sealed override bool IsBufferComplete => true;

protected static int MaxLineLen => MAX_LINE_LEN;
protected static int MaxLineLen => ConfigManager.Settings.Preferences.MaxLineLength;

#endregion

Expand Down
2 changes: 1 addition & 1 deletion src/LogExpert/Classes/PaintHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ internal class PaintHelper

#region Properties

private static Preferences Preferences => ConfigManager.Settings.preferences;
private static Preferences Preferences => ConfigManager.Settings.Preferences;

#endregion

Expand Down
2 changes: 2 additions & 0 deletions src/LogExpert/Classes/PluginRegistry.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
using LogExpert.Config;
using LogExpert.Entities;
using LogExpert.Extensions;

using NLog;

using System;
using System.Collections.Generic;
using System.IO;
Expand Down
2 changes: 1 addition & 1 deletion src/LogExpert/Config/ColorMode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public static class ColorMode

public static void LoadColorMode()
{
var preferences = ConfigManager.Settings.preferences;
var preferences = ConfigManager.Settings.Preferences;

if (preferences.darkMode)
{
Expand Down
56 changes: 28 additions & 28 deletions src/LogExpert/Config/ConfigManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -166,36 +166,36 @@ private Settings LoadOrCreateNew(FileSystemInfo fileInfo)
}
}

settings.preferences ??= new Preferences();
settings.Preferences ??= new Preferences();

settings.preferences.toolEntries ??= [];
settings.Preferences.toolEntries ??= [];

settings.preferences.columnizerMaskList ??= [];
settings.Preferences.columnizerMaskList ??= [];

settings.fileHistoryList ??= [];

settings.lastOpenFilesList ??= [];

settings.fileColors ??= [];

if (settings.preferences.showTailColor == Color.Empty)
if (settings.Preferences.showTailColor == Color.Empty)
{
settings.preferences.showTailColor = Color.FromKnownColor(KnownColor.Blue);
settings.Preferences.showTailColor = Color.FromKnownColor(KnownColor.Blue);
}

if (settings.preferences.timeSpreadColor == Color.Empty)
if (settings.Preferences.timeSpreadColor == Color.Empty)
{
settings.preferences.timeSpreadColor = Color.Gray;
settings.Preferences.timeSpreadColor = Color.Gray;
}

if (settings.preferences.bufferCount < 10)
if (settings.Preferences.bufferCount < 10)
{
settings.preferences.bufferCount = 100;
settings.Preferences.bufferCount = 100;
}

if (settings.preferences.linesPerBuffer < 1)
if (settings.Preferences.linesPerBuffer < 1)
{
settings.preferences.linesPerBuffer = 500;
settings.Preferences.linesPerBuffer = 500;
}

settings.filterList ??= [];
Expand Down Expand Up @@ -224,25 +224,25 @@ private Settings LoadOrCreateNew(FileSystemInfo fileInfo)
settings.hilightGroupList.Add(defaultGroup);
}

settings.preferences.highlightMaskList ??= [];
settings.Preferences.highlightMaskList ??= [];

if (settings.preferences.pollingInterval < 20)
if (settings.Preferences.pollingInterval < 20)
{
settings.preferences.pollingInterval = 250;
settings.Preferences.pollingInterval = 250;
}

settings.preferences.multiFileOptions ??= new MultiFileOptions();
settings.Preferences.multiFileOptions ??= new MultiFileOptions();

settings.preferences.defaultEncoding ??= Encoding.Default.HeaderName;
settings.Preferences.defaultEncoding ??= Encoding.Default.HeaderName;

if (settings.preferences.maximumFilterEntriesDisplayed == 0)
if (settings.Preferences.maximumFilterEntriesDisplayed == 0)
{
settings.preferences.maximumFilterEntriesDisplayed = 20;
settings.Preferences.maximumFilterEntriesDisplayed = 20;
}

if (settings.preferences.maximumFilterEntries == 0)
if (settings.Preferences.maximumFilterEntries == 0)
{
settings.preferences.maximumFilterEntries = 30;
settings.Preferences.maximumFilterEntries = 30;
}

SetBoundsWithinVirtualScreen(settings);
Expand All @@ -265,7 +265,7 @@ private void Save(Settings settings, SettingsFlags flags)
_logger.Info("Saving settings");
lock (this)
{
string dir = Settings.preferences.PortableMode ? Application.StartupPath : ConfigDir;
string dir = Settings.Preferences.PortableMode ? Application.StartupPath : ConfigDir;

if (!Directory.Exists(dir))
{
Expand Down Expand Up @@ -367,11 +367,11 @@ private Settings Import(Settings currentSettings, FileInfo fileInfo, ExportImpor
if ((flags & ExportImportFlags.Other) == ExportImportFlags.Other)
{
newSettings = ownSettings;
newSettings.preferences = ObjectClone.Clone(importSettings.preferences);
newSettings.preferences.columnizerMaskList = ownSettings.preferences.columnizerMaskList;
newSettings.preferences.highlightMaskList = ownSettings.preferences.highlightMaskList;
newSettings.Preferences = ObjectClone.Clone(importSettings.Preferences);
newSettings.Preferences.columnizerMaskList = ownSettings.Preferences.columnizerMaskList;
newSettings.Preferences.highlightMaskList = ownSettings.Preferences.highlightMaskList;
newSettings.hilightGroupList = ownSettings.hilightGroupList;
newSettings.preferences.toolEntries = ownSettings.preferences.toolEntries;
newSettings.Preferences.toolEntries = ownSettings.Preferences.toolEntries;
}
else
{
Expand All @@ -380,19 +380,19 @@ private Settings Import(Settings currentSettings, FileInfo fileInfo, ExportImpor

if ((flags & ExportImportFlags.ColumnizerMasks) == ExportImportFlags.ColumnizerMasks)
{
newSettings.preferences.columnizerMaskList = ReplaceOrKeepExisting(flags, ownSettings.preferences.columnizerMaskList, importSettings.preferences.columnizerMaskList);
newSettings.Preferences.columnizerMaskList = ReplaceOrKeepExisting(flags, ownSettings.Preferences.columnizerMaskList, importSettings.Preferences.columnizerMaskList);
}
if ((flags & ExportImportFlags.HighlightMasks) == ExportImportFlags.HighlightMasks)
{
newSettings.preferences.highlightMaskList = ReplaceOrKeepExisting(flags, ownSettings.preferences.highlightMaskList, importSettings.preferences.highlightMaskList);
newSettings.Preferences.highlightMaskList = ReplaceOrKeepExisting(flags, ownSettings.Preferences.highlightMaskList, importSettings.Preferences.highlightMaskList);
}
if ((flags & ExportImportFlags.HighlightSettings) == ExportImportFlags.HighlightSettings)
{
newSettings.hilightGroupList = ReplaceOrKeepExisting(flags, ownSettings.hilightGroupList, importSettings.hilightGroupList);
}
if ((flags & ExportImportFlags.ToolEntries) == ExportImportFlags.ToolEntries)
{
newSettings.preferences.toolEntries = ReplaceOrKeepExisting(flags, ownSettings.preferences.toolEntries, importSettings.preferences.toolEntries);
newSettings.Preferences.toolEntries = ReplaceOrKeepExisting(flags, ownSettings.Preferences.toolEntries, importSettings.Preferences.toolEntries);
}

return newSettings;
Expand Down
2 changes: 1 addition & 1 deletion src/LogExpert/Config/Settings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public class Settings

public List<string> lastOpenFilesList = [];

public Preferences preferences = new();
public Preferences Preferences { get; set; } = new();

public RegexHistory regexHistory = new();

Expand Down
2 changes: 1 addition & 1 deletion src/LogExpert/Controls/LogTabWindow/LogTabWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ public LogWindow.LogWindow CurrentLogWindow

public SearchParams SearchParams { get; private set; } = new SearchParams();

public Preferences Preferences => ConfigManager.Settings.preferences;
public Preferences Preferences => ConfigManager.Settings.Preferences;

public List<HilightGroup> HilightGroupList { get; private set; } = [];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ private void OnLogTabWindowLoad(object sender, EventArgs e)
}
}

if (ConfigManager.Settings.preferences.openLastFiles && _startupFileNames == null)
if (ConfigManager.Settings.Preferences.openLastFiles && _startupFileNames == null)
{
List<string> tmpList = ObjectClone.Clone(ConfigManager.Settings.lastOpenFilesList);

Expand Down Expand Up @@ -81,7 +81,7 @@ private void OnLogTabWindowClosing(object sender, CancelEventArgs e)
_ledThread.Join();

IList<LogWindow.LogWindow> deleteLogWindowList = new List<LogWindow.LogWindow>();
ConfigManager.Settings.alwaysOnTop = TopMost && ConfigManager.Settings.preferences.allowOnlyOneInstance;
ConfigManager.Settings.alwaysOnTop = TopMost && ConfigManager.Settings.Preferences.allowOnlyOneInstance;
SaveLastOpenFilesList();

foreach (LogWindow.LogWindow logWindow in _logWindowList)
Expand Down Expand Up @@ -952,7 +952,7 @@ private void OnLockInstanceToolStripMenuItemClick(object sender, EventArgs e)

private void OnOptionToolStripMenuItemDropDownOpening(object sender, EventArgs e)
{
lockInstanceToolStripMenuItem.Enabled = !ConfigManager.Settings.preferences.allowOnlyOneInstance;
lockInstanceToolStripMenuItem.Enabled = !ConfigManager.Settings.Preferences.allowOnlyOneInstance;
lockInstanceToolStripMenuItem.Checked = StaticData.CurrentLockedMainWindow == this;
}

Expand Down
24 changes: 12 additions & 12 deletions src/LogExpert/Controls/LogTabWindow/LogTabWindowPrivate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ private void InitBookmarkWindow()
_bookmarkWindow = new BookmarkWindow();
_bookmarkWindow.HideOnClose = true;
_bookmarkWindow.ShowHint = DockState.DockBottom;
_bookmarkWindow.PreferencesChanged(ConfigManager.Settings.preferences, false, SettingsFlags.All);
_bookmarkWindow.PreferencesChanged(ConfigManager.Settings.Preferences, false, SettingsFlags.All);
_bookmarkWindow.VisibleChanged += OnBookmarkWindowVisibleChanged;
_firstBookmarkWindowShow = true;
}
Expand Down Expand Up @@ -120,15 +120,15 @@ private void SetTooltipText(LogWindow.LogWindow logWindow, string logFileName)

private void FillDefaultEncodingFromSettings(EncodingOptions encodingOptions)
{
if (ConfigManager.Settings.preferences.defaultEncoding != null)
if (ConfigManager.Settings.Preferences.defaultEncoding != null)
{
try
{
encodingOptions.DefaultEncoding = Encoding.GetEncoding(ConfigManager.Settings.preferences.defaultEncoding);
encodingOptions.DefaultEncoding = Encoding.GetEncoding(ConfigManager.Settings.Preferences.defaultEncoding);
}
catch (ArgumentException)
{
_logger.Warn("Encoding " + ConfigManager.Settings.preferences.defaultEncoding + " is not a valid encoding");
_logger.Warn("Encoding " + ConfigManager.Settings.Preferences.defaultEncoding + " is not a valid encoding");
encodingOptions.DefaultEncoding = null;
}
}
Expand Down Expand Up @@ -426,7 +426,7 @@ private void LoadFiles(string[] names, bool invertLogic)
return;
}

MultiFileOption option = ConfigManager.Settings.preferences.multiFileOption;
MultiFileOption option = ConfigManager.Settings.Preferences.multiFileOption;
if (option == MultiFileOption.Ask)
{
MultiLoadRequestDialog dlg = new();
Expand Down Expand Up @@ -622,7 +622,7 @@ private void GuiStateUpdateWorker(GuiStateArgs e)
cellSelectModeToolStripMenuItem.Checked = e.CellSelectMode;
RefreshEncodingMenuBar(e.CurrentEncoding);

if (e.TimeshiftPossible && ConfigManager.Settings.preferences.timestampControl)
if (e.TimeshiftPossible && ConfigManager.Settings.Preferences.timestampControl)
{
dragControlDateTime.MinDateTime = e.MinTimestamp;
dragControlDateTime.MaxDateTime = e.MaxTimestamp;
Expand Down Expand Up @@ -922,12 +922,12 @@ private void RefreshEncodingMenuBar(Encoding encoding)

private void OpenSettings(int tabToOpen)
{
SettingsDialog dlg = new(ConfigManager.Settings.preferences, this, tabToOpen);
SettingsDialog dlg = new(ConfigManager.Settings.Preferences, this, tabToOpen);
dlg.TopMost = TopMost;

if (DialogResult.OK == dlg.ShowDialog())
{
ConfigManager.Settings.preferences = dlg.Preferences;
ConfigManager.Settings.Preferences = dlg.Preferences;
ConfigManager.Save(SettingsFlags.Settings);
NotifyWindowsForChangedPrefs(SettingsFlags.Settings);
}
Expand All @@ -942,11 +942,11 @@ private void NotifyWindowsForChangedPrefs(SettingsFlags flags)
{
foreach (LogWindow.LogWindow logWindow in _logWindowList)
{
logWindow.PreferencesChanged(ConfigManager.Settings.preferences, false, flags);
logWindow.PreferencesChanged(ConfigManager.Settings.Preferences, false, flags);
}
}

_bookmarkWindow.PreferencesChanged(ConfigManager.Settings.preferences, false, flags);
_bookmarkWindow.PreferencesChanged(ConfigManager.Settings.Preferences, false, flags);

HilightGroupList = ConfigManager.Settings.hilightGroupList;
if ((flags & SettingsFlags.HighlightSettings) == SettingsFlags.HighlightSettings)
Expand All @@ -960,7 +960,7 @@ private void ApplySettings(Settings settings, SettingsFlags flags)
if ((flags & SettingsFlags.WindowPosition) == SettingsFlags.WindowPosition)
{
TopMost = alwaysOnTopToolStripMenuItem.Checked = settings.alwaysOnTop;
dragControlDateTime.DragOrientation = settings.preferences.timestampControlDragOrientation;
dragControlDateTime.DragOrientation = settings.Preferences.timestampControlDragOrientation;
hideLineColumnToolStripMenuItem.Checked = settings.hideLineColumn;
}

Expand All @@ -971,7 +971,7 @@ private void ApplySettings(Settings settings, SettingsFlags flags)

if ((flags & SettingsFlags.GuiOrColors) == SettingsFlags.GuiOrColors)
{
SetTabIcons(settings.preferences);
SetTabIcons(settings.Preferences);
}

if ((flags & SettingsFlags.ToolSettings) == SettingsFlags.ToolSettings)
Expand Down
4 changes: 2 additions & 2 deletions src/LogExpert/Controls/LogTabWindow/LogTabWindowPublic.cs
Original file line number Diff line number Diff line change
Expand Up @@ -233,7 +233,7 @@ public void ScrollAllTabsToTimestamp(DateTime timestamp, LogWindow.LogWindow sen

public ILogLineColumnizer FindColumnizerByFileMask(string fileName)
{
foreach (ColumnizerMaskEntry entry in ConfigManager.Settings.preferences.columnizerMaskList)
foreach (ColumnizerMaskEntry entry in ConfigManager.Settings.Preferences.columnizerMaskList)
{
if (entry.mask != null)
{
Expand All @@ -258,7 +258,7 @@ public ILogLineColumnizer FindColumnizerByFileMask(string fileName)

public HilightGroup FindHighlightGroupByFileMask(string fileName)
{
foreach (HighlightMaskEntry entry in ConfigManager.Settings.preferences.highlightMaskList)
foreach (HighlightMaskEntry entry in ConfigManager.Settings.Preferences.highlightMaskList)
{
if (entry.mask != null)
{
Expand Down
4 changes: 2 additions & 2 deletions src/LogExpert/Controls/LogWindow/LogWindow.cs
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ public LogWindow(LogTabWindow.LogTabWindow parent, string fileName, bool isTempF
filterComboBox.Items.Add(item);
}

filterComboBox.DropDownHeight = filterComboBox.ItemHeight * ConfigManager.Settings.preferences.maximumFilterEntriesDisplayed;
filterComboBox.DropDownHeight = filterComboBox.ItemHeight * ConfigManager.Settings.Preferences.maximumFilterEntriesDisplayed;
AutoResizeFilterBox();

filterRegexCheckBox.Checked = _filterParams.isRegex;
Expand Down Expand Up @@ -494,7 +494,7 @@ public string Title

public string ForcedPersistenceFileName { get; set; } = null;

public Preferences Preferences => ConfigManager.Settings.preferences;
public Preferences Preferences => ConfigManager.Settings.Preferences;

public string GivenFileName { get; set; } = null;

Expand Down
4 changes: 2 additions & 2 deletions src/LogExpert/Controls/LogWindow/LogWindowPrivate.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1967,7 +1967,7 @@ private async void FilterSearch(string text)
_filterParams.lowerSearchText = text.ToLower();
ConfigManager.Settings.filterHistoryList.Remove(text);
ConfigManager.Settings.filterHistoryList.Insert(0, text);
int maxHistory = ConfigManager.Settings.preferences.maximumFilterEntries;
int maxHistory = ConfigManager.Settings.Preferences.maximumFilterEntries;

if (ConfigManager.Settings.filterHistoryList.Count > maxHistory)
{
Expand Down Expand Up @@ -2042,7 +2042,7 @@ private async void FilterSearch(string text)
Settings settings = ConfigManager.Settings;

//FilterFx fx = settings.preferences.multiThreadFilter ? MultiThreadedFilter : new FilterFx(Filter);
FilterFxAction = settings.preferences.multiThreadFilter ? MultiThreadedFilter : Filter;
FilterFxAction = settings.Preferences.multiThreadFilter ? MultiThreadedFilter : Filter;

//Task.Run(() => fx.Invoke(_filterParams, _filterResultList, _lastFilterLinesList, _filterHitList));
Task filterFxActionTask = Task.Run(() => Filter(_filterParams, _filterResultList, _lastFilterLinesList, _filterHitList));
Expand Down
2 changes: 1 addition & 1 deletion src/LogExpert/Dialogs/FilterSelectorForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ private void OnConfigButtonClick(object sender, EventArgs e)
{
string configDir = ConfigManager.ConfigDir;

if (ConfigManager.Settings.preferences.PortableMode)
if (ConfigManager.Settings.Preferences.PortableMode)
{
configDir = ConfigManager.PortableModeDir;
}
Expand Down
Loading