Initial AmiReel application

This commit is contained in:
2026-08-11 10:43:27 +02:00
commit 438f163630
28 changed files with 1160 additions and 0 deletions
+40
View File
@@ -0,0 +1,40 @@
using System.IO;
using System.Text.Json;
using AmigaDB.VideoRenderer.Models;
namespace AmigaDB.VideoRenderer.Services;
public static class AppSettingsStore
{
private static readonly JsonSerializerOptions JsonOptions = new() { WriteIndented = true };
public static AppSettings Load()
{
string path = GetSettingsPath();
if (!File.Exists(path))
return AppSettings.Default(Environment.GetFolderPath(Environment.SpecialFolder.MyVideos));
try
{
string json = File.ReadAllText(path);
return JsonSerializer.Deserialize<AppSettings>(json, JsonOptions)
?? AppSettings.Default(Environment.GetFolderPath(Environment.SpecialFolder.MyVideos));
}
catch
{
return AppSettings.Default(Environment.GetFolderPath(Environment.SpecialFolder.MyVideos));
}
}
public static void Save(AppSettings settings)
{
string path = GetSettingsPath();
Directory.CreateDirectory(Path.GetDirectoryName(path)!);
string json = JsonSerializer.Serialize(settings, JsonOptions);
File.WriteAllText(path, json);
}
private static string GetSettingsPath() => Path.Combine(
Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData),
"AmiReel", "settings.json");
}