1
0

initial commit

This commit is contained in:
2026-03-04 07:59:35 +01:00
commit 3ceb0e4884
27 changed files with 2280 additions and 0 deletions

40
AnchorConfig.cs Normal file
View File

@@ -0,0 +1,40 @@
using System.Text.Json;
using System.Text.Json.Serialization;
namespace AnchorCli;
internal sealed class AnchorConfig
{
public string ApiKey { get; set; } = "";
public string Model { get; set; } = "qwen/qwen3.5-27b";
// ── Persistence ──────────────────────────────────────────────────────
private static string ConfigPath =>
Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
"anchor", "config.json");
public static AnchorConfig Load()
{
try
{
if (File.Exists(ConfigPath))
{
var json = File.ReadAllText(ConfigPath);
return JsonSerializer.Deserialize(json, AppJsonContext.Default.AnchorConfig)
?? new AnchorConfig();
}
}
catch { /* fall through to defaults */ }
return new AnchorConfig();
}
public void Save()
{
Directory.CreateDirectory(Path.GetDirectoryName(ConfigPath)!);
var json = JsonSerializer.Serialize(this, AppJsonContext.Default.AnchorConfig);
File.WriteAllText(ConfigPath, json);
}
}