Skip to content

Commit e5fe811

Browse files
authored
Merge pull request #336 from Hirogen/issue31
Issue31 missing again
2 parents 8864052 + 479a7ba commit e5fe811

17 files changed

+63
-61
lines changed

src/LogExpert/Classes/Columnizer/ColumnizerPicker.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static ILogLineColumnizer CloneColumnizer(ILogLineColumnizer columnizer)
4848
object o = cti.Invoke(new object[] { });
4949
if (o is IColumnizerConfigurator configurator)
5050
{
51-
configurator.LoadConfig(ConfigManager.Settings.preferences.PortableMode ? ConfigManager.PortableModeDir : ConfigManager.ConfigDir);
51+
configurator.LoadConfig(ConfigManager.Settings.Preferences.PortableMode ? ConfigManager.PortableModeDir : ConfigManager.ConfigDir);
5252
}
5353
return (ILogLineColumnizer)o;
5454
}

src/LogExpert/Classes/Log/LogFileInfo.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ public bool FileExists
102102

103103
public int PollInterval
104104
{
105-
get { return ConfigManager.Settings.preferences.pollingInterval; }
105+
get { return ConfigManager.Settings.Preferences.pollingInterval; }
106106
}
107107

108108
public long LengthWithoutRetry

src/LogExpert/Classes/Log/PositionAwareStreamReaderBase.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ public sealed override long Position
7272

7373
public sealed override bool IsBufferComplete => true;
7474

75-
protected static int MaxLineLen => MAX_LINE_LEN;
75+
protected static int MaxLineLen => ConfigManager.Settings.Preferences.MaxLineLength;
7676

7777
#endregion
7878

src/LogExpert/Classes/PaintHelper.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ internal class PaintHelper
2626

2727
#region Properties
2828

29-
private static Preferences Preferences => ConfigManager.Settings.preferences;
29+
private static Preferences Preferences => ConfigManager.Settings.Preferences;
3030

3131
#endregion
3232

src/LogExpert/Classes/PluginRegistry.cs

+2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,9 @@
22
using LogExpert.Config;
33
using LogExpert.Entities;
44
using LogExpert.Extensions;
5+
56
using NLog;
7+
68
using System;
79
using System.Collections.Generic;
810
using System.IO;

src/LogExpert/Config/ColorMode.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public static class ColorMode
3939

4040
public static void LoadColorMode()
4141
{
42-
var preferences = ConfigManager.Settings.preferences;
42+
var preferences = ConfigManager.Settings.Preferences;
4343

4444
if (preferences.darkMode)
4545
{

src/LogExpert/Config/ConfigManager.cs

+28-28
Original file line numberDiff line numberDiff line change
@@ -166,36 +166,36 @@ private Settings LoadOrCreateNew(FileSystemInfo fileInfo)
166166
}
167167
}
168168

169-
settings.preferences ??= new Preferences();
169+
settings.Preferences ??= new Preferences();
170170

171-
settings.preferences.toolEntries ??= [];
171+
settings.Preferences.toolEntries ??= [];
172172

173-
settings.preferences.columnizerMaskList ??= [];
173+
settings.Preferences.columnizerMaskList ??= [];
174174

175175
settings.fileHistoryList ??= [];
176176

177177
settings.lastOpenFilesList ??= [];
178178

179179
settings.fileColors ??= [];
180180

181-
if (settings.preferences.showTailColor == Color.Empty)
181+
if (settings.Preferences.showTailColor == Color.Empty)
182182
{
183-
settings.preferences.showTailColor = Color.FromKnownColor(KnownColor.Blue);
183+
settings.Preferences.showTailColor = Color.FromKnownColor(KnownColor.Blue);
184184
}
185185

186-
if (settings.preferences.timeSpreadColor == Color.Empty)
186+
if (settings.Preferences.timeSpreadColor == Color.Empty)
187187
{
188-
settings.preferences.timeSpreadColor = Color.Gray;
188+
settings.Preferences.timeSpreadColor = Color.Gray;
189189
}
190190

191-
if (settings.preferences.bufferCount < 10)
191+
if (settings.Preferences.bufferCount < 10)
192192
{
193-
settings.preferences.bufferCount = 100;
193+
settings.Preferences.bufferCount = 100;
194194
}
195195

196-
if (settings.preferences.linesPerBuffer < 1)
196+
if (settings.Preferences.linesPerBuffer < 1)
197197
{
198-
settings.preferences.linesPerBuffer = 500;
198+
settings.Preferences.linesPerBuffer = 500;
199199
}
200200

201201
settings.filterList ??= [];
@@ -224,25 +224,25 @@ private Settings LoadOrCreateNew(FileSystemInfo fileInfo)
224224
settings.hilightGroupList.Add(defaultGroup);
225225
}
226226

227-
settings.preferences.highlightMaskList ??= [];
227+
settings.Preferences.highlightMaskList ??= [];
228228

229-
if (settings.preferences.pollingInterval < 20)
229+
if (settings.Preferences.pollingInterval < 20)
230230
{
231-
settings.preferences.pollingInterval = 250;
231+
settings.Preferences.pollingInterval = 250;
232232
}
233233

234-
settings.preferences.multiFileOptions ??= new MultiFileOptions();
234+
settings.Preferences.multiFileOptions ??= new MultiFileOptions();
235235

236-
settings.preferences.defaultEncoding ??= Encoding.Default.HeaderName;
236+
settings.Preferences.defaultEncoding ??= Encoding.Default.HeaderName;
237237

238-
if (settings.preferences.maximumFilterEntriesDisplayed == 0)
238+
if (settings.Preferences.maximumFilterEntriesDisplayed == 0)
239239
{
240-
settings.preferences.maximumFilterEntriesDisplayed = 20;
240+
settings.Preferences.maximumFilterEntriesDisplayed = 20;
241241
}
242242

243-
if (settings.preferences.maximumFilterEntries == 0)
243+
if (settings.Preferences.maximumFilterEntries == 0)
244244
{
245-
settings.preferences.maximumFilterEntries = 30;
245+
settings.Preferences.maximumFilterEntries = 30;
246246
}
247247

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

270270
if (!Directory.Exists(dir))
271271
{
@@ -367,11 +367,11 @@ private Settings Import(Settings currentSettings, FileInfo fileInfo, ExportImpor
367367
if ((flags & ExportImportFlags.Other) == ExportImportFlags.Other)
368368
{
369369
newSettings = ownSettings;
370-
newSettings.preferences = ObjectClone.Clone(importSettings.preferences);
371-
newSettings.preferences.columnizerMaskList = ownSettings.preferences.columnizerMaskList;
372-
newSettings.preferences.highlightMaskList = ownSettings.preferences.highlightMaskList;
370+
newSettings.Preferences = ObjectClone.Clone(importSettings.Preferences);
371+
newSettings.Preferences.columnizerMaskList = ownSettings.Preferences.columnizerMaskList;
372+
newSettings.Preferences.highlightMaskList = ownSettings.Preferences.highlightMaskList;
373373
newSettings.hilightGroupList = ownSettings.hilightGroupList;
374-
newSettings.preferences.toolEntries = ownSettings.preferences.toolEntries;
374+
newSettings.Preferences.toolEntries = ownSettings.Preferences.toolEntries;
375375
}
376376
else
377377
{
@@ -380,19 +380,19 @@ private Settings Import(Settings currentSettings, FileInfo fileInfo, ExportImpor
380380

381381
if ((flags & ExportImportFlags.ColumnizerMasks) == ExportImportFlags.ColumnizerMasks)
382382
{
383-
newSettings.preferences.columnizerMaskList = ReplaceOrKeepExisting(flags, ownSettings.preferences.columnizerMaskList, importSettings.preferences.columnizerMaskList);
383+
newSettings.Preferences.columnizerMaskList = ReplaceOrKeepExisting(flags, ownSettings.Preferences.columnizerMaskList, importSettings.Preferences.columnizerMaskList);
384384
}
385385
if ((flags & ExportImportFlags.HighlightMasks) == ExportImportFlags.HighlightMasks)
386386
{
387-
newSettings.preferences.highlightMaskList = ReplaceOrKeepExisting(flags, ownSettings.preferences.highlightMaskList, importSettings.preferences.highlightMaskList);
387+
newSettings.Preferences.highlightMaskList = ReplaceOrKeepExisting(flags, ownSettings.Preferences.highlightMaskList, importSettings.Preferences.highlightMaskList);
388388
}
389389
if ((flags & ExportImportFlags.HighlightSettings) == ExportImportFlags.HighlightSettings)
390390
{
391391
newSettings.hilightGroupList = ReplaceOrKeepExisting(flags, ownSettings.hilightGroupList, importSettings.hilightGroupList);
392392
}
393393
if ((flags & ExportImportFlags.ToolEntries) == ExportImportFlags.ToolEntries)
394394
{
395-
newSettings.preferences.toolEntries = ReplaceOrKeepExisting(flags, ownSettings.preferences.toolEntries, importSettings.preferences.toolEntries);
395+
newSettings.Preferences.toolEntries = ReplaceOrKeepExisting(flags, ownSettings.Preferences.toolEntries, importSettings.Preferences.toolEntries);
396396
}
397397

398398
return newSettings;

src/LogExpert/Config/Settings.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public class Settings
4545

4646
public List<string> lastOpenFilesList = [];
4747

48-
public Preferences preferences = new();
48+
public Preferences Preferences { get; set; } = new();
4949

5050
public RegexHistory regexHistory = new();
5151

src/LogExpert/Controls/LogTabWindow/LogTabWindow.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ public LogWindow.LogWindow CurrentLogWindow
297297

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

300-
public Preferences Preferences => ConfigManager.Settings.preferences;
300+
public Preferences Preferences => ConfigManager.Settings.Preferences;
301301

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

src/LogExpert/Controls/LogTabWindow/LogTabWindowEventHandlers.cs

+3-3
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ private void OnLogTabWindowLoad(object sender, EventArgs e)
4444
}
4545
}
4646

47-
if (ConfigManager.Settings.preferences.openLastFiles && _startupFileNames == null)
47+
if (ConfigManager.Settings.Preferences.openLastFiles && _startupFileNames == null)
4848
{
4949
List<string> tmpList = ObjectClone.Clone(ConfigManager.Settings.lastOpenFilesList);
5050

@@ -81,7 +81,7 @@ private void OnLogTabWindowClosing(object sender, CancelEventArgs e)
8181
_ledThread.Join();
8282

8383
IList<LogWindow.LogWindow> deleteLogWindowList = new List<LogWindow.LogWindow>();
84-
ConfigManager.Settings.alwaysOnTop = TopMost && ConfigManager.Settings.preferences.allowOnlyOneInstance;
84+
ConfigManager.Settings.alwaysOnTop = TopMost && ConfigManager.Settings.Preferences.allowOnlyOneInstance;
8585
SaveLastOpenFilesList();
8686

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

953953
private void OnOptionToolStripMenuItemDropDownOpening(object sender, EventArgs e)
954954
{
955-
lockInstanceToolStripMenuItem.Enabled = !ConfigManager.Settings.preferences.allowOnlyOneInstance;
955+
lockInstanceToolStripMenuItem.Enabled = !ConfigManager.Settings.Preferences.allowOnlyOneInstance;
956956
lockInstanceToolStripMenuItem.Checked = StaticData.CurrentLockedMainWindow == this;
957957
}
958958

src/LogExpert/Controls/LogTabWindow/LogTabWindowPrivate.cs

+12-12
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ private void InitBookmarkWindow()
6868
_bookmarkWindow = new BookmarkWindow();
6969
_bookmarkWindow.HideOnClose = true;
7070
_bookmarkWindow.ShowHint = DockState.DockBottom;
71-
_bookmarkWindow.PreferencesChanged(ConfigManager.Settings.preferences, false, SettingsFlags.All);
71+
_bookmarkWindow.PreferencesChanged(ConfigManager.Settings.Preferences, false, SettingsFlags.All);
7272
_bookmarkWindow.VisibleChanged += OnBookmarkWindowVisibleChanged;
7373
_firstBookmarkWindowShow = true;
7474
}
@@ -120,15 +120,15 @@ private void SetTooltipText(LogWindow.LogWindow logWindow, string logFileName)
120120

121121
private void FillDefaultEncodingFromSettings(EncodingOptions encodingOptions)
122122
{
123-
if (ConfigManager.Settings.preferences.defaultEncoding != null)
123+
if (ConfigManager.Settings.Preferences.defaultEncoding != null)
124124
{
125125
try
126126
{
127-
encodingOptions.DefaultEncoding = Encoding.GetEncoding(ConfigManager.Settings.preferences.defaultEncoding);
127+
encodingOptions.DefaultEncoding = Encoding.GetEncoding(ConfigManager.Settings.Preferences.defaultEncoding);
128128
}
129129
catch (ArgumentException)
130130
{
131-
_logger.Warn("Encoding " + ConfigManager.Settings.preferences.defaultEncoding + " is not a valid encoding");
131+
_logger.Warn("Encoding " + ConfigManager.Settings.Preferences.defaultEncoding + " is not a valid encoding");
132132
encodingOptions.DefaultEncoding = null;
133133
}
134134
}
@@ -426,7 +426,7 @@ private void LoadFiles(string[] names, bool invertLogic)
426426
return;
427427
}
428428

429-
MultiFileOption option = ConfigManager.Settings.preferences.multiFileOption;
429+
MultiFileOption option = ConfigManager.Settings.Preferences.multiFileOption;
430430
if (option == MultiFileOption.Ask)
431431
{
432432
MultiLoadRequestDialog dlg = new();
@@ -622,7 +622,7 @@ private void GuiStateUpdateWorker(GuiStateArgs e)
622622
cellSelectModeToolStripMenuItem.Checked = e.CellSelectMode;
623623
RefreshEncodingMenuBar(e.CurrentEncoding);
624624

625-
if (e.TimeshiftPossible && ConfigManager.Settings.preferences.timestampControl)
625+
if (e.TimeshiftPossible && ConfigManager.Settings.Preferences.timestampControl)
626626
{
627627
dragControlDateTime.MinDateTime = e.MinTimestamp;
628628
dragControlDateTime.MaxDateTime = e.MaxTimestamp;
@@ -922,12 +922,12 @@ private void RefreshEncodingMenuBar(Encoding encoding)
922922

923923
private void OpenSettings(int tabToOpen)
924924
{
925-
SettingsDialog dlg = new(ConfigManager.Settings.preferences, this, tabToOpen);
925+
SettingsDialog dlg = new(ConfigManager.Settings.Preferences, this, tabToOpen);
926926
dlg.TopMost = TopMost;
927927

928928
if (DialogResult.OK == dlg.ShowDialog())
929929
{
930-
ConfigManager.Settings.preferences = dlg.Preferences;
930+
ConfigManager.Settings.Preferences = dlg.Preferences;
931931
ConfigManager.Save(SettingsFlags.Settings);
932932
NotifyWindowsForChangedPrefs(SettingsFlags.Settings);
933933
}
@@ -942,11 +942,11 @@ private void NotifyWindowsForChangedPrefs(SettingsFlags flags)
942942
{
943943
foreach (LogWindow.LogWindow logWindow in _logWindowList)
944944
{
945-
logWindow.PreferencesChanged(ConfigManager.Settings.preferences, false, flags);
945+
logWindow.PreferencesChanged(ConfigManager.Settings.Preferences, false, flags);
946946
}
947947
}
948948

949-
_bookmarkWindow.PreferencesChanged(ConfigManager.Settings.preferences, false, flags);
949+
_bookmarkWindow.PreferencesChanged(ConfigManager.Settings.Preferences, false, flags);
950950

951951
HilightGroupList = ConfigManager.Settings.hilightGroupList;
952952
if ((flags & SettingsFlags.HighlightSettings) == SettingsFlags.HighlightSettings)
@@ -960,7 +960,7 @@ private void ApplySettings(Settings settings, SettingsFlags flags)
960960
if ((flags & SettingsFlags.WindowPosition) == SettingsFlags.WindowPosition)
961961
{
962962
TopMost = alwaysOnTopToolStripMenuItem.Checked = settings.alwaysOnTop;
963-
dragControlDateTime.DragOrientation = settings.preferences.timestampControlDragOrientation;
963+
dragControlDateTime.DragOrientation = settings.Preferences.timestampControlDragOrientation;
964964
hideLineColumnToolStripMenuItem.Checked = settings.hideLineColumn;
965965
}
966966

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

972972
if ((flags & SettingsFlags.GuiOrColors) == SettingsFlags.GuiOrColors)
973973
{
974-
SetTabIcons(settings.preferences);
974+
SetTabIcons(settings.Preferences);
975975
}
976976

977977
if ((flags & SettingsFlags.ToolSettings) == SettingsFlags.ToolSettings)

src/LogExpert/Controls/LogTabWindow/LogTabWindowPublic.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ public void ScrollAllTabsToTimestamp(DateTime timestamp, LogWindow.LogWindow sen
233233

234234
public ILogLineColumnizer FindColumnizerByFileMask(string fileName)
235235
{
236-
foreach (ColumnizerMaskEntry entry in ConfigManager.Settings.preferences.columnizerMaskList)
236+
foreach (ColumnizerMaskEntry entry in ConfigManager.Settings.Preferences.columnizerMaskList)
237237
{
238238
if (entry.mask != null)
239239
{
@@ -258,7 +258,7 @@ public ILogLineColumnizer FindColumnizerByFileMask(string fileName)
258258

259259
public HilightGroup FindHighlightGroupByFileMask(string fileName)
260260
{
261-
foreach (HighlightMaskEntry entry in ConfigManager.Settings.preferences.highlightMaskList)
261+
foreach (HighlightMaskEntry entry in ConfigManager.Settings.Preferences.highlightMaskList)
262262
{
263263
if (entry.mask != null)
264264
{

src/LogExpert/Controls/LogWindow/LogWindow.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ public LogWindow(LogTabWindow.LogTabWindow parent, string fileName, bool isTempF
196196
filterComboBox.Items.Add(item);
197197
}
198198

199-
filterComboBox.DropDownHeight = filterComboBox.ItemHeight * ConfigManager.Settings.preferences.maximumFilterEntriesDisplayed;
199+
filterComboBox.DropDownHeight = filterComboBox.ItemHeight * ConfigManager.Settings.Preferences.maximumFilterEntriesDisplayed;
200200
AutoResizeFilterBox();
201201

202202
filterRegexCheckBox.Checked = _filterParams.isRegex;
@@ -494,7 +494,7 @@ public string Title
494494

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

497-
public Preferences Preferences => ConfigManager.Settings.preferences;
497+
public Preferences Preferences => ConfigManager.Settings.Preferences;
498498

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

src/LogExpert/Controls/LogWindow/LogWindowPrivate.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -1967,7 +1967,7 @@ private async void FilterSearch(string text)
19671967
_filterParams.lowerSearchText = text.ToLower();
19681968
ConfigManager.Settings.filterHistoryList.Remove(text);
19691969
ConfigManager.Settings.filterHistoryList.Insert(0, text);
1970-
int maxHistory = ConfigManager.Settings.preferences.maximumFilterEntries;
1970+
int maxHistory = ConfigManager.Settings.Preferences.maximumFilterEntries;
19711971

19721972
if (ConfigManager.Settings.filterHistoryList.Count > maxHistory)
19731973
{
@@ -2042,7 +2042,7 @@ private async void FilterSearch(string text)
20422042
Settings settings = ConfigManager.Settings;
20432043

20442044
//FilterFx fx = settings.preferences.multiThreadFilter ? MultiThreadedFilter : new FilterFx(Filter);
2045-
FilterFxAction = settings.preferences.multiThreadFilter ? MultiThreadedFilter : Filter;
2045+
FilterFxAction = settings.Preferences.multiThreadFilter ? MultiThreadedFilter : Filter;
20462046

20472047
//Task.Run(() => fx.Invoke(_filterParams, _filterResultList, _lastFilterLinesList, _filterHitList));
20482048
Task filterFxActionTask = Task.Run(() => Filter(_filterParams, _filterResultList, _lastFilterLinesList, _filterHitList));

src/LogExpert/Dialogs/FilterSelectorForm.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ private void OnConfigButtonClick(object sender, EventArgs e)
8484
{
8585
string configDir = ConfigManager.ConfigDir;
8686

87-
if (ConfigManager.Settings.preferences.PortableMode)
87+
if (ConfigManager.Settings.Preferences.PortableMode)
8888
{
8989
configDir = ConfigManager.PortableModeDir;
9090
}

0 commit comments

Comments
 (0)