Persist “File rotation method” across Windows reboot + SDK9 build fix (#1823)

* Fix .NET SDK 9 resource build errors (System.Resources.Extensions)

* Persist file rotation method across Windows reboot

* Update MainForm.cs

---------

Co-authored-by: PhyxionNL <7643972+PhyxionNL@users.noreply.github.com>
This commit is contained in:
Tolga YILDIRIM
2025-08-29 10:42:42 +02:00
committed by GitHub
co-authored by PhyxionNL
parent 418e9ec85f
commit cb39938143
3 changed files with 16 additions and 0 deletions
+6
View File
@@ -159,6 +159,10 @@ public sealed partial class MainForm : Form
nodeTextBoxText.ToolTipProvider = tooltipProvider;
nodeTextBoxValue.ToolTipProvider = tooltipProvider;
_logger = new Logger(_computer);
var saved = _settings.GetValue("logger.fileRotation", 0); // 0 = PerSession, 1 = Daily.
_logger.FileRotationMethod = (LoggerFileRotation)Math.Max(0, Math.Min(saved, 1));
perSessionFileRotationMenuItem.Checked = _logger.FileRotationMethod == LoggerFileRotation.PerSession;
dailyFileRotationMenuItem.Checked = _logger.FileRotationMethod == LoggerFileRotation.Daily;
_computer.HardwareAdded += HardwareAdded;
_computer.HardwareRemoved += HardwareRemoved;
@@ -1341,6 +1345,7 @@ public sealed partial class MainForm : Form
dailyFileRotationMenuItem.Checked = false;
perSessionFileRotationMenuItem.Checked = true;
_logger.FileRotationMethod = LoggerFileRotation.PerSession;
_settings.SetValue("logger.fileRotation", (int)LoggerFileRotation.PerSession);
}
private void dailyFileRotationMenuItem_Click(object sender, EventArgs e)
@@ -1348,5 +1353,6 @@ public sealed partial class MainForm : Form
dailyFileRotationMenuItem.Checked = true;
perSessionFileRotationMenuItem.Checked = false;
_logger.FileRotationMethod = LoggerFileRotation.Daily;
_settings.SetValue("logger.fileRotation", (int)LoggerFileRotation.Daily);
}
}