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 source details item
|
2023-04-07 15:25:13 -04:00
|
|
|
/// </summary>
|
2023-04-19 12:26:54 -04:00
|
|
|
[JsonObject("source_details"), XmlRoot("source_details")]
|
2024-03-10 20:39:54 -04:00
|
|
|
public sealed class SourceDetails : DatItem
|
2023-04-07 15:25:13 -04:00
|
|
|
{
|
|
|
|
|
#region Fields
|
|
|
|
|
|
2024-03-10 20:45:54 -04:00
|
|
|
/// <inheritdoc>/>
|
|
|
|
|
protected override ItemType ItemType => ItemType.SourceDetails;
|
|
|
|
|
|
2023-04-07 15:25:13 -04:00
|
|
|
/// <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>
|
|
|
|
|
/// Section value
|
|
|
|
|
/// </summary>
|
|
|
|
|
[JsonProperty("section", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("section")]
|
2023-08-14 13:17:51 -04:00
|
|
|
public string? Section { 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
|
|
|
/// Dumping date value
|
2023-04-07 15:25:13 -04:00
|
|
|
/// </summary>
|
2023-04-19 12:26:54 -04:00
|
|
|
[JsonProperty("d_date", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("d_date")]
|
2023-08-14 13:17:51 -04:00
|
|
|
public string? DDate { get; set; }
|
2023-04-07 15:25:13 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
2023-04-19 12:26:54 -04:00
|
|
|
/// Dumping date info value
|
2023-04-07 15:25:13 -04:00
|
|
|
/// </summary>
|
2023-04-19 12:26:54 -04:00
|
|
|
[JsonProperty("d_date_info", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("d_date_info")]
|
2023-08-14 13:17:51 -04:00
|
|
|
public string? DDateInfo { get; set; }
|
2023-04-07 15:25:13 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
2023-04-19 12:26:54 -04:00
|
|
|
/// Release date value
|
2023-04-07 15:25:13 -04:00
|
|
|
/// </summary>
|
2023-04-19 12:26:54 -04:00
|
|
|
[JsonProperty("r_date", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("r_date")]
|
2023-08-14 13:17:51 -04:00
|
|
|
public string? RDate { get; set; }
|
2023-04-07 15:25:13 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
2023-04-19 12:26:54 -04:00
|
|
|
/// Release date info value
|
2023-04-07 15:25:13 -04:00
|
|
|
/// </summary>
|
2023-04-19 12:26:54 -04:00
|
|
|
[JsonProperty("r_date_info", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("r_date_info")]
|
2023-08-14 13:17:51 -04:00
|
|
|
public string? RDateInfo { 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
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Region value
|
|
|
|
|
/// </summary>
|
|
|
|
|
[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>
|
|
|
|
|
/// Media title value
|
|
|
|
|
/// </summary>
|
|
|
|
|
[JsonProperty("media_title", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("media_title")]
|
2023-08-14 13:17:51 -04:00
|
|
|
public string? MediaTitle { get; set; }
|
2023-04-07 15:25:13 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Dumper value
|
|
|
|
|
/// </summary>
|
|
|
|
|
[JsonProperty("dumper", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("dumper")]
|
2023-08-14 13:17:51 -04:00
|
|
|
public string? Dumper { get; set; }
|
2023-04-07 15:25:13 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Project value
|
|
|
|
|
/// </summary>
|
|
|
|
|
[JsonProperty("project", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("project")]
|
2023-08-14 13:17:51 -04:00
|
|
|
public string? Project { get; set; }
|
2023-04-07 15:25:13 -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-07 15:25:13 -04:00
|
|
|
|
2023-04-19 12:26:54 -04:00
|
|
|
/// <summary>
|
|
|
|
|
/// Nodump value
|
|
|
|
|
/// </summary>
|
|
|
|
|
[JsonProperty("nodump", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("nodump")]
|
2023-08-14 13:17:51 -04:00
|
|
|
public string? Nodump { get; set; }
|
2023-04-19 12:26:54 -04:00
|
|
|
|
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>
|
|
|
|
|
/// Comment 1 value
|
|
|
|
|
/// </summary>
|
|
|
|
|
[JsonProperty("comment1", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("comment1")]
|
2023-08-14 13:17:51 -04:00
|
|
|
public string? Comment1 { get; set; }
|
2023-04-07 15:25:13 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Link 2 value
|
|
|
|
|
/// </summary>
|
|
|
|
|
[JsonProperty("comment2", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("comment2")]
|
2023-08-14 13:17:51 -04:00
|
|
|
public string? Comment2 { get; set; }
|
2023-04-07 15:25:13 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Link 1 value
|
|
|
|
|
/// </summary>
|
|
|
|
|
[JsonProperty("link1", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("link1")]
|
2023-08-14 13:17:51 -04:00
|
|
|
public string? Link1 { get; set; }
|
2023-04-07 15:25:13 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Link 2 value
|
|
|
|
|
/// </summary>
|
|
|
|
|
[JsonProperty("link2", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("link2")]
|
2023-08-14 13:17:51 -04:00
|
|
|
public string? Link2 { get; set; }
|
2023-04-07 15:25:13 -04:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Link 3 value
|
|
|
|
|
/// </summary>
|
|
|
|
|
[JsonProperty("link3", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("link3")]
|
2023-08-14 13:17:51 -04:00
|
|
|
public string? Link3 { 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 SourceDetails object
|
2023-04-07 15:25:13 -04:00
|
|
|
/// </summary>
|
2023-04-19 12:26:54 -04:00
|
|
|
public SourceDetails()
|
2023-04-07 15:25:13 -04:00
|
|
|
{
|
2024-03-10 16:49:07 -04:00
|
|
|
SetFieldValue<ItemType>(Models.Metadata.DatItem.TypeKey, ItemType.SourceDetails);
|
2023-04-07 15:25:13 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Cloning Methods
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc/>
|
|
|
|
|
public override object Clone()
|
|
|
|
|
{
|
2024-03-10 16:49:07 -04:00
|
|
|
var sourceDetails = new SourceDetails()
|
2023-04-07 15:25:13 -04:00
|
|
|
{
|
|
|
|
|
Id = this.Id,
|
|
|
|
|
Section = this.Section,
|
2023-04-19 12:26:54 -04:00
|
|
|
RomInfo = this.RomInfo,
|
2023-04-07 15:25:13 -04:00
|
|
|
DDate = this.DDate,
|
2023-04-19 12:26:54 -04:00
|
|
|
DDateInfo = this.DDateInfo,
|
|
|
|
|
RDate = this.RDate,
|
|
|
|
|
RDateInfo = this.RDateInfo,
|
|
|
|
|
Origin = this.Origin,
|
2023-04-07 15:25:13 -04:00
|
|
|
Region = this.Region,
|
|
|
|
|
MediaTitle = this.MediaTitle,
|
|
|
|
|
Dumper = this.Dumper,
|
|
|
|
|
Project = this.Project,
|
|
|
|
|
OriginalFormat = this.OriginalFormat,
|
2023-04-19 12:26:54 -04:00
|
|
|
Nodump = this.Nodump,
|
2023-04-07 15:25:13 -04:00
|
|
|
Tool = this.Tool,
|
|
|
|
|
Comment1 = this.Comment1,
|
|
|
|
|
Comment2 = this.Comment2,
|
|
|
|
|
Link1 = this.Link1,
|
|
|
|
|
Link2 = this.Link2,
|
|
|
|
|
Link3 = this.Link3,
|
|
|
|
|
};
|
2024-03-10 16:49:07 -04:00
|
|
|
sourceDetails.SetFieldValue<DupeType>(DatItem.DupeTypeKey, GetFieldValue<DupeType>(DatItem.DupeTypeKey));
|
|
|
|
|
sourceDetails.SetFieldValue<Machine>(DatItem.MachineKey, GetFieldValue<Machine>(DatItem.MachineKey));
|
2024-03-11 14:31:02 -04:00
|
|
|
sourceDetails.SetFieldValue<bool?>(DatItem.RemoveKey, GetFieldValue<bool?>(DatItem.RemoveKey));
|
2024-03-10 16:49:07 -04:00
|
|
|
sourceDetails.SetFieldValue<Source?>(DatItem.SourceKey, GetFieldValue<Source?>(DatItem.SourceKey));
|
|
|
|
|
sourceDetails.SetFieldValue<ItemType>(Models.Metadata.DatItem.TypeKey, GetFieldValue<ItemType>(Models.Metadata.DatItem.TypeKey));
|
|
|
|
|
|
|
|
|
|
return sourceDetails;
|
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
|
|
|
{
|
2023-04-19 12:26:54 -04:00
|
|
|
// If we don't have a SourceDetails, return false
|
2024-03-10 16:49:07 -04:00
|
|
|
if (GetFieldValue<ItemType>(Models.Metadata.DatItem.TypeKey) != other?.GetFieldValue<ItemType>(Models.Metadata.DatItem.TypeKey))
|
2023-04-07 15:25:13 -04:00
|
|
|
return false;
|
|
|
|
|
|
2023-04-19 12:26:54 -04:00
|
|
|
// Otherwise, treat it as a SourceDetails
|
2023-08-14 13:17:51 -04:00
|
|
|
SourceDetails? newOther = other as SourceDetails;
|
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
|
|
|
&& Section == newOther.Section
|
2023-04-19 12:26:54 -04:00
|
|
|
&& RomInfo == newOther.RomInfo
|
2023-04-07 15:25:13 -04:00
|
|
|
&& DDate == newOther.DDate
|
2023-04-19 12:26:54 -04:00
|
|
|
&& DDateInfo == newOther.DDateInfo
|
|
|
|
|
&& RomInfo == newOther.RomInfo
|
|
|
|
|
&& RDate == newOther.RDate
|
|
|
|
|
&& RDateInfo == newOther.RDateInfo
|
|
|
|
|
&& Origin == newOther.Origin
|
2023-04-07 15:25:13 -04:00
|
|
|
&& Region == newOther.Region
|
|
|
|
|
&& MediaTitle == newOther.MediaTitle
|
|
|
|
|
&& Dumper == newOther.Dumper
|
|
|
|
|
&& Project == newOther.Project
|
|
|
|
|
&& OriginalFormat == newOther.OriginalFormat
|
2023-04-19 12:26:54 -04:00
|
|
|
&& Nodump == newOther.Nodump
|
2023-04-07 15:25:13 -04:00
|
|
|
&& Tool == newOther.Tool
|
|
|
|
|
&& Comment1 == newOther.Comment1
|
|
|
|
|
&& Comment2 == newOther.Comment2
|
|
|
|
|
&& Link1 == newOther.Link1
|
|
|
|
|
&& Link2 == newOther.Link2
|
|
|
|
|
&& Link3 == newOther.Link3);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion
|
|
|
|
|
}
|
|
|
|
|
}
|