2020-12-14 10:58:43 -08:00
|
|
|
|
using System.Xml.Serialization;
|
2020-09-02 12:19:12 -07:00
|
|
|
|
using Newtonsoft.Json;
|
2022-11-03 12:22:17 -07:00
|
|
|
|
using SabreTools.Core;
|
2016-10-12 16:02:51 -07:00
|
|
|
|
|
2021-02-02 10:23:43 -08:00
|
|
|
|
namespace SabreTools.DatItems.Formats
|
2016-09-19 18:04:24 -07:00
|
|
|
|
{
|
2019-01-08 17:40:12 -08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Represents release information about a set
|
|
|
|
|
|
/// </summary>
|
2020-09-08 10:12:41 -07:00
|
|
|
|
[JsonObject("release"), XmlRoot("release")]
|
2019-01-08 17:40:12 -08:00
|
|
|
|
public class Release : DatItem
|
|
|
|
|
|
{
|
2020-08-20 13:17:14 -07:00
|
|
|
|
#region Fields
|
2019-01-08 17:40:12 -08:00
|
|
|
|
|
2020-09-02 12:19:12 -07:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Name of the item
|
|
|
|
|
|
/// </summary>
|
2022-11-03 12:22:17 -07:00
|
|
|
|
[JsonProperty("name"), XmlElement("name")]
|
2023-08-14 13:17:51 -04:00
|
|
|
|
public string? Name
|
|
|
|
|
|
{
|
2023-08-14 22:33:05 -04:00
|
|
|
|
get => _internal.ReadString(Models.Internal.Release.NameKey);
|
|
|
|
|
|
set => _internal[Models.Internal.Release.NameKey] = value;
|
2023-08-14 13:17:51 -04:00
|
|
|
|
}
|
2020-09-02 12:19:12 -07:00
|
|
|
|
|
2019-01-08 17:40:12 -08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Release region(s)
|
|
|
|
|
|
/// </summary>
|
2022-11-03 12:22:17 -07:00
|
|
|
|
[JsonProperty("region", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("region")]
|
2023-08-14 13:17:51 -04:00
|
|
|
|
public string? Region
|
|
|
|
|
|
{
|
2023-08-14 22:33:05 -04:00
|
|
|
|
get => _internal.ReadString(Models.Internal.Release.RegionKey);
|
|
|
|
|
|
set => _internal[Models.Internal.Release.RegionKey] = value;
|
2023-08-14 13:17:51 -04:00
|
|
|
|
}
|
2019-01-08 17:40:12 -08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Release language(s)
|
|
|
|
|
|
/// </summary>
|
2022-11-03 12:22:17 -07:00
|
|
|
|
[JsonProperty("language", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("language")]
|
2023-08-14 13:17:51 -04:00
|
|
|
|
public string? Language
|
|
|
|
|
|
{
|
2023-08-14 22:33:05 -04:00
|
|
|
|
get => _internal.ReadString(Models.Internal.Release.LanguageKey);
|
|
|
|
|
|
set => _internal[Models.Internal.Release.LanguageKey] = value;
|
2023-08-14 13:17:51 -04:00
|
|
|
|
}
|
2019-01-08 17:40:12 -08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Date of release
|
|
|
|
|
|
/// </summary>
|
2022-11-03 12:22:17 -07:00
|
|
|
|
[JsonProperty("date", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("date")]
|
2023-08-14 13:17:51 -04:00
|
|
|
|
public string? Date
|
|
|
|
|
|
{
|
2023-08-14 22:33:05 -04:00
|
|
|
|
get => _internal.ReadString(Models.Internal.Release.DateKey);
|
|
|
|
|
|
set => _internal[Models.Internal.Release.DateKey] = value;
|
2023-08-14 13:17:51 -04:00
|
|
|
|
}
|
2019-01-08 17:40:12 -08:00
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Default release, if applicable
|
|
|
|
|
|
/// </summary>
|
2022-11-03 12:22:17 -07:00
|
|
|
|
[JsonProperty("default", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("default")]
|
2023-08-14 13:17:51 -04:00
|
|
|
|
public bool? Default
|
|
|
|
|
|
{
|
2023-08-14 22:33:05 -04:00
|
|
|
|
get => _internal.ReadBool(Models.Internal.Release.DefaultKey);
|
|
|
|
|
|
set => _internal[Models.Internal.Release.DefaultKey] = value;
|
2023-08-14 13:17:51 -04:00
|
|
|
|
}
|
2019-01-08 17:40:12 -08:00
|
|
|
|
|
2020-09-07 22:00:02 -07:00
|
|
|
|
[JsonIgnore]
|
|
|
|
|
|
public bool DefaultSpecified { get { return Default != null; } }
|
|
|
|
|
|
|
2019-01-08 17:40:12 -08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
2020-08-17 17:28:32 -07:00
|
|
|
|
#region Accessors
|
|
|
|
|
|
|
2020-12-13 14:01:16 -08:00
|
|
|
|
/// <inheritdoc/>
|
2023-08-14 13:17:51 -04:00
|
|
|
|
public override string? GetName() => Name;
|
2020-09-02 12:19:12 -07:00
|
|
|
|
|
2020-12-13 14:01:16 -08:00
|
|
|
|
/// <inheritdoc/>
|
2023-08-14 13:17:51 -04:00
|
|
|
|
public override void SetName(string? name) => Name = name;
|
2020-12-13 14:01:16 -08:00
|
|
|
|
|
2020-08-17 17:28:32 -07:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
2019-01-08 17:40:12 -08:00
|
|
|
|
#region Constructors
|
|
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Create a default, empty Release object
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public Release()
|
|
|
|
|
|
{
|
2023-08-14 22:33:05 -04:00
|
|
|
|
_internal = new Models.Internal.Release();
|
2023-08-15 01:38:01 -04:00
|
|
|
|
Machine = new Machine();
|
|
|
|
|
|
|
2020-08-20 13:17:14 -07:00
|
|
|
|
Name = string.Empty;
|
|
|
|
|
|
ItemType = ItemType.Release;
|
|
|
|
|
|
Region = string.Empty;
|
|
|
|
|
|
Language = string.Empty;
|
|
|
|
|
|
Date = string.Empty;
|
|
|
|
|
|
Default = null;
|
2019-01-08 17:40:12 -08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
|
|
#region Cloning Methods
|
|
|
|
|
|
|
2022-11-03 12:22:17 -07:00
|
|
|
|
/// <inheritdoc/>
|
2019-01-08 17:40:12 -08:00
|
|
|
|
public override object Clone()
|
|
|
|
|
|
{
|
|
|
|
|
|
return new Release()
|
|
|
|
|
|
{
|
|
|
|
|
|
ItemType = this.ItemType,
|
|
|
|
|
|
DupeType = this.DupeType,
|
|
|
|
|
|
|
2023-08-15 01:38:01 -04:00
|
|
|
|
Machine = this.Machine.Clone() as Machine ?? new Machine(),
|
2023-08-14 13:17:51 -04:00
|
|
|
|
Source = this.Source?.Clone() as Source,
|
2020-08-20 13:17:14 -07:00
|
|
|
|
Remove = this.Remove,
|
2019-01-08 17:40:12 -08:00
|
|
|
|
|
2023-08-14 22:33:05 -04:00
|
|
|
|
_internal = this._internal?.Clone() as Models.Internal.Release ?? new Models.Internal.Release(),
|
2019-01-08 17:40:12 -08:00
|
|
|
|
};
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
}
|
2016-09-19 18:04:24 -07:00
|
|
|
|
}
|