Fix issues found during testing

This commit is contained in:
Matt Nadareski
2023-08-15 01:38:01 -04:00
parent 3d99cf828f
commit ede4487cf0
56 changed files with 203 additions and 116 deletions

View File

@@ -102,7 +102,7 @@ namespace SabreTools.DatItems
/// </summary>
/// <remarks>Hack on top of internal model</remarks>
[JsonIgnore, XmlIgnore]
public Machine? Machine
public Machine Machine
{
get => _internal.Read<Machine>("MACHINE") ?? new Machine();
set => _internal["MACHINE"] = value;
@@ -180,6 +180,8 @@ namespace SabreTools.DatItems
public DatItem()
{
_internal = new Models.Internal.Blank();
Machine = new Machine();
logger = new Logger(this);
}
@@ -277,7 +279,9 @@ namespace SabreTools.DatItems
if (item?.Machine == null)
return;
Machine = item.Machine.Clone() as Machine;
var cloned = item.Machine.Clone() as Machine;
if (cloned != null)
Machine = cloned;
}
/// <summary>
@@ -289,7 +293,9 @@ namespace SabreTools.DatItems
if (machine == null)
return;
Machine = machine.Clone() as Machine;
var cloned = machine.Clone() as Machine;
if (cloned != null)
Machine = cloned;
}
#endregion
@@ -343,7 +349,7 @@ namespace SabreTools.DatItems
// If the duplicate is external already or should be, set it
if (lastItem.DupeType.HasFlag(DupeType.External) || lastItem?.Source?.Index != Source?.Index)
{
if (lastItem?.Machine?.Name == Machine?.Name && lastItem?.GetName() == GetName())
if (lastItem?.Machine.Name == Machine?.Name && lastItem?.GetName() == GetName())
output = DupeType.External | DupeType.All;
else
output = DupeType.External | DupeType.Hash;
@@ -352,7 +358,7 @@ namespace SabreTools.DatItems
// Otherwise, it's considered an internal dupe
else
{
if (lastItem?.Machine?.Name == Machine?.Name && lastItem?.GetName() == GetName())
if (lastItem?.Machine.Name == Machine?.Name && lastItem?.GetName() == GetName())
output = DupeType.Internal | DupeType.All;
else
output = DupeType.Internal | DupeType.Hash;
@@ -526,7 +532,7 @@ namespace SabreTools.DatItems
}
// If the current machine is a child of the new machine, use the new machine instead
if (saveditem.Machine?.CloneOf == file.Machine?.Name || saveditem.Machine?.RomOf == file.Machine?.Name)
if (saveditem.Machine.CloneOf == file.Machine.Name || saveditem.Machine.RomOf == file.Machine.Name)
{
saveditem.CopyMachineInformation(file);
saveditem.SetName(file.GetName());
@@ -673,7 +679,7 @@ namespace SabreTools.DatItems
NaturalComparer nc = new();
// If machine names match, more refinement is needed
if (x.Machine?.Name == y.Machine?.Name)
if (x.Machine.Name == y.Machine.Name)
{
// If item types match, more refinement is needed
if (x.ItemType == y.ItemType)
@@ -689,7 +695,7 @@ namespace SabreTools.DatItems
// If item names match, then compare on machine or source, depending on the flag
if (xName == yName)
return (norename ? nc.Compare(x.Machine?.Name, y.Machine?.Name) : (x.Source?.Index - y.Source?.Index) ?? 0);
return (norename ? nc.Compare(x.Machine.Name, y.Machine.Name) : (x.Source?.Index - y.Source?.Index) ?? 0);
// Otherwise, just sort based on item names
return nc.Compare(xName, yName);
@@ -704,7 +710,7 @@ namespace SabreTools.DatItems
}
// Otherwise, just sort based on machine name
return nc.Compare(x.Machine?.Name, y.Machine?.Name);
return nc.Compare(x.Machine.Name, y.Machine.Name);
}
catch
{

View File

@@ -70,6 +70,8 @@ namespace SabreTools.DatItems.Formats
public Adjuster()
{
_internal = new Models.Internal.Adjuster();
Machine = new Machine();
Name = string.Empty;
ItemType = ItemType.Adjuster;
}
@@ -86,7 +88,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -32,6 +32,8 @@ namespace SabreTools.DatItems.Formats
public Analog()
{
_internal = new Models.Internal.Analog();
Machine = new Machine();
ItemType = ItemType.Analog;
}
@@ -47,7 +49,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -107,6 +107,8 @@ namespace SabreTools.DatItems.Formats
public Archive()
{
_internal = new Models.Internal.Archive();
Machine = new Machine();
Name = string.Empty;
ItemType = ItemType.Archive;
}
@@ -123,7 +125,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -65,6 +65,8 @@ namespace SabreTools.DatItems.Formats
public BiosSet()
{
_internal = new Models.Internal.BiosSet();
Machine = new Machine();
Name = string.Empty;
ItemType = ItemType.BiosSet;
}
@@ -81,7 +83,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -32,7 +32,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,
};

View File

@@ -81,6 +81,8 @@ namespace SabreTools.DatItems.Formats
public Chip()
{
_internal = new Models.Internal.Chip();
Machine = new Machine();
Name = string.Empty;
ItemType = ItemType.Chip;
}
@@ -97,7 +99,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -68,6 +68,8 @@ namespace SabreTools.DatItems.Formats
public Condition()
{
_internal = new Models.Internal.Condition();
Machine = new Machine();
ItemType = ItemType.Condition;
}
@@ -83,7 +85,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -68,6 +68,8 @@ namespace SabreTools.DatItems.Formats
public ConfLocation()
{
_internal = new Models.Internal.ConfLocation();
Machine = new Machine();
Name = string.Empty;
ItemType = ItemType.ConfLocation;
}
@@ -84,7 +86,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -80,6 +80,8 @@ namespace SabreTools.DatItems.Formats
public ConfSetting()
{
_internal = new Models.Internal.ConfSetting();
Machine = new Machine();
Name = string.Empty;
ItemType = ItemType.ConfSetting;
}
@@ -96,7 +98,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -103,6 +103,8 @@ namespace SabreTools.DatItems.Formats
public Configuration()
{
_internal = new Models.Internal.Configuration();
Machine = new Machine();
Name = string.Empty;
ItemType = ItemType.Configuration;
}
@@ -119,7 +121,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -172,6 +172,8 @@ namespace SabreTools.DatItems.Formats
public Control()
{
_internal = new Models.Internal.Control();
Machine = new Machine();
ItemType = ItemType.Control;
}
@@ -187,7 +189,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -83,6 +83,8 @@ namespace SabreTools.DatItems.Formats
public DataArea()
{
_internal = new Models.Internal.DataArea();
Machine = new Machine();
Name = string.Empty;
ItemType = ItemType.DataArea;
}
@@ -99,7 +101,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -110,6 +110,8 @@ namespace SabreTools.DatItems.Formats
public Device()
{
_internal = new Models.Internal.Device();
Machine = new Machine();
ItemType = ItemType.Device;
}
@@ -125,7 +127,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -42,6 +42,8 @@ namespace SabreTools.DatItems.Formats
public DeviceReference()
{
_internal = new Models.Internal.DeviceRef();
Machine = new Machine();
Name = string.Empty;
ItemType = ItemType.DeviceReference;
}
@@ -58,7 +60,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -68,6 +68,8 @@ namespace SabreTools.DatItems.Formats
public DipLocation()
{
_internal = new Models.Internal.DipLocation();
Machine = new Machine();
Name = string.Empty;
ItemType = ItemType.DipLocation;
}
@@ -84,7 +86,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -129,6 +129,8 @@ namespace SabreTools.DatItems.Formats
public DipSwitch()
{
_internal = new Models.Internal.DipSwitch();
Machine = new Machine();
Name = string.Empty;
ItemType = ItemType.DipSwitch;
}
@@ -145,7 +147,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -80,6 +80,8 @@ namespace SabreTools.DatItems.Formats
public DipValue()
{
_internal = new Models.Internal.DipValue();
Machine = new Machine();
Name = string.Empty;
ItemType = ItemType.DipValue;
}
@@ -96,7 +98,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -186,6 +186,8 @@ namespace SabreTools.DatItems.Formats
public Disk()
{
_internal = new Models.Internal.Disk();
Machine = new Machine();
Name = string.Empty;
ItemType = ItemType.Disk;
DupeType = 0x00;
@@ -198,6 +200,8 @@ namespace SabreTools.DatItems.Formats
public Disk(BaseFile baseFile)
{
_internal = new Models.Internal.Disk();
Machine = new Machine();
Name = baseFile.Filename;
MD5 = TextHelper.ByteArrayToString(baseFile.MD5);
SHA1 = TextHelper.ByteArrayToString(baseFile.SHA1);
@@ -219,7 +223,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,
@@ -235,7 +239,7 @@ namespace SabreTools.DatItems.Formats
return new BaseFile()
{
Filename = this.Name,
Parent = this.Machine?.Name,
Parent = this.Machine.Name,
MD5 = TextHelper.StringToByteArray(this.MD5),
SHA1 = TextHelper.StringToByteArray(this.SHA1),
};
@@ -252,7 +256,7 @@ namespace SabreTools.DatItems.Formats
ItemType = ItemType.Rom,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -43,6 +43,8 @@ namespace SabreTools.DatItems.Formats
public DiskArea()
{
_internal = new Models.Internal.DiskArea();
Machine = new Machine();
Name = string.Empty;
ItemType = ItemType.DiskArea;
}
@@ -59,7 +61,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -204,6 +204,8 @@ namespace SabreTools.DatItems.Formats
public Display()
{
_internal = new Models.Internal.Display();
Machine = new Machine();
ItemType = ItemType.Display;
}
@@ -219,7 +221,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -135,6 +135,8 @@ namespace SabreTools.DatItems.Formats
public Driver()
{
_internal = new Models.Internal.Driver();
Machine = new Machine();
ItemType = ItemType.Driver;
}
@@ -150,7 +152,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -42,6 +42,8 @@ namespace SabreTools.DatItems.Formats
public Extension()
{
_internal = new Models.Internal.Extension();
Machine = new Machine();
Name = string.Empty;
ItemType = ItemType.Extension;
}
@@ -58,7 +60,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -66,6 +66,8 @@ namespace SabreTools.DatItems.Formats
public Feature()
{
_internal = new Models.Internal.Feature();
Machine = new Machine();
ItemType = ItemType.Feature;
}
@@ -81,7 +83,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -132,7 +132,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,
@@ -154,7 +154,7 @@ namespace SabreTools.DatItems.Formats
{
return new BaseFile()
{
Parent = this.Machine?.Name,
Parent = this.Machine.Name,
CRC = this._crc,
MD5 = this._md5,
SHA1 = this._sha1,
@@ -174,7 +174,7 @@ namespace SabreTools.DatItems.Formats
ItemType = ItemType.Rom,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -52,6 +52,8 @@ namespace SabreTools.DatItems.Formats
public Info()
{
_internal = new Models.Internal.Info();
Machine = new Machine();
Name = string.Empty;
ItemType = ItemType.Info;
}
@@ -68,7 +70,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -89,6 +89,8 @@ namespace SabreTools.DatItems.Formats
public Input()
{
_internal = new Models.Internal.Input();
Machine = new Machine();
ItemType = ItemType.Input;
}
@@ -104,7 +106,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -52,6 +52,8 @@ namespace SabreTools.DatItems.Formats
public Instance()
{
_internal = new Models.Internal.Instance();
Machine = new Machine();
Name = string.Empty;
ItemType = ItemType.Instance;
}
@@ -68,7 +70,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -85,6 +85,8 @@ namespace SabreTools.DatItems.Formats
public Media()
{
_internal = new Models.Internal.Media();
Machine = new Machine();
Name = string.Empty;
ItemType = ItemType.Media;
DupeType = 0x00;
@@ -97,6 +99,8 @@ namespace SabreTools.DatItems.Formats
public Media(BaseFile baseFile)
{
_internal = new Models.Internal.Media();
Machine = new Machine();
Name = baseFile.Filename;
MD5 = TextHelper.ByteArrayToString(baseFile.MD5);
SHA1 = TextHelper.ByteArrayToString(baseFile.SHA1);
@@ -119,7 +123,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,
@@ -135,7 +139,7 @@ namespace SabreTools.DatItems.Formats
return new BaseFile()
{
Filename = this.Name,
Parent = this.Machine?.Name,
Parent = this.Machine.Name,
MD5 = TextHelper.StringToByteArray(this.MD5),
SHA1 = TextHelper.StringToByteArray(this.SHA1),
SHA256 = TextHelper.StringToByteArray(this.SHA256),
@@ -154,7 +158,7 @@ namespace SabreTools.DatItems.Formats
ItemType = ItemType.Rom,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,
};

View File

@@ -59,6 +59,8 @@ namespace SabreTools.DatItems.Formats
public Part()
{
_internal = new Models.Internal.Part();
Machine = new Machine();
Name = string.Empty;
ItemType = ItemType.Part;
}
@@ -75,7 +77,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -52,6 +52,8 @@ namespace SabreTools.DatItems.Formats
public PartFeature()
{
_internal = new Models.Internal.Feature();
Machine = new Machine();
Name = string.Empty;
ItemType = ItemType.PartFeature;
}
@@ -68,7 +70,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -47,6 +47,8 @@ namespace SabreTools.DatItems.Formats
public Port()
{
_internal = new Models.Internal.Port();
Machine = new Machine();
ItemType = ItemType.Port;
}
@@ -62,7 +64,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -65,6 +65,8 @@ namespace SabreTools.DatItems.Formats
public RamOption()
{
_internal = new Models.Internal.RamOption();
Machine = new Machine();
Name = string.Empty;
ItemType = ItemType.RamOption;
}
@@ -81,7 +83,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -85,6 +85,8 @@ namespace SabreTools.DatItems.Formats
public Release()
{
_internal = new Models.Internal.Release();
Machine = new Machine();
Name = string.Empty;
ItemType = ItemType.Release;
Region = string.Empty;
@@ -105,7 +107,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -131,7 +131,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -459,6 +459,8 @@ namespace SabreTools.DatItems.Formats
public Rom()
{
_internal = new Models.Internal.Rom();
Machine = new Machine();
Name = null;
ItemType = ItemType.Rom;
DupeType = 0x00;
@@ -493,6 +495,8 @@ namespace SabreTools.DatItems.Formats
public Rom(BaseFile baseFile)
{
_internal = new Models.Internal.Rom();
Machine = new Machine();
Name = baseFile.Filename;
Size = baseFile.Size;
CRC = TextHelper.ByteArrayToString(baseFile.CRC);
@@ -534,7 +538,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,
@@ -550,7 +554,7 @@ namespace SabreTools.DatItems.Formats
return new BaseFile()
{
Filename = this.Name,
Parent = this.Machine?.Name,
Parent = this.Machine.Name,
Date = this.Date,
Size = this.Size,
CRC = TextHelper.StringToByteArray(this.CRC),

View File

@@ -42,6 +42,8 @@ namespace SabreTools.DatItems.Formats
public Sample()
{
_internal = new Models.Internal.Sample();
Machine = new Machine();
Name = string.Empty;
ItemType = ItemType.Sample;
}
@@ -58,7 +60,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -121,7 +121,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -52,6 +52,8 @@ namespace SabreTools.DatItems.Formats
public SharedFeature()
{
_internal = new Models.Internal.SharedFeat();
Machine = new Machine();
Name = string.Empty;
ItemType = ItemType.SharedFeature;
}
@@ -68,7 +70,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -57,6 +57,8 @@ namespace SabreTools.DatItems.Formats
public Slot()
{
_internal = new Models.Internal.Slot();
Machine = new Machine();
Name = string.Empty;
ItemType = ItemType.Slot;
}
@@ -73,7 +75,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -65,6 +65,8 @@ namespace SabreTools.DatItems.Formats
public SlotOption()
{
_internal = new Models.Internal.SlotOption();
Machine = new Machine();
Name = string.Empty;
ItemType = ItemType.SlotOption;
}
@@ -81,7 +83,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -85,6 +85,8 @@ namespace SabreTools.DatItems.Formats
public SoftwareList()
{
_internal = new Models.Internal.SoftwareList();
Machine = new Machine();
Name = string.Empty;
ItemType = ItemType.SoftwareList;
}
@@ -100,7 +102,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -35,6 +35,8 @@ namespace SabreTools.DatItems.Formats
public Sound()
{
_internal = new Models.Internal.Sound();
Machine = new Machine();
ItemType = ItemType.Sound;
}
@@ -50,7 +52,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,

View File

@@ -158,7 +158,7 @@ namespace SabreTools.DatItems.Formats
ItemType = this.ItemType,
DupeType = this.DupeType,
Machine = this.Machine?.Clone() as Machine,
Machine = this.Machine.Clone() as Machine ?? new Machine(),
Source = this.Source?.Clone() as Source,
Remove = this.Remove,