namespace AmiReel.Models; /// /// Persisted user settings (%LOCALAPPDATA%\AmiReel\settings.json). Uses named init /// properties rather than a positional constructor: several members share the same /// type (e.g. TrimStart/FadeSeconds/EndCardHoldSeconds), so a /// positional record would let two arguments be silently transposed at a call site /// without the compiler catching it. /// public sealed record AppSettings { public required string OutputFolder { get; init; } public required string EndCardPath { get; init; } public required string FfmpegPath { get; init; } public required string FfprobePath { get; init; } public required string PreviewPlayerPath { get; init; } public required string Theme { get; init; } public required string Encoder { get; init; } public required string TrimStart { get; init; } public required string FadeSeconds { get; init; } public required string EndCardHoldSeconds { get; init; } public required string ThumbnailInterval { get; init; } public bool? MoveSourcesToOriginals { get; init; } public bool ShouldMoveSourcesToOriginals => MoveSourcesToOriginals != false; public static AppSettings Default(string outputFolder) => new() { OutputFolder = outputFolder, EndCardPath = "", FfmpegPath = "", FfprobePath = "", PreviewPlayerPath = "", Theme = "Dark", Encoder = "Auto", TrimStart = "4.414", FadeSeconds = "3", EndCardHoldSeconds = "4", ThumbnailInterval = "10", MoveSourcesToOriginals = true, }; public AppSettings Normalize(string fallbackOutputFolder) => this with { OutputFolder = string.IsNullOrWhiteSpace(OutputFolder) ? fallbackOutputFolder : OutputFolder, EndCardPath = EndCardPath ?? "", FfmpegPath = FfmpegPath ?? "", FfprobePath = FfprobePath ?? "", PreviewPlayerPath = PreviewPlayerPath ?? "", Theme = string.IsNullOrWhiteSpace(Theme) ? "Dark" : Theme, Encoder = string.IsNullOrWhiteSpace(Encoder) ? "Auto" : Encoder, TrimStart = string.IsNullOrWhiteSpace(TrimStart) ? "4.414" : TrimStart, FadeSeconds = string.IsNullOrWhiteSpace(FadeSeconds) ? "3" : FadeSeconds, EndCardHoldSeconds = string.IsNullOrWhiteSpace(EndCardHoldSeconds) ? "4" : EndCardHoldSeconds, ThumbnailInterval = string.IsNullOrWhiteSpace(ThumbnailInterval) ? "10" : ThumbnailInterval, MoveSourcesToOriginals = MoveSourcesToOriginals ?? true, }; }