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
@@ -1,4 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
</PropertyGroup>
<PropertyGroup>
<ProductVersion>9.0.30729</ProductVersion>
<TargetFramework>net472</TargetFramework>
@@ -118,4 +121,7 @@
<Compile Remove="Tree\ColumnCollection.cs" />
<Compile Remove="Tree\NativeMethods.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="System.Resources.Extensions" Version="8.0.0" />
</ItemGroup>
</Project>
@@ -1,4 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
<PropertyGroup>
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
</PropertyGroup>
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net472</TargetFramework>
@@ -22,6 +25,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="System.Resources.Extensions" Version="8.0.0" />
<PackageReference Include="TaskScheduler" Version="2.12.2" />
<PackageReference Include="OxyPlot.Core" Version="2.2.0" />
<PackageReference Include="OxyPlot.WindowsForms" Version="2.2.0" />
+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);
}
}