using System.Xml.Serialization; using Newtonsoft.Json; using SabreTools.Core; namespace SabreTools.DatItems.Formats { /// /// Represents one conflocation /// [JsonObject("conflocation"), XmlRoot("conflocation")] public class ConfLocation : DatItem { #region Fields /// /// Location name /// [JsonProperty("name"), XmlElement("name")] public string? Name { get => _internal.ReadString(Models.Metadata.ConfLocation.NameKey); set => _internal[Models.Metadata.ConfLocation.NameKey] = value; } /// /// Location ID /// [JsonProperty("number", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("number")] public long? Number { get => _internal.ReadLong(Models.Metadata.ConfLocation.NumberKey); set => _internal[Models.Metadata.ConfLocation.NumberKey] = value; } [JsonIgnore] public bool NumberSpecified { get { return Number != null; } } /// /// Determines if location is inverted or not /// [JsonProperty("inverted", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("inverted")] public bool? Inverted { get => _internal.ReadBool(Models.Metadata.ConfLocation.InvertedKey); set => _internal[Models.Metadata.ConfLocation.InvertedKey] = value; } [JsonIgnore] public bool InvertedSpecified { get { return Inverted != null; } } #endregion #region Accessors /// public override string? GetName() => Name; /// public override void SetName(string? name) => Name = name; #endregion #region Constructors /// /// Create a default, empty ConfLocation object /// public ConfLocation() { _internal = new Models.Metadata.ConfLocation(); Machine = new Machine(); Name = string.Empty; ItemType = ItemType.ConfLocation; } #endregion #region Cloning Methods /// public override object Clone() { return new ConfLocation() { ItemType = this.ItemType, DupeType = this.DupeType, Machine = this.Machine.Clone() as Machine ?? new Machine(), Source = this.Source?.Clone() as Source, Remove = this.Remove, _internal = this._internal?.Clone() as Models.Metadata.ConfLocation ?? new Models.Metadata.ConfLocation(), }; } #endregion } }