Working version

This commit is contained in:
2026-08-11 12:34:02 +02:00
parent 438f163630
commit ad205bb534
12 changed files with 1006 additions and 179 deletions
+6 -4
View File
@@ -7,22 +7,24 @@ namespace AmigaDB.VideoRenderer.Services;
public static class AppSettingsStore
{
private static readonly JsonSerializerOptions JsonOptions = new() { WriteIndented = true };
private static string DefaultOutputFolder => Environment.GetFolderPath(Environment.SpecialFolder.MyVideos);
public static AppSettings Load()
{
string path = GetSettingsPath();
if (!File.Exists(path))
return AppSettings.Default(Environment.GetFolderPath(Environment.SpecialFolder.MyVideos));
return AppSettings.Default(DefaultOutputFolder);
try
{
string json = File.ReadAllText(path);
return JsonSerializer.Deserialize<AppSettings>(json, JsonOptions)
?? AppSettings.Default(Environment.GetFolderPath(Environment.SpecialFolder.MyVideos));
return (JsonSerializer.Deserialize<AppSettings>(json, JsonOptions)
?? AppSettings.Default(DefaultOutputFolder))
.Normalize(DefaultOutputFolder);
}
catch
{
return AppSettings.Default(Environment.GetFolderPath(Environment.SpecialFolder.MyVideos));
return AppSettings.Default(DefaultOutputFolder);
}
}