using System.Xml.Serialization; using Newtonsoft.Json; using SabreTools.Data.Extensions; namespace SabreTools.Metadata.DatItems.Formats { /// /// Represents which Chip(s) is associated with a set /// [JsonObject("chip"), XmlRoot("chip")] public sealed class Chip : DatItem { #region Fields /// /> protected override ItemType ItemType => ItemType.Chip; #endregion #region Constructors public Chip() : base() { } public Chip(Data.Models.Metadata.Chip item) : base(item) { // Process flag values bool? soundOnly = ReadBool(Data.Models.Metadata.Chip.SoundOnlyKey); if (soundOnly is not null) Write(Data.Models.Metadata.Chip.SoundOnlyKey, soundOnly.FromYesNo()); string? chipType = ReadString(Data.Models.Metadata.Chip.ChipTypeKey); if (chipType is not null) Write(Data.Models.Metadata.Chip.ChipTypeKey, chipType.AsChipType()?.AsStringValue()); } public Chip(Data.Models.Metadata.Chip item, Machine machine, Source source) : this(item) { Write(SourceKey, source); CopyMachineInformation(machine); } #endregion #region Cloning Methods /// public override object Clone() => new Chip(_internal.Clone() as Data.Models.Metadata.Chip ?? []); #endregion } }