namespace Mr.BrickAdventures.Progression; public enum LoadOutcome { Loaded, Absent, Corrupt, } /// /// The result of loading something from a store: it was there, it was never there, or it was there /// and unreadable. /// /// /// Three outcomes rather than two, deliberately. The system being replaced collapsed "no save file" /// and "version mismatch" into a single false from LoadGame, which ContinueGame /// then read as "no save" — so it started a new game and overwrote the player's file. Absent means /// offer a new game; Corrupt means tell the player something went wrong. /// public sealed record LoadResult(LoadOutcome Outcome, T? Value, string? Problem) where T : class { public static LoadResult Loaded(T value) => new(LoadOutcome.Loaded, value, null); public static LoadResult Absent() => new(LoadOutcome.Absent, null, null); public static LoadResult Corrupt(string problem) => new(LoadOutcome.Corrupt, null, problem); }