mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-09-24 07:45:06 +00:00
Convert Dump to using properties
This commit is contained in:
@@ -1,31 +1,72 @@
|
||||
using System;
|
||||
using System.Xml.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SabreTools.Data.Models.Metadata
|
||||
{
|
||||
[JsonObject("dump"), XmlRoot("dump")]
|
||||
public class Dump : DatItem
|
||||
public class Dump : DatItem, ICloneable, IEquatable<Dump>
|
||||
{
|
||||
#region Keys
|
||||
#region Properties
|
||||
|
||||
/// <remarks>Rom</remarks>
|
||||
[NoFilter]
|
||||
public const string MegaRomKey = "megarom";
|
||||
public Rom? MegaRom { get; set; }
|
||||
|
||||
/// <remarks>Original</remarks>
|
||||
[NoFilter]
|
||||
public const string OriginalKey = "original";
|
||||
public Original? Original { get; set; }
|
||||
|
||||
/// <remarks>Rom</remarks>
|
||||
[NoFilter]
|
||||
public const string RomKey = "rom";
|
||||
public Rom? Rom { get; set; }
|
||||
|
||||
/// <remarks>Rom</remarks>
|
||||
[NoFilter]
|
||||
public const string SCCPlusCartKey = "sccpluscart";
|
||||
public Rom? SCCPlusCart { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
public Dump() => ItemType = ItemType.Dump;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public object Clone()
|
||||
{
|
||||
var obj = new Dump();
|
||||
|
||||
if (MegaRom is not null)
|
||||
obj.MegaRom = MegaRom.Clone() as Rom;
|
||||
if (Original is not null)
|
||||
obj.Original = Original.Clone() as Original;
|
||||
if (Rom is not null)
|
||||
obj.Rom = Rom.Clone() as Rom;
|
||||
if (SCCPlusCart is not null)
|
||||
obj.SCCPlusCart = SCCPlusCart.Clone() as Rom;
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Equals(Dump? other)
|
||||
{
|
||||
// Null never matches
|
||||
if (other is null)
|
||||
return false;
|
||||
|
||||
// Sub-items
|
||||
if ((MegaRom is null) ^ (other.MegaRom is null))
|
||||
return false;
|
||||
else if (MegaRom is not null && other.MegaRom is not null && MegaRom.Equals(other.MegaRom))
|
||||
return false;
|
||||
|
||||
if ((Original is null) ^ (other.Original is null))
|
||||
return false;
|
||||
else if (Original is not null && other.Original is not null && Original.Equals(other.Original))
|
||||
return false;
|
||||
|
||||
if ((Rom is null) ^ (other.Rom is null))
|
||||
return false;
|
||||
else if (Rom is not null && other.Rom is not null && Rom.Equals(other.Rom))
|
||||
return false;
|
||||
|
||||
if ((SCCPlusCart is null) ^ (other.SCCPlusCart is null))
|
||||
return false;
|
||||
else if (SCCPlusCart is not null && other.SCCPlusCart is not null && SCCPlusCart.Equals(other.SCCPlusCart))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user