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

@@ -14,10 +14,7 @@ namespace SabreTools.Core
public static DictionaryBase? Clone(this DictionaryBase dictionaryBase) public static DictionaryBase? Clone(this DictionaryBase dictionaryBase)
{ {
// Create a new object of the same type // Create a new object of the same type
var clone = dictionaryBase var clone = Activator.CreateInstance(dictionaryBase.GetType()) as DictionaryBase;
.GetType()
.GetConstructor(System.Reflection.BindingFlags.Public, Array.Empty<Type>())?
.Invoke(null) as DictionaryBase;
// If construction failed, we can't do anything // If construction failed, we can't do anything
if (clone == null) if (clone == null)

View File

@@ -81,37 +81,37 @@ namespace SabreTools.Core.Tools
/// <summary> /// <summary>
/// Normalize a CRC32 string and pad to the correct size /// Normalize a CRC32 string and pad to the correct size
/// </summary> /// </summary>
public static string NormalizeCRC32(string? hash) public static string? NormalizeCRC32(string? hash)
=> NormalizeHashData(hash, Constants.CRCLength); => NormalizeHashData(hash, Constants.CRCLength);
/// <summary> /// <summary>
/// Normalize a MD5 string and pad to the correct size /// Normalize a MD5 string and pad to the correct size
/// </summary> /// </summary>
public static string NormalizeMD5(string? hash) public static string? NormalizeMD5(string? hash)
=> NormalizeHashData(hash, Constants.MD5Length); => NormalizeHashData(hash, Constants.MD5Length);
/// <summary> /// <summary>
/// Normalize a SHA1 string and pad to the correct size /// Normalize a SHA1 string and pad to the correct size
/// </summary> /// </summary>
public static string NormalizeSHA1(string? hash) public static string? NormalizeSHA1(string? hash)
=> NormalizeHashData(hash, Constants.SHA1Length); => NormalizeHashData(hash, Constants.SHA1Length);
/// <summary> /// <summary>
/// Normalize a SHA256 string and pad to the correct size /// Normalize a SHA256 string and pad to the correct size
/// </summary> /// </summary>
public static string NormalizeSHA256(string? hash) public static string? NormalizeSHA256(string? hash)
=> NormalizeHashData(hash, Constants.SHA256Length); => NormalizeHashData(hash, Constants.SHA256Length);
/// <summary> /// <summary>
/// Normalize a SHA384 string and pad to the correct size /// Normalize a SHA384 string and pad to the correct size
/// </summary> /// </summary>
public static string NormalizeSHA384(string? hash) public static string? NormalizeSHA384(string? hash)
=> NormalizeHashData(hash, Constants.SHA384Length); => NormalizeHashData(hash, Constants.SHA384Length);
/// <summary> /// <summary>
/// Normalize a SHA512 string and pad to the correct size /// Normalize a SHA512 string and pad to the correct size
/// </summary> /// </summary>
public static string NormalizeSHA512(string? hash) public static string? NormalizeSHA512(string? hash)
=> NormalizeHashData(hash, Constants.SHA512Length); => NormalizeHashData(hash, Constants.SHA512Length);
/// <summary> /// <summary>
@@ -186,10 +186,12 @@ namespace SabreTools.Core.Tools
/// <summary> /// <summary>
/// Normalize a hash string and pad to the correct size /// Normalize a hash string and pad to the correct size
/// </summary> /// </summary>
private static string NormalizeHashData(string? hash, int expectedLength) private static string? NormalizeHashData(string? hash, int expectedLength)
{ {
// If we have a known blank hash, return blank // If we have a known blank hash, return blank
if (string.IsNullOrWhiteSpace(hash) || hash == "-" || hash == "_") if (string.IsNullOrWhiteSpace(hash))
return null;
else if (hash == "-" || hash == "_")
return string.Empty; return string.Empty;
// Check to see if it's a "hex" hash // Check to see if it's a "hex" hash

View File

@@ -316,7 +316,7 @@ namespace SabreTools.DatFiles
{ {
// Initialize strings // Initialize strings
string fix, string fix,
game = item.Machine?.Name ?? string.Empty, game = item.Machine.Name ?? string.Empty,
name = item.GetName() ?? item.ItemType.ToString(), name = item.GetName() ?? item.ItemType.ToString(),
crc = string.Empty, crc = string.Empty,
md5 = string.Empty, md5 = string.Empty,
@@ -365,9 +365,9 @@ namespace SabreTools.DatFiles
.Replace("%game%", game) .Replace("%game%", game)
.Replace("%machine%", game) .Replace("%machine%", game)
.Replace("%name%", name) .Replace("%name%", name)
.Replace("%manufacturer%", item.Machine?.Manufacturer ?? string.Empty) .Replace("%manufacturer%", item.Machine.Manufacturer ?? string.Empty)
.Replace("%publisher%", item.Machine?.Publisher ?? string.Empty) .Replace("%publisher%", item.Machine.Publisher ?? string.Empty)
.Replace("%category%", item.Machine?.Category ?? string.Empty) .Replace("%category%", item.Machine.Category ?? string.Empty)
.Replace("%crc%", crc) .Replace("%crc%", crc)
.Replace("%md5%", md5) .Replace("%md5%", md5)
.Replace("%sha1%", sha1) .Replace("%sha1%", sha1)
@@ -397,7 +397,7 @@ namespace SabreTools.DatFiles
Header.UseRomName = true; Header.UseRomName = true;
// Get the name to update // Get the name to update
string? name = (Header.UseRomName ? item.GetName() : item.Machine?.Name) ?? string.Empty; string? name = (Header.UseRomName ? item.GetName() : item.Machine.Name) ?? string.Empty;
// Create the proper Prefix and Postfix // Create the proper Prefix and Postfix
string pre = CreatePrefixPostfix(item, true); string pre = CreatePrefixPostfix(item, true);
@@ -454,7 +454,7 @@ namespace SabreTools.DatFiles
name += Header.AddExtension; name += Header.AddExtension;
if (Header.UseRomName && Header.GameName) if (Header.UseRomName && Header.GameName)
name = Path.Combine(item.Machine?.Name ?? string.Empty, name); name = Path.Combine(item.Machine.Name ?? string.Empty, name);
// Now assign back the formatted name // Now assign back the formatted name
name = $"{pre}{name}{post}"; name = $"{pre}{name}{post}";
@@ -489,7 +489,7 @@ namespace SabreTools.DatFiles
// If the Rom has "null" characteristics, ensure all fields // If the Rom has "null" characteristics, ensure all fields
if (rom.Size == null && rom.CRC == "null") if (rom.Size == null && rom.CRC == "null")
{ {
logger.Verbose($"Empty folder found: {datItem.Machine?.Name}"); logger.Verbose($"Empty folder found: {datItem.Machine.Name}");
rom.Name = (rom.Name == "null" ? "-" : rom.Name); rom.Name = (rom.Name == "null" ? "-" : rom.Name);
rom.Size = Constants.SizeZero; rom.Size = Constants.SizeZero;

View File

@@ -121,23 +121,23 @@ namespace SabreTools.DatFiles.Formats
{ {
var row = new Models.AttractMode.Row var row = new Models.AttractMode.Row
{ {
Name = rom.Machine?.Name, Name = rom.Machine.Name,
Title = rom.Machine?.Description, Title = rom.Machine.Description,
Emulator = Header.FileName, Emulator = Header.FileName,
CloneOf = rom.Machine?.CloneOf, CloneOf = rom.Machine.CloneOf,
Year = rom.Machine?.Year, Year = rom.Machine.Year,
Manufacturer = rom.Machine?.Manufacturer, Manufacturer = rom.Machine.Manufacturer,
Category = rom.Machine?.Category, Category = rom.Machine.Category,
Players = rom.Machine?.Players, Players = rom.Machine.Players,
Rotation = rom.Machine?.Rotation, Rotation = rom.Machine.Rotation,
Control = rom.Machine?.Control, Control = rom.Machine.Control,
Status = rom.Machine?.Status, Status = rom.Machine.Status,
DisplayCount = rom.Machine?.DisplayCount, DisplayCount = rom.Machine.DisplayCount,
DisplayType = rom.Machine?.DisplayType, DisplayType = rom.Machine.DisplayType,
AltRomname = rom.AltName, AltRomname = rom.AltName,
AltTitle = rom.AltTitle, AltTitle = rom.AltTitle,
Extra = rom.Machine?.Comment, Extra = rom.Machine.Comment,
Buttons = rom.Machine?.Buttons, Buttons = rom.Machine.Buttons,
// TODO: Add extended fields // TODO: Add extended fields
}; };
return row; return row;

View File

@@ -139,7 +139,7 @@ namespace SabreTools.DatFiles.Formats
var row = new Models.EverdriveSMDB.Row var row = new Models.EverdriveSMDB.Row
{ {
SHA256 = rom.SHA256, SHA256 = rom.SHA256,
Name = $"{rom.Machine?.Name ?? string.Empty}/{rom.Name}", Name = $"{rom.Machine.Name ?? string.Empty}/{rom.Name}",
SHA1 = rom.SHA1, SHA1 = rom.SHA1,
MD5 = rom.MD5, MD5 = rom.MD5,
CRC32 = rom.CRC, CRC32 = rom.CRC,

View File

@@ -63,7 +63,7 @@ namespace SabreTools.DatFiles.Formats
WriteDatItem(sw, datItem, lastgame); WriteDatItem(sw, datItem, lastgame);
// Set the new data to compare against // Set the new data to compare against
lastgame = datItem.Machine?.Name; lastgame = datItem.Machine.Name;
} }
} }
@@ -94,8 +94,8 @@ namespace SabreTools.DatFiles.Formats
// Romba mode automatically uses item name // Romba mode automatically uses item name
if (Header.OutputDepot?.IsActive == true || Header.UseRomName) if (Header.OutputDepot?.IsActive == true || Header.UseRomName)
sw.Write($"{datItem.GetName() ?? string.Empty}\n"); sw.Write($"{datItem.GetName() ?? string.Empty}\n");
else if (!Header.UseRomName && datItem.Machine?.Name != lastgame) else if (!Header.UseRomName && datItem.Machine.Name != lastgame)
sw.Write($"{datItem.Machine?.Name ?? string.Empty}\n"); sw.Write($"{datItem.Machine.Name ?? string.Empty}\n");
sw.Flush(); sw.Flush();
} }

View File

@@ -183,14 +183,14 @@ namespace SabreTools.DatFiles.Formats
{ {
var rom = new Models.RomCenter.Rom var rom = new Models.RomCenter.Rom
{ {
ParentName = item.Machine?.CloneOf, ParentName = item.Machine.CloneOf,
//ParentDescription = item.Machine?.CloneOfDescription, // TODO: Add to internal model or find mapping //ParentDescription = item.Machine.CloneOfDescription, // TODO: Add to internal model or find mapping
GameName = item.Machine?.Name, GameName = item.Machine.Name,
GameDescription = item.Machine?.Description, GameDescription = item.Machine.Description,
RomName = item.Name, RomName = item.Name,
RomCRC = item.CRC, RomCRC = item.CRC,
RomSize = item.Size?.ToString(), RomSize = item.Size?.ToString(),
RomOf = item.Machine?.RomOf, RomOf = item.Machine.RomOf,
MergeName = item.MergeTag, MergeName = item.MergeTag,
}; };
return rom; return rom;

View File

@@ -395,11 +395,11 @@ namespace SabreTools.DatFiles.Formats
DatItem datItem = datItems[index]; DatItem datItem = datItems[index];
// If we have a different game and we're not at the start of the list, output the end of last item // If we have a different game and we're not at the start of the list, output the end of last item
if (lastgame != null && lastgame.ToLowerInvariant() != datItem.Machine?.Name?.ToLowerInvariant()) if (lastgame != null && lastgame.ToLowerInvariant() != datItem.Machine.Name?.ToLowerInvariant())
WriteEndGame(jtw); WriteEndGame(jtw);
// If we have a new game, output the beginning of the new item // If we have a new game, output the beginning of the new item
if (lastgame == null || lastgame.ToLowerInvariant() != datItem.Machine?.Name?.ToLowerInvariant()) if (lastgame == null || lastgame.ToLowerInvariant() != datItem.Machine.Name?.ToLowerInvariant())
WriteStartGame(jtw, datItem); WriteStartGame(jtw, datItem);
// Check for a "null" item // Check for a "null" item
@@ -410,7 +410,7 @@ namespace SabreTools.DatFiles.Formats
WriteDatItem(jtw, datItem); WriteDatItem(jtw, datItem);
// Set the new data to compare against // Set the new data to compare against
lastgame = datItem.Machine?.Name; lastgame = datItem.Machine.Name;
} }
} }
@@ -457,7 +457,7 @@ namespace SabreTools.DatFiles.Formats
private void WriteStartGame(JsonTextWriter jtw, DatItem datItem) private void WriteStartGame(JsonTextWriter jtw, DatItem datItem)
{ {
// No game should start with a path separator // No game should start with a path separator
if (!string.IsNullOrWhiteSpace(datItem.Machine?.Name)) if (!string.IsNullOrWhiteSpace(datItem.Machine.Name))
datItem.Machine.Name = datItem.Machine.Name.TrimStart(Path.DirectorySeparatorChar) ?? string.Empty; datItem.Machine.Name = datItem.Machine.Name.TrimStart(Path.DirectorySeparatorChar) ?? string.Empty;
// Build the state // Build the state

View File

@@ -223,11 +223,11 @@ namespace SabreTools.DatFiles.Formats
DatItem datItem = datItems[index]; DatItem datItem = datItems[index];
// If we have a different game and we're not at the start of the list, output the end of last item // If we have a different game and we're not at the start of the list, output the end of last item
if (lastgame != null && lastgame.ToLowerInvariant() != datItem.Machine?.Name?.ToLowerInvariant()) if (lastgame != null && lastgame.ToLowerInvariant() != datItem.Machine.Name?.ToLowerInvariant())
WriteEndGame(xtw); WriteEndGame(xtw);
// If we have a new game, output the beginning of the new item // If we have a new game, output the beginning of the new item
if (lastgame == null || lastgame.ToLowerInvariant() != datItem.Machine?.Name?.ToLowerInvariant()) if (lastgame == null || lastgame.ToLowerInvariant() != datItem.Machine.Name?.ToLowerInvariant())
WriteStartGame(xtw, datItem); WriteStartGame(xtw, datItem);
// Check for a "null" item // Check for a "null" item
@@ -238,7 +238,7 @@ namespace SabreTools.DatFiles.Formats
WriteDatItem(xtw, datItem); WriteDatItem(xtw, datItem);
// Set the new data to compare against // Set the new data to compare against
lastgame = datItem.Machine?.Name; lastgame = datItem.Machine.Name;
} }
} }

View File

@@ -162,8 +162,8 @@ namespace SabreTools.DatFiles.Formats
FileName = Header.FileName, FileName = Header.FileName,
InternalName = Header.Name, InternalName = Header.Name,
Description = Header.Description, Description = Header.Description,
GameName = disk.Machine?.Name, GameName = disk.Machine.Name,
GameDescription = disk.Machine?.Description, GameDescription = disk.Machine.Description,
Type = disk.ItemType.FromItemType(), Type = disk.ItemType.FromItemType(),
RomName = string.Empty, RomName = string.Empty,
DiskName = disk.Name, DiskName = disk.Name,
@@ -190,8 +190,8 @@ namespace SabreTools.DatFiles.Formats
FileName = Header.FileName, FileName = Header.FileName,
InternalName = Header.Name, InternalName = Header.Name,
Description = Header.Description, Description = Header.Description,
GameName = media.Machine?.Name, GameName = media.Machine.Name,
GameDescription = media.Machine?.Description, GameDescription = media.Machine.Description,
Type = media.ItemType.FromItemType(), Type = media.ItemType.FromItemType(),
RomName = string.Empty, RomName = string.Empty,
DiskName = media.Name, DiskName = media.Name,
@@ -218,8 +218,8 @@ namespace SabreTools.DatFiles.Formats
FileName = Header.FileName, FileName = Header.FileName,
InternalName = Header.Name, InternalName = Header.Name,
Description = Header.Description, Description = Header.Description,
GameName = rom.Machine?.Name, GameName = rom.Machine.Name,
GameDescription = rom.Machine?.Description, GameDescription = rom.Machine.Description,
Type = rom.ItemType.FromItemType(), Type = rom.ItemType.FromItemType(),
RomName = rom.Name, RomName = rom.Name,
DiskName = string.Empty, DiskName = string.Empty,

View File

@@ -728,7 +728,7 @@ namespace SabreTools.DatFiles
// Filter the list // Filter the list
return fi.Where(i => i != null) return fi.Where(i => i != null)
.Where(i => !i.Remove) .Where(i => !i.Remove)
.Where(i => i.Machine?.Name != null) .Where(i => i.Machine.Name != null)
.ToConcurrentList(); .ToConcurrentList();
} }
} }

View File

@@ -869,7 +869,7 @@ namespace SabreTools.DatFiles
// Filter the list // Filter the list
return fi.Where(i => i != null) return fi.Where(i => i != null)
.Where(i => !i.Remove) .Where(i => !i.Remove)
.Where(i => i.Machine?.Name != null) .Where(i => i.Machine.Name != null)
.ToConcurrentList(); .ToConcurrentList();
} }
} }

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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