using System.Collections.ObjectModel; using System.Text.Json; using System.Text.Json.Serialization; namespace ImmichToSlideshow.Models.DigiKam; public record Images([property: JsonPropertyName("album")] int? Album, [property: JsonPropertyName("category")] int Category, [property: JsonPropertyName("fileSize")] object FileSize, [property: JsonPropertyName("id")] int Id, [property: JsonPropertyName("manualOrder")] object ManualOrder, [property: JsonPropertyName("modificationDate")] DateTime ModificationDate, [property: JsonPropertyName("name")] string Name, [property: JsonPropertyName("status")] int Status, [property: JsonPropertyName("uniqueHash")] string UniqueHash) { internal static ReadOnlyCollection? GetImages(string? path) { Images[]? results; if (string.IsNullOrEmpty(path) || !File.Exists(path)) { results = null; } else { string json = File.ReadAllText(path); results = JsonSerializer.Deserialize(json); } return results?.AsReadOnly(); } }