52 lines
1.7 KiB
C#
52 lines
1.7 KiB
C#
using System;
|
|
using System.IO;
|
|
using System.Text.Json;
|
|
|
|
namespace QuickClaude
|
|
{
|
|
public class Settings
|
|
{
|
|
public double Left { get; set; } = double.NaN;
|
|
public double Top { get; set; } = double.NaN;
|
|
public double Width { get; set; } = 460;
|
|
public double Height { get; set; } = 380;
|
|
public string TextColor { get; set; } = "Black";
|
|
public string Font { get; set; } = "Consolas";
|
|
public bool Topmost { get; set; } = false;
|
|
public string WorkDir { get; set; } = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile);
|
|
public string Mode { get; set; } = "default";
|
|
public string SessionId { get; set; } = "";
|
|
public string ClaudePath { get; set; } = "";
|
|
|
|
public static string Folder =>
|
|
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "QuickClaude");
|
|
|
|
static string FilePath => Path.Combine(Folder, "settings.json");
|
|
public static string TranscriptPath => Path.Combine(Folder, "transcript.txt");
|
|
|
|
public static Settings Load()
|
|
{
|
|
try
|
|
{
|
|
if (File.Exists(FilePath))
|
|
{
|
|
var s = JsonSerializer.Deserialize<Settings>(File.ReadAllText(FilePath));
|
|
if (s != null) return s;
|
|
}
|
|
}
|
|
catch { }
|
|
return new Settings();
|
|
}
|
|
|
|
public void Save()
|
|
{
|
|
try
|
|
{
|
|
Directory.CreateDirectory(Folder);
|
|
File.WriteAllText(FilePath, JsonSerializer.Serialize(this, new JsonSerializerOptions { WriteIndented = true }));
|
|
}
|
|
catch { }
|
|
}
|
|
}
|
|
}
|