using System; using System.Xml.Serialization; using Newtonsoft.Json; namespace SabreTools.Data.Models.Metadata { [JsonObject("driver"), XmlRoot("driver")] public class Driver : DatItem, ICloneable, IEquatable { #region Properties /// (plain|dirty) public Blit? Blit { get; set; } /// (good|imperfect|preliminary) public SupportStatus? Cocktail { get; set; } /// (good|imperfect|preliminary) public SupportStatus? Color { get; set; } /// (good|imperfect|preliminary) public SupportStatus? Emulation { get; set; } /// (yes|no) "no" public bool? Incomplete { get; set; } /// (yes|no) "no" public bool? NoSoundHardware { get; set; } /// Possibly long public string? PaletteSize { get; set; } /// (yes|no) "no" public bool? RequiresArtwork { get; set; } /// (supported|unsupported) public Supported? SaveState { get; set; } /// (good|imperfect|preliminary) public SupportStatus? Sound { get; set; } /// (good|imperfect|preliminary|test) public SupportStatus? Status { get; set; } /// (yes|no) "no" public bool? Unofficial { get; set; } #endregion public Driver() => ItemType = ItemType.Driver; /// public object Clone() { var obj = new Driver(); obj.Blit = Blit; obj.Cocktail = Cocktail; obj.Color = Color; obj.Emulation = Emulation; obj.Incomplete = Incomplete; obj.NoSoundHardware = NoSoundHardware; obj.PaletteSize = PaletteSize; obj.RequiresArtwork = RequiresArtwork; obj.SaveState = SaveState; obj.Sound = Sound; obj.Status = Status; obj.Unofficial = Unofficial; return obj; } /// public bool Equals(Driver? other) { // Null never matches if (other is null) return false; // Properties if (Blit != other.Blit) return false; if (Cocktail != other.Cocktail) return false; if (Color != other.Color) return false; if (Emulation != other.Emulation) return false; if (Incomplete != other.Incomplete) return false; if (NoSoundHardware != other.NoSoundHardware) return false; if ((PaletteSize is null) ^ (other.PaletteSize is null)) return false; else if (PaletteSize is not null && !PaletteSize.Equals(other.PaletteSize, StringComparison.OrdinalIgnoreCase)) return false; if (RequiresArtwork != other.RequiresArtwork) return false; if (SaveState != other.SaveState) return false; if (Sound != other.Sound) return false; if (Status != other.Status) return false; if (Unofficial != other.Unofficial) return false; return true; } } }