using System.Text.Json; using System.Text.Json.Serialization; namespace View_by_Distance.Shared.Models; public record Property(DateTime CreationTime, DateTime? DateTime, DateTime? DateTimeDigitized, DateTime? DateTimeFromName, DateTime? DateTimeOriginal, long FileSize, DateTime? GPSDateStamp, int? Height, int? Id, string[]? Keywords, DateTime LastWriteTime, string? Make, string? Model, string? Orientation, int? Width) { public override string ToString() { string result = JsonSerializer.Serialize(this, PropertyGenerationContext.Default.Property); return result; } public List GetDateTimes() => Stateless.Methods.Property.GetDateTimes(CreationTime, LastWriteTime, DateTime, DateTimeDigitized, DateTimeFromName, DateTimeOriginal, GPSDateStamp); public static Property GetProperty(Property property, string[] keywords) => new(property.CreationTime, property.DateTime, property.DateTimeDigitized, property.DateTimeFromName, property.DateTimeOriginal, property.FileSize, property.GPSDateStamp, property.Height, property.Id, keywords, property.LastWriteTime, property.Make, property.Model, property.Orientation, property.Width); } [JsonSourceGenerationOptions(WriteIndented = true)] [JsonSerializable(typeof(Property))] public partial class PropertyGenerationContext : JsonSerializerContext { }