Files
SabreTools/SabreTools.DatItems/Formats/SourceDetails.cs

229 lines
7.7 KiB
C#
Raw Normal View History

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")]
public class SourceDetails : 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")]
public string? Id { get; set; }
2023-04-07 15:25:13 -04:00
/// <summary>
/// Section value
/// </summary>
[JsonProperty("section", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("section")]
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")]
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")]
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")]
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")]
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")]
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")]
public string? Origin { get; set; }
2023-04-07 15:25:13 -04:00
/// <summary>
/// Region value
/// </summary>
[JsonProperty("region", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("region")]
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")]
public string? MediaTitle { get; set; }
2023-04-07 15:25:13 -04:00
/// <summary>
/// Dumper value
/// </summary>
[JsonProperty("dumper", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("dumper")]
public string? Dumper { get; set; }
2023-04-07 15:25:13 -04:00
/// <summary>
/// Project value
/// </summary>
[JsonProperty("project", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("project")]
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")]
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")]
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")]
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")]
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")]
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")]
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")]
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")]
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
{
2023-04-19 12:26:54 -04:00
ItemType = ItemType.SourceDetails;
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 SourceDetails()
2023-04-07 15:25:13 -04:00
{
ItemType = this.ItemType,
DupeType = this.DupeType,
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,
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,
};
}
#endregion
#region Comparision Methods
/// <inheritdoc/>
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
if (ItemType != other?.ItemType)
2023-04-07 15:25:13 -04:00
return false;
2023-04-19 12:26:54 -04:00
// Otherwise, treat it as a SourceDetails
SourceDetails? newOther = other as SourceDetails;
2023-04-07 15:25:13 -04:00
// If the Details information matches
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
}
}