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