Skip to content

Commit cb39938

Browse files
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>
1 parent 418e9ec commit cb39938

File tree

3 files changed

+16
-0
lines changed

3 files changed

+16
-0
lines changed

Aga.Controls/Aga.Controls.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
4+
</PropertyGroup>
25
<PropertyGroup>
36
<ProductVersion>9.0.30729</ProductVersion>
47
<TargetFramework>net472</TargetFramework>
@@ -118,4 +121,7 @@
118121
<Compile Remove="Tree\ColumnCollection.cs" />
119122
<Compile Remove="Tree\NativeMethods.cs" />
120123
</ItemGroup>
124+
<ItemGroup>
125+
<PackageReference Include="System.Resources.Extensions" Version="8.0.0" />
126+
</ItemGroup>
121127
</Project>

LibreHardwareMonitor/LibreHardwareMonitor.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,7 @@
11
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
2+
<PropertyGroup>
3+
<GenerateResourceUsePreserializedResources>true</GenerateResourceUsePreserializedResources>
4+
</PropertyGroup>
25
<PropertyGroup>
36
<OutputType>WinExe</OutputType>
47
<TargetFramework>net472</TargetFramework>
@@ -22,6 +25,7 @@
2225
</PropertyGroup>
2326
<ItemGroup>
2427
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
28+
<PackageReference Include="System.Resources.Extensions" Version="8.0.0" />
2529
<PackageReference Include="TaskScheduler" Version="2.12.2" />
2630
<PackageReference Include="OxyPlot.Core" Version="2.2.0" />
2731
<PackageReference Include="OxyPlot.WindowsForms" Version="2.2.0" />

LibreHardwareMonitor/UI/MainForm.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,10 @@ public MainForm()
159159
nodeTextBoxText.ToolTipProvider = tooltipProvider;
160160
nodeTextBoxValue.ToolTipProvider = tooltipProvider;
161161
_logger = new Logger(_computer);
162+
var saved = _settings.GetValue("logger.fileRotation", 0); // 0 = PerSession, 1 = Daily.
163+
_logger.FileRotationMethod = (LoggerFileRotation)Math.Max(0, Math.Min(saved, 1));
164+
perSessionFileRotationMenuItem.Checked = _logger.FileRotationMethod == LoggerFileRotation.PerSession;
165+
dailyFileRotationMenuItem.Checked = _logger.FileRotationMethod == LoggerFileRotation.Daily;
162166

163167
_computer.HardwareAdded += HardwareAdded;
164168
_computer.HardwareRemoved += HardwareRemoved;
@@ -1341,12 +1345,14 @@ private void perSessionFileRotationMenuItem_Click(object sender, EventArgs e)
13411345
dailyFileRotationMenuItem.Checked = false;
13421346
perSessionFileRotationMenuItem.Checked = true;
13431347
_logger.FileRotationMethod = LoggerFileRotation.PerSession;
1348+
_settings.SetValue("logger.fileRotation", (int)LoggerFileRotation.PerSession);
13441349
}
13451350

13461351
private void dailyFileRotationMenuItem_Click(object sender, EventArgs e)
13471352
{
13481353
dailyFileRotationMenuItem.Checked = true;
13491354
perSessionFileRotationMenuItem.Checked = false;
13501355
_logger.FileRotationMethod = LoggerFileRotation.Daily;
1356+
_settings.SetValue("logger.fileRotation", (int)LoggerFileRotation.Daily);
13511357
}
13521358
}

0 commit comments

Comments
 (0)