多语支持

This commit is contained in:
2026-03-22 12:33:04 +08:00
parent 5d6053ae2c
commit 1de688b792
20 changed files with 892 additions and 72 deletions

View File

@@ -5,6 +5,8 @@ namespace ChromeboxFanControl;
public sealed class AppConfig
{
/// <summary>UI language: "auto" (system), "en", "zh-Hans", "zh-Hant". Restart to apply.</summary>
public string Language { get; set; } = "auto";
public string EctoolPath { get; set; } = @"C:\Program Files\crosec\ectool.exe";
public int PollIntervalMs { get; set; } = 1500;
/// <summary>Call ectool for RPM every N control cycles (1 = every cycle).</summary>
@@ -33,7 +35,9 @@ public sealed class AppConfig
public static string UserConfigPath =>
Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
Environment.UserInteractive
? Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData)
: Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData),
"ChromeboxFanControl",
"config.json");
@@ -66,6 +70,8 @@ public sealed class AppConfig
if (src == null)
return;
if (!string.IsNullOrEmpty(src.Language))
dst.Language = src.Language;
dst.EctoolPath = src.EctoolPath;
dst.PollIntervalMs = Math.Clamp(src.PollIntervalMs, 250, 60_000);
dst.FanRpmPollEveryNCycles = Math.Max(1, src.FanRpmPollEveryNCycles);