From 8170f3a1b35e0bb49bf1fa35ef42f4611a174fcf Mon Sep 17 00:00:00 2001 From: SuperDooper <37051355+superdooper86@users.noreply.github.com> Date: Fri, 8 May 2026 12:33:56 +0200 Subject: [PATCH] =?UTF-8?q?fix:=20resolve=20build=20errors=20=E2=80=94=20A?= =?UTF-8?q?ppSettings,=20GlobalUsings,=20namespace=20aliases?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- windows/AppSettings.cs | 43 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 43 insertions(+) create mode 100644 windows/AppSettings.cs diff --git a/windows/AppSettings.cs b/windows/AppSettings.cs new file mode 100644 index 0000000..d11c36a --- /dev/null +++ b/windows/AppSettings.cs @@ -0,0 +1,43 @@ +using System; +using System.IO; +using System.Text.Json; + +namespace ClaudeCheckerWindows; + +public class AppSettings +{ + public string CookieStore { get; set; } = ""; + public string BurnHistory { get; set; } = ""; + public int RefreshInterval { get; set; } = 120; + public bool ShowInTaskbar { get; set; } = true; + public bool BetaChannel { get; set; } = false; + + private static readonly string FilePath = Path.Combine( + Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), + "ClaudeChecker", "settings.json"); + + private static AppSettings? _instance; + public static AppSettings Default => _instance ??= Load(); + + private static AppSettings Load() + { + try + { + if (File.Exists(FilePath)) + return JsonSerializer.Deserialize(File.ReadAllText(FilePath)) ?? new(); + } + catch { } + return new(); + } + + public void Save() + { + try + { + Directory.CreateDirectory(Path.GetDirectoryName(FilePath)!); + File.WriteAllText(FilePath, JsonSerializer.Serialize(this, + new JsonSerializerOptions { WriteIndented = true })); + } + catch { } + } +}