2023-04-07 15:25:13 -04:00
|
|
|
using System.Xml.Serialization;
|
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using SabreTools.Core;
|
|
|
|
|
|
|
|
|
|
// TODO: Add item mappings for all fields
|
|
|
|
|
namespace SabreTools.DatItems.Formats
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2023-04-19 12:26:54 -04:00
|
|
|
/// Represents a single release details item
|
2023-04-07 15:25:13 -04:00
|
|
|
/// </summary>
|
2023-04-19 12:26:54 -04:00
|
|
|
[JsonObject("release_details"), XmlRoot("release_details")]
|
|
|
|
|
public class ReleaseDetails : DatItem
|
2023-04-07 15:25:13 -04:00
|
|
|
{
|
|
|
|
|
#region Fields
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Id value
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <remarks>TODO: Is this required?</remarks>
|
|
|
|
|
[JsonProperty("id", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("id")]
|
2023-08-14 13:17:51 -04:00
|
|
|
public string? Id { get; set; }
|
2023-04-07 15:25:13 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
2023-04-19 12:26:54 -04:00
|
|
|
/// Directory name value
|
2023-04-07 15:25:13 -04:00
|
|
|
/// </summary>
|
2023-04-19 12:26:54 -04:00
|
|
|
[JsonProperty("dirname", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("dirname")]
|
2023-08-14 13:17:51 -04:00
|
|
|
public string? DirName { get; set; }
|
2023-04-07 15:25:13 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
2023-04-19 12:26:54 -04:00
|
|
|
/// Rom info value
|
2023-04-07 15:25:13 -04:00
|
|
|
/// </summary>
|
2023-04-19 12:26:54 -04:00
|
|
|
[JsonProperty("rominfo", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("rominfo")]
|
2023-08-14 13:17:51 -04:00
|
|
|
public string? RomInfo { get; set; }
|
2023-04-07 15:25:13 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
2023-04-19 12:26:54 -04:00
|
|
|
/// Category value
|
2023-04-07 15:25:13 -04:00
|
|
|
/// </summary>
|
2023-04-19 12:26:54 -04:00
|
|
|
[JsonProperty("category", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("category")]
|
2023-08-14 13:17:51 -04:00
|
|
|
public string? Category { get; set; }
|
2023-04-07 15:25:13 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// NFO name value
|
|
|
|
|
/// </summary>
|
|
|
|
|
[JsonProperty("nfoname", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("nfoname")]
|
2023-08-14 13:17:51 -04:00
|
|
|
public string? NfoName { get; set; }
|
2023-04-07 15:25:13 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// NFO size value
|
|
|
|
|
/// </summary>
|
|
|
|
|
[JsonProperty("nfosize", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("nfosize")]
|
|
|
|
|
public long? NfoSize { get; set; }
|
|
|
|
|
|
|
|
|
|
[JsonIgnore]
|
|
|
|
|
public bool NfoSizeSpecified { get { return NfoSize != null; } }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// NFO CRC value
|
|
|
|
|
/// </summary>
|
|
|
|
|
[JsonProperty("nfocrc", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("nfocrc")]
|
2023-08-14 13:17:51 -04:00
|
|
|
public string? NfoCrc { get; set; }
|
2023-04-07 15:25:13 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Archive name value
|
|
|
|
|
/// </summary>
|
|
|
|
|
[JsonProperty("archivename", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("archivename")]
|
2023-08-14 13:17:51 -04:00
|
|
|
public string? ArchiveName { get; set; }
|
2023-04-07 15:25:13 -04:00
|
|
|
|
2023-04-19 12:26:54 -04:00
|
|
|
/// <summary>
|
|
|
|
|
/// Original format value
|
|
|
|
|
/// </summary>
|
|
|
|
|
[JsonProperty("originalformat", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("originalformat")]
|
2023-08-14 13:17:51 -04:00
|
|
|
public string? OriginalFormat { get; set; }
|
2023-04-19 12:26:54 -04:00
|
|
|
|
2023-04-07 15:25:13 -04:00
|
|
|
/// <summary>
|
|
|
|
|
/// Date value
|
|
|
|
|
/// </summary>
|
|
|
|
|
[JsonProperty("date", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("date")]
|
2023-08-14 13:17:51 -04:00
|
|
|
public string? Date { get; set; }
|
2023-04-07 15:25:13 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Grpup value
|
|
|
|
|
/// </summary>
|
|
|
|
|
[JsonProperty("group", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("group")]
|
2023-08-14 13:17:51 -04:00
|
|
|
public string? Group { get; set; }
|
2023-04-07 15:25:13 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
2023-04-19 12:26:54 -04:00
|
|
|
/// Comment value
|
2023-04-07 15:25:13 -04:00
|
|
|
/// </summary>
|
2023-04-19 12:26:54 -04:00
|
|
|
[JsonProperty("comment", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("comment")]
|
2023-08-14 13:17:51 -04:00
|
|
|
public string? Comment { get; set; }
|
2023-04-07 15:25:13 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Tool value
|
|
|
|
|
/// </summary>
|
|
|
|
|
[JsonProperty("tool", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("tool")]
|
2023-08-14 13:17:51 -04:00
|
|
|
public string? Tool { get; set; }
|
2023-04-07 15:25:13 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
2023-04-19 12:26:54 -04:00
|
|
|
/// Region value
|
2023-04-07 15:25:13 -04:00
|
|
|
/// </summary>
|
2023-04-19 12:26:54 -04:00
|
|
|
[JsonProperty("region", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("region")]
|
2023-08-14 13:17:51 -04:00
|
|
|
public string? Region { get; set; }
|
2023-04-07 15:25:13 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
2023-04-19 12:26:54 -04:00
|
|
|
/// Origin value
|
2023-04-07 15:25:13 -04:00
|
|
|
/// </summary>
|
2023-04-19 12:26:54 -04:00
|
|
|
[JsonProperty("origin", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("origin")]
|
2023-08-14 13:17:51 -04:00
|
|
|
public string? Origin { get; set; }
|
2023-04-07 15:25:13 -04:00
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Constructors
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2023-04-19 12:26:54 -04:00
|
|
|
/// Create a default, empty ReleaseDetails object
|
2023-04-07 15:25:13 -04:00
|
|
|
/// </summary>
|
2023-04-19 12:26:54 -04:00
|
|
|
public ReleaseDetails()
|
2023-04-07 15:25:13 -04:00
|
|
|
{
|
2023-04-19 12:26:54 -04:00
|
|
|
ItemType = ItemType.ReleaseDetails;
|
2023-04-07 15:25:13 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Cloning Methods
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
public override object Clone()
|
|
|
|
|
{
|
2023-04-19 12:26:54 -04:00
|
|
|
return new ReleaseDetails()
|
2023-04-07 15:25:13 -04:00
|
|
|
{
|
|
|
|
|
ItemType = this.ItemType,
|
|
|
|
|
DupeType = this.DupeType,
|
|
|
|
|
|
2023-08-14 13:17:51 -04:00
|
|
|
Machine = this.Machine?.Clone() as Machine,
|
|
|
|
|
Source = this.Source?.Clone() as Source,
|
2023-04-07 15:25:13 -04:00
|
|
|
Remove = this.Remove,
|
|
|
|
|
|
|
|
|
|
Id = this.Id,
|
|
|
|
|
DirName = this.DirName,
|
2023-04-19 12:26:54 -04:00
|
|
|
RomInfo = this.RomInfo,
|
|
|
|
|
Category = this.Category,
|
2023-04-07 15:25:13 -04:00
|
|
|
NfoName = this.NfoName,
|
|
|
|
|
NfoSize = this.NfoSize,
|
|
|
|
|
NfoCrc = this.NfoCrc,
|
|
|
|
|
ArchiveName = this.ArchiveName,
|
2023-04-19 12:26:54 -04:00
|
|
|
OriginalFormat = this.OriginalFormat,
|
2023-04-07 15:25:13 -04:00
|
|
|
Date = this.Date,
|
|
|
|
|
Group = this.Group,
|
2023-04-19 12:26:54 -04:00
|
|
|
Comment = this.Comment,
|
2023-04-07 15:25:13 -04:00
|
|
|
Tool = this.Tool,
|
2023-04-19 12:26:54 -04:00
|
|
|
Region = this.Region,
|
|
|
|
|
Origin = this.Origin,
|
2023-04-07 15:25:13 -04:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Comparision Methods
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
2023-08-14 13:17:51 -04:00
|
|
|
public override bool Equals(DatItem? other)
|
2023-04-07 15:25:13 -04:00
|
|
|
{
|
|
|
|
|
// If we don't have a Details, return false
|
2023-08-14 13:17:51 -04:00
|
|
|
if (ItemType != other?.ItemType)
|
2023-04-07 15:25:13 -04:00
|
|
|
return false;
|
|
|
|
|
|
|
|
|
|
// Otherwise, treat it as a Details
|
2023-08-14 13:17:51 -04:00
|
|
|
ReleaseDetails? newOther = other as ReleaseDetails;
|
2023-04-07 15:25:13 -04:00
|
|
|
|
|
|
|
|
// If the Details information matches
|
2023-08-14 13:17:51 -04:00
|
|
|
return (Id == newOther!.Id
|
2023-04-07 15:25:13 -04:00
|
|
|
&& DirName == newOther.DirName
|
2023-04-19 12:26:54 -04:00
|
|
|
&& RomInfo == newOther.RomInfo
|
|
|
|
|
&& Category == newOther.Category
|
2023-04-07 15:25:13 -04:00
|
|
|
&& NfoName == newOther.NfoName
|
|
|
|
|
&& NfoSize == newOther.NfoSize
|
|
|
|
|
&& NfoCrc == newOther.NfoCrc
|
|
|
|
|
&& ArchiveName == newOther.ArchiveName
|
2023-04-19 12:26:54 -04:00
|
|
|
&& OriginalFormat == newOther.OriginalFormat
|
2023-04-07 15:25:13 -04:00
|
|
|
&& Date == newOther.Date
|
|
|
|
|
&& Group == newOther.Group
|
2023-04-19 12:26:54 -04:00
|
|
|
&& Comment == newOther.Comment
|
2023-04-07 15:25:13 -04:00
|
|
|
&& Tool == newOther.Tool
|
2023-04-19 12:26:54 -04:00
|
|
|
&& Region == newOther.Region
|
|
|
|
|
&& Origin == newOther.Origin);
|
2023-04-07 15:25:13 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|