Files

81 lines
2.4 KiB
C#
Raw Permalink Normal View History

2026-04-04 14:23:27 -04:00
using System;
2025-09-26 10:20:48 -04:00
using System.Xml.Serialization;
using Newtonsoft.Json;
2025-09-26 13:06:18 -04:00
namespace SabreTools.Data.Models.Metadata
2025-09-26 10:20:48 -04:00
{
[JsonObject("dump"), XmlRoot("dump")]
2026-04-04 14:23:27 -04:00
public class Dump : DatItem, ICloneable, IEquatable<Dump>
2025-09-26 10:20:48 -04:00
{
2026-04-04 14:23:27 -04:00
#region Properties
2025-09-26 10:20:48 -04:00
public string? Boot { get; set; }
2026-04-04 14:23:27 -04:00
public Rom? MegaRom { get; set; }
2025-09-26 10:20:48 -04:00
2026-04-04 14:23:27 -04:00
public Original? Original { get; set; }
2025-09-26 10:20:48 -04:00
2026-04-04 14:23:27 -04:00
public Rom? Rom { get; set; }
2025-09-26 10:20:48 -04:00
2026-04-04 14:23:27 -04:00
public Rom? SCCPlusCart { get; set; }
2025-09-26 10:20:48 -04:00
#endregion
public Dump() => ItemType = ItemType.Dump;
2026-04-04 14:23:27 -04:00
/// <inheritdoc/>
public object Clone()
{
var obj = new Dump();
obj.Boot = Boot;
2026-04-04 14:23:27 -04:00
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;
if ((Boot is null) ^ (other.Boot is null))
return false;
else if (Boot is not null && !Boot.Equals(other.Boot, StringComparison.OrdinalIgnoreCase))
return false;
2026-04-04 14:23:27 -04:00
// 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;
}
2025-09-26 10:20:48 -04:00
}
}