From cb3993814305f81b5e2c3b827bb39e85065dfb9b Mon Sep 17 00:00:00 2001
From: Tolga YILDIRIM <79647252+TolgaFlashTR@users.noreply.github.com>
Date: Fri, 29 Aug 2025 11:42:42 +0300
Subject: [PATCH] =?UTF-8?q?Persist=20=E2=80=9CFile=20rotation=20method?=
=?UTF-8?q?=E2=80=9D=20across=20Windows=20reboot=20+=20SDK9=20build=20fix?=
=?UTF-8?q?=20(#1823)?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* 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>
---
Aga.Controls/Aga.Controls.csproj | 6 ++++++
LibreHardwareMonitor/LibreHardwareMonitor.csproj | 4 ++++
LibreHardwareMonitor/UI/MainForm.cs | 6 ++++++
3 files changed, 16 insertions(+)
diff --git a/Aga.Controls/Aga.Controls.csproj b/Aga.Controls/Aga.Controls.csproj
index bc554cc..0000742 100644
--- a/Aga.Controls/Aga.Controls.csproj
+++ b/Aga.Controls/Aga.Controls.csproj
@@ -1,4 +1,7 @@
+
+ true
+
9.0.30729
net472
@@ -118,4 +121,7 @@
+
+
+
\ No newline at end of file
diff --git a/LibreHardwareMonitor/LibreHardwareMonitor.csproj b/LibreHardwareMonitor/LibreHardwareMonitor.csproj
index 535351b..1151f6c 100644
--- a/LibreHardwareMonitor/LibreHardwareMonitor.csproj
+++ b/LibreHardwareMonitor/LibreHardwareMonitor.csproj
@@ -1,4 +1,7 @@
+
+ true
+
WinExe
net472
@@ -22,6 +25,7 @@
+
diff --git a/LibreHardwareMonitor/UI/MainForm.cs b/LibreHardwareMonitor/UI/MainForm.cs
index bc146ca..5416ad8 100644
--- a/LibreHardwareMonitor/UI/MainForm.cs
+++ b/LibreHardwareMonitor/UI/MainForm.cs
@@ -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);
}
}