Add DeviceReference type, cleanup TODOs

This commit is contained in:
Matt Nadareski
2020-08-31 23:01:51 -07:00
parent 22a73c318f
commit 3e9b4e510c
18 changed files with 629 additions and 442 deletions

View File

@@ -0,0 +1,77 @@
using Newtonsoft.Json;
namespace SabreTools.Library.DatItems
{
/// <summary>
/// Represents which Device Reference(s) is associated with a set
/// </summary>
[JsonObject("device_ref")]
public class DeviceReference : DatItem
{
#region Constructors
/// <summary>
/// Create a default, empty DeviceReference object
/// </summary>
public DeviceReference()
{
Name = string.Empty;
ItemType = ItemType.DeviceReference;
}
#endregion
#region Cloning Methods
public override object Clone()
{
return new DeviceReference()
{
Name = this.Name,
ItemType = this.ItemType,
DupeType = this.DupeType,
AltName = this.AltName,
AltTitle = this.AltTitle,
Original = this.Original,
OpenMSXSubType = this.OpenMSXSubType,
OpenMSXType = this.OpenMSXType,
Remark = this.Remark,
Boot = this.Boot,
Part = this.Part,
Features = this.Features,
AreaName = this.AreaName,
AreaSize = this.AreaSize,
AreaWidth = this.AreaWidth,
AreaEndianness = this.AreaEndianness,
Value = this.Value,
LoadFlag = this.LoadFlag,
Machine = this.Machine.Clone() as Machine,
Source = this.Source.Clone() as Source,
Remove = this.Remove,
};
}
#endregion
#region Comparision Methods
public override bool Equals(DatItem other)
{
// If we don't have a device reference, return false
if (ItemType != other.ItemType)
return false;
// Otherwise, treat it as a device reference
DeviceReference newOther = other as DeviceReference;
// If the device reference information matches
return (Name == newOther.Name);
}
#endregion
}
}