[ALL] DatItem/Machine cleanup and descriptions

This commit is contained in:
Matt Nadareski
2019-01-08 12:11:55 -08:00
parent 9e3df30b90
commit 1768370199
29 changed files with 1402 additions and 1254 deletions

View File

@@ -296,7 +296,7 @@ namespace RombaSharp
{ {
Globals.Logger.Verbose("Checking and adding file '{0}'", datItem.Name); Globals.Logger.Verbose("Checking and adding file '{0}'", datItem.Name);
if (datItem.Type == ItemType.Rom) if (datItem.ItemType == ItemType.Rom)
{ {
Rom rom = (Rom)datItem; Rom rom = (Rom)datItem;
@@ -322,7 +322,7 @@ namespace RombaSharp
} }
} }
} }
else if (datItem.Type == ItemType.Disk) else if (datItem.ItemType == ItemType.Disk)
{ {
Disk disk = (Disk)datItem; Disk disk = (Disk)datItem;

View File

@@ -165,7 +165,7 @@ namespace SabreTools.Library.DatFiles
} }
// If we have a "null" game (created by DATFromDir or something similar), log it to file // If we have a "null" game (created by DATFromDir or something similar), log it to file
if (item.Type == ItemType.Rom if (item.ItemType == ItemType.Rom
&& ((Rom)item).Size == -1 && ((Rom)item).Size == -1
&& ((Rom)item).CRC == "null") && ((Rom)item).CRC == "null")
{ {

View File

@@ -433,11 +433,11 @@ namespace SabreTools.Library.DatFiles
case "nodump": case "nodump":
case "verified": case "verified":
ItemStatus tempStandaloneStatus = Utilities.GetItemStatus(quoteless); ItemStatus tempStandaloneStatus = Utilities.GetItemStatus(quoteless);
if (item.Type == ItemType.Rom) if (item.ItemType == ItemType.Rom)
{ {
((Rom)item).ItemStatus = tempStandaloneStatus; ((Rom)item).ItemStatus = tempStandaloneStatus;
} }
else if (item.Type == ItemType.Disk) else if (item.ItemType == ItemType.Disk)
{ {
((Disk)item).ItemStatus = tempStandaloneStatus; ((Disk)item).ItemStatus = tempStandaloneStatus;
} }
@@ -449,7 +449,7 @@ namespace SabreTools.Library.DatFiles
item.Name = quoteless; item.Name = quoteless;
break; break;
case "size": case "size":
if (item.Type == ItemType.Rom) if (item.ItemType == ItemType.Rom)
{ {
quoteless = linegc[++i].Replace("\"", ""); quoteless = linegc[++i].Replace("\"", "");
if (Int64.TryParse(quoteless, out long size)) if (Int64.TryParse(quoteless, out long size))
@@ -463,19 +463,19 @@ namespace SabreTools.Library.DatFiles
} }
break; break;
case "crc": case "crc":
if (item.Type == ItemType.Rom) if (item.ItemType == ItemType.Rom)
{ {
quoteless = linegc[++i].Replace("\"", ""); quoteless = linegc[++i].Replace("\"", "");
((Rom)item).CRC = Utilities.CleanHashData(quoteless, Constants.CRCLength); ((Rom)item).CRC = Utilities.CleanHashData(quoteless, Constants.CRCLength);
} }
break; break;
case "md5": case "md5":
if (item.Type == ItemType.Rom) if (item.ItemType == ItemType.Rom)
{ {
quoteless = linegc[++i].Replace("\"", ""); quoteless = linegc[++i].Replace("\"", "");
((Rom)item).MD5 = Utilities.CleanHashData(quoteless, Constants.MD5Length); ((Rom)item).MD5 = Utilities.CleanHashData(quoteless, Constants.MD5Length);
} }
else if (item.Type == ItemType.Disk) else if (item.ItemType == ItemType.Disk)
{ {
i++; i++;
quoteless = linegc[i].Replace("\"", ""); quoteless = linegc[i].Replace("\"", "");
@@ -483,48 +483,48 @@ namespace SabreTools.Library.DatFiles
} }
break; break;
case "sha1": case "sha1":
if (item.Type == ItemType.Rom) if (item.ItemType == ItemType.Rom)
{ {
quoteless = linegc[++i].Replace("\"", ""); quoteless = linegc[++i].Replace("\"", "");
((Rom)item).SHA1 = Utilities.CleanHashData(quoteless, Constants.SHA1Length); ((Rom)item).SHA1 = Utilities.CleanHashData(quoteless, Constants.SHA1Length);
} }
else if (item.Type == ItemType.Disk) else if (item.ItemType == ItemType.Disk)
{ {
quoteless = linegc[++i].Replace("\"", ""); quoteless = linegc[++i].Replace("\"", "");
((Disk)item).SHA1 = Utilities.CleanHashData(quoteless, Constants.SHA1Length); ((Disk)item).SHA1 = Utilities.CleanHashData(quoteless, Constants.SHA1Length);
} }
break; break;
case "sha256": case "sha256":
if (item.Type == ItemType.Rom) if (item.ItemType == ItemType.Rom)
{ {
quoteless = linegc[++i].Replace("\"", ""); quoteless = linegc[++i].Replace("\"", "");
((Rom)item).SHA256 = Utilities.CleanHashData(quoteless, Constants.SHA256Length); ((Rom)item).SHA256 = Utilities.CleanHashData(quoteless, Constants.SHA256Length);
} }
else if (item.Type == ItemType.Disk) else if (item.ItemType == ItemType.Disk)
{ {
quoteless = linegc[++i].Replace("\"", ""); quoteless = linegc[++i].Replace("\"", "");
((Disk)item).SHA256 = Utilities.CleanHashData(quoteless, Constants.SHA256Length); ((Disk)item).SHA256 = Utilities.CleanHashData(quoteless, Constants.SHA256Length);
} }
break; break;
case "sha384": case "sha384":
if (item.Type == ItemType.Rom) if (item.ItemType == ItemType.Rom)
{ {
quoteless = linegc[++i].Replace("\"", ""); quoteless = linegc[++i].Replace("\"", "");
((Rom)item).SHA384 = Utilities.CleanHashData(quoteless, Constants.SHA384Length); ((Rom)item).SHA384 = Utilities.CleanHashData(quoteless, Constants.SHA384Length);
} }
else if (item.Type == ItemType.Disk) else if (item.ItemType == ItemType.Disk)
{ {
quoteless = linegc[++i].Replace("\"", ""); quoteless = linegc[++i].Replace("\"", "");
((Disk)item).SHA384 = Utilities.CleanHashData(quoteless, Constants.SHA384Length); ((Disk)item).SHA384 = Utilities.CleanHashData(quoteless, Constants.SHA384Length);
} }
break; break;
case "sha512": case "sha512":
if (item.Type == ItemType.Rom) if (item.ItemType == ItemType.Rom)
{ {
quoteless = linegc[++i].Replace("\"", ""); quoteless = linegc[++i].Replace("\"", "");
((Rom)item).SHA512 = Utilities.CleanHashData(quoteless, Constants.SHA512Length); ((Rom)item).SHA512 = Utilities.CleanHashData(quoteless, Constants.SHA512Length);
} }
else if (item.Type == ItemType.Disk) else if (item.ItemType == ItemType.Disk)
{ {
quoteless = linegc[++i].Replace("\"", ""); quoteless = linegc[++i].Replace("\"", "");
((Disk)item).SHA512 = Utilities.CleanHashData(quoteless, Constants.SHA512Length); ((Disk)item).SHA512 = Utilities.CleanHashData(quoteless, Constants.SHA512Length);
@@ -534,17 +534,17 @@ namespace SabreTools.Library.DatFiles
case "flags": case "flags":
quoteless = linegc[++i].Replace("\"", ""); quoteless = linegc[++i].Replace("\"", "");
ItemStatus tempFlagStatus = Utilities.GetItemStatus(quoteless); ItemStatus tempFlagStatus = Utilities.GetItemStatus(quoteless);
if (item.Type == ItemType.Rom) if (item.ItemType == ItemType.Rom)
{ {
((Rom)item).ItemStatus = tempFlagStatus; ((Rom)item).ItemStatus = tempFlagStatus;
} }
else if (item.Type == ItemType.Disk) else if (item.ItemType == ItemType.Disk)
{ {
((Disk)item).ItemStatus = tempFlagStatus; ((Disk)item).ItemStatus = tempFlagStatus;
} }
break; break;
case "date": case "date":
if (item.Type == ItemType.Rom) if (item.ItemType == ItemType.Rom)
{ {
// If we have quotes in the next item, assume only one item // If we have quotes in the next item, assume only one item
if (linegc[i + 1].Contains("\"")) if (linegc[i + 1].Contains("\""))
@@ -558,7 +558,7 @@ namespace SabreTools.Library.DatFiles
} }
((Rom)item).Date = quoteless; ((Rom)item).Date = quoteless;
} }
else if (item.Type == ItemType.Release) else if (item.ItemType == ItemType.Release)
{ {
// If we have quotes in the next item, assume only one item // If we have quotes in the next item, assume only one item
if (linegc[i + 1].Contains("\"")) if (linegc[i + 1].Contains("\""))
@@ -574,33 +574,33 @@ namespace SabreTools.Library.DatFiles
} }
break; break;
case "default": case "default":
if (item.Type == ItemType.BiosSet) if (item.ItemType == ItemType.BiosSet)
{ {
quoteless = linegc[++i].Replace("\"", ""); quoteless = linegc[++i].Replace("\"", "");
((BiosSet)item).Default = Utilities.GetYesNo(quoteless.ToLowerInvariant()); ((BiosSet)item).Default = Utilities.GetYesNo(quoteless.ToLowerInvariant());
} }
else if (item.Type == ItemType.Release) else if (item.ItemType == ItemType.Release)
{ {
quoteless = linegc[++i].Replace("\"", ""); quoteless = linegc[++i].Replace("\"", "");
((Release)item).Default = Utilities.GetYesNo(quoteless.ToLowerInvariant()); ((Release)item).Default = Utilities.GetYesNo(quoteless.ToLowerInvariant());
} }
break; break;
case "description": case "description":
if (item.Type == ItemType.BiosSet) if (item.ItemType == ItemType.BiosSet)
{ {
quoteless = linegc[++i].Replace("\"", ""); quoteless = linegc[++i].Replace("\"", "");
((BiosSet)item).Description = quoteless.ToLowerInvariant(); ((BiosSet)item).Description = quoteless.ToLowerInvariant();
} }
break; break;
case "region": case "region":
if (item.Type == ItemType.Release) if (item.ItemType == ItemType.Release)
{ {
quoteless = linegc[++i].Replace("\"", ""); quoteless = linegc[++i].Replace("\"", "");
((Release)item).Region = quoteless.ToLowerInvariant(); ((Release)item).Region = quoteless.ToLowerInvariant();
} }
break; break;
case "language": case "language":
if (item.Type == ItemType.Release) if (item.ItemType == ItemType.Release)
{ {
quoteless = linegc[++i].Replace("\"", ""); quoteless = linegc[++i].Replace("\"", "");
((Release)item).Language = quoteless.ToLowerInvariant(); ((Release)item).Language = quoteless.ToLowerInvariant();
@@ -728,7 +728,7 @@ namespace SabreTools.Library.DatFiles
} }
// If we have a "null" game (created by DATFromDir or something similar), log it to file // If we have a "null" game (created by DATFromDir or something similar), log it to file
if (rom.Type == ItemType.Rom if (rom.ItemType == ItemType.Rom
&& ((Rom)rom).Size == -1 && ((Rom)rom).Size == -1
&& ((Rom)rom).CRC == "null") && ((Rom)rom).CRC == "null")
{ {
@@ -882,7 +882,7 @@ namespace SabreTools.Library.DatFiles
{ {
// If we are in ignore blanks mode AND we have a blank (0-size) rom, skip // If we are in ignore blanks mode AND we have a blank (0-size) rom, skip
if (ignoreblanks if (ignoreblanks
&& (rom.Type == ItemType.Rom && (rom.ItemType == ItemType.Rom
&& (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1))) && (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1)))
{ {
return true; return true;
@@ -895,7 +895,7 @@ namespace SabreTools.Library.DatFiles
// Pre-process the item name // Pre-process the item name
ProcessItemName(rom, true); ProcessItemName(rom, true);
switch (rom.Type) switch (rom.ItemType)
{ {
case ItemType.Archive: case ItemType.Archive:
state += "\tarchive ( name\"" + (!ExcludeFields[(int)Field.Name] ? rom.Name : "") + "\"" state += "\tarchive ( name\"" + (!ExcludeFields[(int)Field.Name] ? rom.Name : "") + "\""

View File

@@ -1671,7 +1671,7 @@ namespace SabreTools.Library.DatFiles
foreach (DatItem datItem in datItems) foreach (DatItem datItem in datItems)
{ {
// If we have something other than a Rom or Disk, then this doesn't do anything // If we have something other than a Rom or Disk, then this doesn't do anything
if (datItem.Type != ItemType.Disk && datItem.Type != ItemType.Rom) if (datItem.ItemType != ItemType.Disk && datItem.ItemType != ItemType.Rom)
{ {
newDatItems.Add((DatItem)datItem.Clone()); newDatItems.Add((DatItem)datItem.Clone());
continue; continue;
@@ -1691,7 +1691,7 @@ namespace SabreTools.Library.DatFiles
// If we're updating hashes, only replace if the current item doesn't have them // If we're updating hashes, only replace if the current item doesn't have them
if ((replaceMode & ReplaceMode.Hash) != 0) if ((replaceMode & ReplaceMode.Hash) != 0)
{ {
if (newDatItem.Type == ItemType.Rom) if (newDatItem.ItemType == ItemType.Rom)
{ {
Rom newRomItem = (Rom)newDatItem; Rom newRomItem = (Rom)newDatItem;
if (String.IsNullOrEmpty(newRomItem.CRC) && !String.IsNullOrEmpty(((Rom)dupes[0]).CRC)) if (String.IsNullOrEmpty(newRomItem.CRC) && !String.IsNullOrEmpty(((Rom)dupes[0]).CRC))
@@ -1721,7 +1721,7 @@ namespace SabreTools.Library.DatFiles
newDatItem = (Rom)newRomItem.Clone(); newDatItem = (Rom)newRomItem.Clone();
} }
else if (newDatItem.Type == ItemType.Disk) else if (newDatItem.ItemType == ItemType.Disk)
{ {
Disk newDiskItem = (Disk)newDatItem; Disk newDiskItem = (Disk)newDatItem;
if (String.IsNullOrEmpty(newDiskItem.MD5) && !String.IsNullOrEmpty(((Disk)dupes[0]).MD5)) if (String.IsNullOrEmpty(newDiskItem.MD5) && !String.IsNullOrEmpty(((Disk)dupes[0]).MD5))
@@ -2072,7 +2072,7 @@ namespace SabreTools.Library.DatFiles
// No duplicates // No duplicates
if ((diff & UpdateMode.DiffNoDupesOnly) != 0 || (diff & UpdateMode.DiffIndividualsOnly) != 0) if ((diff & UpdateMode.DiffNoDupesOnly) != 0 || (diff & UpdateMode.DiffIndividualsOnly) != 0)
{ {
if ((item.Dupe & DupeType.Internal) != 0 || item.Dupe == 0x00) if ((item.DupeType & DupeType.Internal) != 0 || item.DupeType == 0x00)
{ {
// Individual DATs that are output // Individual DATs that are output
if ((diff & UpdateMode.DiffIndividualsOnly) != 0) if ((diff & UpdateMode.DiffIndividualsOnly) != 0)
@@ -2094,7 +2094,7 @@ namespace SabreTools.Library.DatFiles
// Duplicates only // Duplicates only
if ((diff & UpdateMode.DiffDupesOnly) != 0) if ((diff & UpdateMode.DiffDupesOnly) != 0)
{ {
if ((item.Dupe & DupeType.External) != 0) if ((item.DupeType & DupeType.External) != 0)
{ {
DatItem newrom = item.Clone() as DatItem; DatItem newrom = item.Clone() as DatItem;
newrom.MachineName += " (" + Path.GetFileNameWithoutExtension(inputs[item.SystemID].Split('¬')[0]) + ")"; newrom.MachineName += " (" + Path.GetFileNameWithoutExtension(inputs[item.SystemID].Split('¬')[0]) + ")";
@@ -2786,14 +2786,14 @@ namespace SabreTools.Library.DatFiles
foreach (DatItem item in items) foreach (DatItem item in items)
{ {
// If the disk doesn't have a valid merge tag OR the merged file doesn't exist in the parent, then add it // If the disk doesn't have a valid merge tag OR the merged file doesn't exist in the parent, then add it
if (item.Type == ItemType.Disk && (((Disk)item).MergeTag == null || !this[parent].Select(i => i.Name).Contains(((Disk)item).MergeTag))) if (item.ItemType == ItemType.Disk && (((Disk)item).MergeTag == null || !this[parent].Select(i => i.Name).Contains(((Disk)item).MergeTag)))
{ {
item.CopyMachineInformation(copyFrom); item.CopyMachineInformation(copyFrom);
Add(parent, item); Add(parent, item);
} }
// Otherwise, if the parent doesn't already contain the non-disk (or a merge-equivalent), add it // Otherwise, if the parent doesn't already contain the non-disk (or a merge-equivalent), add it
else if (item.Type != ItemType.Disk && !this[parent].Contains(item)) else if (item.ItemType != ItemType.Disk && !this[parent].Contains(item))
{ {
// Rename the child so it's in a subfolder // Rename the child so it's in a subfolder
item.Name = item.MachineName + "\\" + item.Name; item.Name = item.MachineName + "\\" + item.Name;
@@ -3080,7 +3080,7 @@ namespace SabreTools.Library.DatFiles
List<DatItem> newitems = new List<DatItem>(); List<DatItem> newitems = new List<DatItem>();
foreach (DatItem item in items) foreach (DatItem item in items)
{ {
if (item.Type != ItemType.Blank) if (item.ItemType != ItemType.Blank)
{ {
newitems.Add(item); newitems.Add(item);
} }
@@ -3122,7 +3122,7 @@ namespace SabreTools.Library.DatFiles
} }
// If we have a Rom or a Disk, clean the hash data // If we have a Rom or a Disk, clean the hash data
if (item.Type == ItemType.Rom) if (item.ItemType == ItemType.Rom)
{ {
Rom itemRom = (Rom)item; Rom itemRom = (Rom)item;
@@ -3190,7 +3190,7 @@ namespace SabreTools.Library.DatFiles
item = itemRom; item = itemRom;
} }
else if (item.Type == ItemType.Disk) else if (item.ItemType == ItemType.Disk)
{ {
Disk itemDisk = (Disk)item; Disk itemDisk = (Disk)item;
@@ -3527,7 +3527,7 @@ namespace SabreTools.Library.DatFiles
private void ProcessFileHelper(string item, DatItem datItem, string basepath, string parent) private void ProcessFileHelper(string item, DatItem datItem, string basepath, string parent)
{ {
// If we somehow got something other than a Rom or Disk, cancel out // If we somehow got something other than a Rom or Disk, cancel out
if (datItem.Type != ItemType.Rom && datItem.Type != ItemType.Disk) if (datItem.ItemType != ItemType.Rom && datItem.ItemType != ItemType.Disk)
{ {
return; return;
} }
@@ -3641,7 +3641,7 @@ namespace SabreTools.Library.DatFiles
datItem.MachineDescription = gamename; datItem.MachineDescription = gamename;
// If we have a Disk, then the ".chd" extension needs to be removed // If we have a Disk, then the ".chd" extension needs to be removed
if (datItem.Type == ItemType.Disk) if (datItem.ItemType == ItemType.Disk)
{ {
datItem.Name = datItem.Name.Replace(".chd", ""); datItem.Name = datItem.Name.Replace(".chd", "");
} }
@@ -3800,7 +3800,7 @@ namespace SabreTools.Library.DatFiles
} }
// Otherwise, we rebuild that file to all locations that we need to // Otherwise, we rebuild that file to all locations that we need to
if (this[hash][0].Type == ItemType.Disk) if (this[hash][0].ItemType == ItemType.Disk)
{ {
RebuildIndividualFile(new Disk(fileinfo), foundpath, outDir, date, inverse, outputFormat, romba, RebuildIndividualFile(new Disk(fileinfo), foundpath, outDir, date, inverse, outputFormat, romba,
updateDat, false /* isZip */, headerToCheckAgainst); updateDat, false /* isZip */, headerToCheckAgainst);
@@ -4091,7 +4091,7 @@ namespace SabreTools.Library.DatFiles
bool rebuilt = true; bool rebuilt = true;
// If the DatItem is a Disk, force rebuilding to a folder except if TGZ // If the DatItem is a Disk, force rebuilding to a folder except if TGZ
if (datItem.Type == ItemType.Disk && outputFormat != OutputFormat.TorrentGzip) if (datItem.ItemType == ItemType.Disk && outputFormat != OutputFormat.TorrentGzip)
{ {
outputFormat = OutputFormat.Folder; outputFormat = OutputFormat.Folder;
} }
@@ -4099,12 +4099,12 @@ namespace SabreTools.Library.DatFiles
// Prepopluate a few key strings based on DatItem type // Prepopluate a few key strings based on DatItem type
string crc = null; string crc = null;
string sha1 = null; string sha1 = null;
if (datItem.Type == ItemType.Rom) if (datItem.ItemType == ItemType.Rom)
{ {
crc = ((Rom)datItem).CRC; crc = ((Rom)datItem).CRC;
sha1 = ((Rom)datItem).SHA1; sha1 = ((Rom)datItem).SHA1;
} }
else if (datItem.Type == ItemType.Disk) else if (datItem.ItemType == ItemType.Disk)
{ {
crc = ""; crc = "";
sha1 = ((Disk)datItem).SHA1; sha1 = ((Disk)datItem).SHA1;
@@ -4560,7 +4560,7 @@ namespace SabreTools.Library.DatFiles
{ {
if (rom.SourceID == 99) if (rom.SourceID == 99)
{ {
if (rom.Type == ItemType.Disk || rom.Type == ItemType.Rom) if (rom.ItemType == ItemType.Disk || rom.ItemType == ItemType.Rom)
{ {
matched.Add(((Disk)rom).SHA1, rom); matched.Add(((Disk)rom).SHA1, rom);
} }
@@ -4937,49 +4937,49 @@ namespace SabreTools.Library.DatFiles
foreach (DatItem item in items) foreach (DatItem item in items)
{ {
// If the file is not a Rom or Disk, continue // If the file is not a Rom or Disk, continue
if (item.Type != ItemType.Disk && item.Type != ItemType.Rom) if (item.ItemType != ItemType.Disk && item.ItemType != ItemType.Rom)
{ {
return; return;
} }
// If the file is a nodump // If the file is a nodump
if ((item.Type == ItemType.Rom && ((Rom)item).ItemStatus == ItemStatus.Nodump) if ((item.ItemType == ItemType.Rom && ((Rom)item).ItemStatus == ItemStatus.Nodump)
|| (item.Type == ItemType.Disk && ((Disk)item).ItemStatus == ItemStatus.Nodump)) || (item.ItemType == ItemType.Disk && ((Disk)item).ItemStatus == ItemStatus.Nodump))
{ {
nodump.Add(key, item); nodump.Add(key, item);
} }
// If the file has a SHA-512 // If the file has a SHA-512
else if ((item.Type == ItemType.Rom && !String.IsNullOrWhiteSpace(((Rom)item).SHA512)) else if ((item.ItemType == ItemType.Rom && !String.IsNullOrWhiteSpace(((Rom)item).SHA512))
|| (item.Type == ItemType.Disk && !String.IsNullOrWhiteSpace(((Disk)item).SHA512))) || (item.ItemType == ItemType.Disk && !String.IsNullOrWhiteSpace(((Disk)item).SHA512)))
{ {
sha512.Add(key, item); sha512.Add(key, item);
} }
// If the file has a SHA-384 // If the file has a SHA-384
else if ((item.Type == ItemType.Rom && !String.IsNullOrWhiteSpace(((Rom)item).SHA384)) else if ((item.ItemType == ItemType.Rom && !String.IsNullOrWhiteSpace(((Rom)item).SHA384))
|| (item.Type == ItemType.Disk && !String.IsNullOrWhiteSpace(((Disk)item).SHA384))) || (item.ItemType == ItemType.Disk && !String.IsNullOrWhiteSpace(((Disk)item).SHA384)))
{ {
sha384.Add(key, item); sha384.Add(key, item);
} }
// If the file has a SHA-256 // If the file has a SHA-256
else if ((item.Type == ItemType.Rom && !String.IsNullOrWhiteSpace(((Rom)item).SHA256)) else if ((item.ItemType == ItemType.Rom && !String.IsNullOrWhiteSpace(((Rom)item).SHA256))
|| (item.Type == ItemType.Disk && !String.IsNullOrWhiteSpace(((Disk)item).SHA256))) || (item.ItemType == ItemType.Disk && !String.IsNullOrWhiteSpace(((Disk)item).SHA256)))
{ {
sha256.Add(key, item); sha256.Add(key, item);
} }
// If the file has a SHA-1 // If the file has a SHA-1
else if ((item.Type == ItemType.Rom && !String.IsNullOrWhiteSpace(((Rom)item).SHA1)) else if ((item.ItemType == ItemType.Rom && !String.IsNullOrWhiteSpace(((Rom)item).SHA1))
|| (item.Type == ItemType.Disk && !String.IsNullOrWhiteSpace(((Disk)item).SHA1))) || (item.ItemType == ItemType.Disk && !String.IsNullOrWhiteSpace(((Disk)item).SHA1)))
{ {
sha1.Add(key, item); sha1.Add(key, item);
} }
// If the file has no SHA-1 but has an MD5 // If the file has no SHA-1 but has an MD5
else if ((item.Type == ItemType.Rom && !String.IsNullOrWhiteSpace(((Rom)item).MD5)) else if ((item.ItemType == ItemType.Rom && !String.IsNullOrWhiteSpace(((Rom)item).MD5))
|| (item.Type == ItemType.Disk && !String.IsNullOrWhiteSpace(((Disk)item).MD5))) || (item.ItemType == ItemType.Disk && !String.IsNullOrWhiteSpace(((Disk)item).MD5)))
{ {
md5.Add(key, item); md5.Add(key, item);
} }
// If the file has no MD5 but a CRC // If the file has no MD5 but a CRC
else if ((item.Type == ItemType.Rom && !String.IsNullOrWhiteSpace(((Rom)item).CRC))) else if ((item.ItemType == ItemType.Rom && !String.IsNullOrWhiteSpace(((Rom)item).CRC)))
{ {
crc.Add(key, item); crc.Add(key, item);
} }
@@ -5164,17 +5164,17 @@ namespace SabreTools.Library.DatFiles
foreach (DatItem item in items) foreach (DatItem item in items)
{ {
// If the file is not a Rom, it automatically goes in the "lesser" dat // If the file is not a Rom, it automatically goes in the "lesser" dat
if (item.Type != ItemType.Rom) if (item.ItemType != ItemType.Rom)
{ {
lessDat.Add(key, item); lessDat.Add(key, item);
} }
// If the file is a Rom and less than the radix, put it in the "lesser" dat // If the file is a Rom and less than the radix, put it in the "lesser" dat
else if (item.Type == ItemType.Rom && ((Rom)item).Size < radix) else if (item.ItemType == ItemType.Rom && ((Rom)item).Size < radix)
{ {
lessDat.Add(key, item); lessDat.Add(key, item);
} }
// If the file is a Rom and greater than or equal to the radix, put it in the "greater" dat // If the file is a Rom and greater than or equal to the radix, put it in the "greater" dat
else if (item.Type == ItemType.Rom && ((Rom)item).Size >= radix) else if (item.ItemType == ItemType.Rom && ((Rom)item).Size >= radix)
{ {
greaterEqualDat.Add(key, item); greaterEqualDat.Add(key, item);
} }
@@ -5271,17 +5271,17 @@ namespace SabreTools.Library.DatFiles
foreach (DatItem item in items) foreach (DatItem item in items)
{ {
// If the file is a Rom // If the file is a Rom
if (item.Type == ItemType.Rom) if (item.ItemType == ItemType.Rom)
{ {
romdat.Add(key, item); romdat.Add(key, item);
} }
// If the file is a Disk // If the file is a Disk
else if (item.Type == ItemType.Disk) else if (item.ItemType == ItemType.Disk)
{ {
diskdat.Add(key, item); diskdat.Add(key, item);
} }
// If the file is a Sample // If the file is a Sample
else if (item.Type == ItemType.Sample) else if (item.ItemType == ItemType.Sample)
{ {
sampledat.Add(key, item); sampledat.Add(key, item);
} }
@@ -5799,7 +5799,7 @@ namespace SabreTools.Library.DatFiles
// If we're in Romba mode, take care of that instead // If we're in Romba mode, take care of that instead
if (Romba) if (Romba)
{ {
if (item.Type == ItemType.Rom) if (item.ItemType == ItemType.Rom)
{ {
// We can only write out if there's a SHA-1 // We can only write out if there's a SHA-1
if (!String.IsNullOrWhiteSpace(((Rom)item).SHA1)) if (!String.IsNullOrWhiteSpace(((Rom)item).SHA1))
@@ -5812,7 +5812,7 @@ namespace SabreTools.Library.DatFiles
item.Name = pre + name + post; item.Name = pre + name + post;
} }
} }
else if (item.Type == ItemType.Disk) else if (item.ItemType == ItemType.Disk)
{ {
// We can only write out if there's a SHA-1 // We can only write out if there's a SHA-1
if (!String.IsNullOrWhiteSpace(((Disk)item).SHA1)) if (!String.IsNullOrWhiteSpace(((Disk)item).SHA1))
@@ -5898,7 +5898,7 @@ namespace SabreTools.Library.DatFiles
} }
// Ensure we have the proper values for replacement // Ensure we have the proper values for replacement
if (item.Type == ItemType.Rom) if (item.ItemType == ItemType.Rom)
{ {
crc = ((Rom)item).CRC; crc = ((Rom)item).CRC;
md5 = ((Rom)item).MD5; md5 = ((Rom)item).MD5;
@@ -5908,7 +5908,7 @@ namespace SabreTools.Library.DatFiles
sha512 = ((Rom)item).SHA512; sha512 = ((Rom)item).SHA512;
size = ((Rom)item).Size.ToString(); size = ((Rom)item).Size.ToString();
} }
else if (item.Type == ItemType.Disk) else if (item.ItemType == ItemType.Disk)
{ {
md5 = ((Disk)item).MD5; md5 = ((Disk)item).MD5;
sha1 = ((Disk)item).SHA1; sha1 = ((Disk)item).SHA1;

View File

@@ -138,7 +138,7 @@ namespace SabreTools.Library.DatFiles
// Now we do different things for each item type // Now we do different things for each item type
switch (item.Type) switch (item.ItemType)
{ {
case ItemType.Archive: case ItemType.Archive:
this.ArchiveCount += 1; this.ArchiveCount += 1;
@@ -237,7 +237,7 @@ namespace SabreTools.Library.DatFiles
// Now we do different things for each item type // Now we do different things for each item type
switch (item.Type) switch (item.ItemType)
{ {
case ItemType.Archive: case ItemType.Archive:
this.ArchiveCount -= 1; this.ArchiveCount -= 1;

View File

@@ -124,7 +124,7 @@ namespace SabreTools.Library.DatFiles
} }
// If we have a "null" game (created by DATFromDir or something similar), log it to file // If we have a "null" game (created by DATFromDir or something similar), log it to file
if (rom.Type == ItemType.Rom if (rom.ItemType == ItemType.Rom
&& ((Rom)rom).Size == -1 && ((Rom)rom).Size == -1
&& ((Rom)rom).CRC == "null") && ((Rom)rom).CRC == "null")
{ {
@@ -261,7 +261,7 @@ namespace SabreTools.Library.DatFiles
{ {
// If we are in ignore blanks mode AND we have a blank (0-size) rom, skip // If we are in ignore blanks mode AND we have a blank (0-size) rom, skip
if (ignoreblanks if (ignoreblanks
&& (rom.Type == ItemType.Rom && (rom.ItemType == ItemType.Rom
&& (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1))) && (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1)))
{ {
return true; return true;
@@ -274,7 +274,7 @@ namespace SabreTools.Library.DatFiles
// Pre-process the item name // Pre-process the item name
ProcessItemName(rom, true); ProcessItemName(rom, true);
switch (rom.Type) switch (rom.ItemType)
{ {
case ItemType.Archive: case ItemType.Archive:
case ItemType.BiosSet: case ItemType.BiosSet:

View File

@@ -389,7 +389,7 @@ namespace SabreTools.Library.DatFiles
} }
// Take care of Rom and Disk specific differences // Take care of Rom and Disk specific differences
if (item.Type == ItemType.Rom) if (item.ItemType == ItemType.Rom)
{ {
Rom rom = (Rom)item; Rom rom = (Rom)item;
@@ -528,7 +528,7 @@ namespace SabreTools.Library.DatFiles
} }
} }
} }
else if (item.Type == ItemType.Disk) else if (item.ItemType == ItemType.Disk)
{ {
Disk rom = (Disk)item; Disk rom = (Disk)item;
@@ -710,14 +710,14 @@ namespace SabreTools.Library.DatFiles
} }
// Filter on rom type // Filter on rom type
if (_romTypes.Count == 0 && _notRomTypes.Count == 0 && item.Type != ItemType.Rom && item.Type != ItemType.Disk && item.Type != ItemType.Blank) if (_romTypes.Count == 0 && _notRomTypes.Count == 0 && item.ItemType != ItemType.Rom && item.ItemType != ItemType.Disk && item.ItemType != ItemType.Blank)
{ {
return false; return false;
} }
if (_romTypes.Count > 0) if (_romTypes.Count > 0)
{ {
// If the rom type was not found in the list, return false // If the rom type was not found in the list, return false
if (!FindValueInList(_romTypes, item.Type.ToString())) if (!FindValueInList(_romTypes, item.ItemType.ToString()))
{ {
return false; return false;
} }
@@ -725,7 +725,7 @@ namespace SabreTools.Library.DatFiles
if (_notRomTypes.Count > 0) if (_notRomTypes.Count > 0)
{ {
// If the rom type was found in the list, return false // If the rom type was found in the list, return false
if (FindValueInList(_notRomTypes, item.Type.ToString())) if (FindValueInList(_notRomTypes, item.ItemType.ToString()))
{ {
return false; return false;
} }

View File

@@ -154,7 +154,7 @@ namespace SabreTools.Library.DatFiles
} }
// If we have a "null" game (created by DATFromDir or something similar), log it to file // If we have a "null" game (created by DATFromDir or something similar), log it to file
if (rom.Type == ItemType.Rom if (rom.ItemType == ItemType.Rom
&& ((Rom)rom).Size == -1 && ((Rom)rom).Size == -1
&& ((Rom)rom).CRC == "null") && ((Rom)rom).CRC == "null")
{ {
@@ -190,7 +190,7 @@ namespace SabreTools.Library.DatFiles
{ {
// If we are in ignore blanks mode AND we have a blank (0-size) rom, skip // If we are in ignore blanks mode AND we have a blank (0-size) rom, skip
if (ignoreblanks if (ignoreblanks
&& (rom.Type == ItemType.Rom && (rom.ItemType == ItemType.Rom
&& (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1))) && (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1)))
{ {
return true; return true;
@@ -206,13 +206,13 @@ namespace SabreTools.Library.DatFiles
switch (_hash) switch (_hash)
{ {
case Hash.MD5: case Hash.MD5:
if (rom.Type == ItemType.Rom) if (rom.ItemType == ItemType.Rom)
{ {
state += (!ExcludeFields[(int)Field.MD5] ? ((Rom)rom).MD5 : "") state += (!ExcludeFields[(int)Field.MD5] ? ((Rom)rom).MD5 : "")
+ " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "") + " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "")
+ (!ExcludeFields[(int)Field.Name] ? rom.Name : "") + "\n"; + (!ExcludeFields[(int)Field.Name] ? rom.Name : "") + "\n";
} }
else if (rom.Type == ItemType.Disk) else if (rom.ItemType == ItemType.Disk)
{ {
state += (!ExcludeFields[(int)Field.MD5] ? ((Disk)rom).MD5 : "") state += (!ExcludeFields[(int)Field.MD5] ? ((Disk)rom).MD5 : "")
+ " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "") + " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "")
@@ -220,7 +220,7 @@ namespace SabreTools.Library.DatFiles
} }
break; break;
case Hash.CRC: case Hash.CRC:
if (rom.Type == ItemType.Rom) if (rom.ItemType == ItemType.Rom)
{ {
state += (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "") state += (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "")
+ (!ExcludeFields[(int)Field.Name] ? rom.Name : "") + (!ExcludeFields[(int)Field.Name] ? rom.Name : "")
@@ -228,13 +228,13 @@ namespace SabreTools.Library.DatFiles
} }
break; break;
case Hash.SHA1: case Hash.SHA1:
if (rom.Type == ItemType.Rom) if (rom.ItemType == ItemType.Rom)
{ {
state += (!ExcludeFields[(int)Field.SHA1] ? ((Rom)rom).SHA1 : "") state += (!ExcludeFields[(int)Field.SHA1] ? ((Rom)rom).SHA1 : "")
+ " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "") + " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "")
+ (!ExcludeFields[(int)Field.Name] ? rom.Name : "") + "\n"; + (!ExcludeFields[(int)Field.Name] ? rom.Name : "") + "\n";
} }
else if (rom.Type == ItemType.Disk) else if (rom.ItemType == ItemType.Disk)
{ {
state += (!ExcludeFields[(int)Field.SHA1] ? ((Disk)rom).SHA1 : "") state += (!ExcludeFields[(int)Field.SHA1] ? ((Disk)rom).SHA1 : "")
+ " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "") + " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "")
@@ -242,13 +242,13 @@ namespace SabreTools.Library.DatFiles
} }
break; break;
case Hash.SHA256: case Hash.SHA256:
if (rom.Type == ItemType.Rom) if (rom.ItemType == ItemType.Rom)
{ {
state += (!ExcludeFields[(int)Field.SHA256] ? ((Rom)rom).SHA256 : "") state += (!ExcludeFields[(int)Field.SHA256] ? ((Rom)rom).SHA256 : "")
+ " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "") + " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "")
+ (!ExcludeFields[(int)Field.Name] ? rom.Name : "") + "\n"; + (!ExcludeFields[(int)Field.Name] ? rom.Name : "") + "\n";
} }
else if (rom.Type == ItemType.Disk) else if (rom.ItemType == ItemType.Disk)
{ {
state += (!ExcludeFields[(int)Field.SHA256] ? ((Disk)rom).SHA256 : "") state += (!ExcludeFields[(int)Field.SHA256] ? ((Disk)rom).SHA256 : "")
+ " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "") + " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "")
@@ -256,13 +256,13 @@ namespace SabreTools.Library.DatFiles
} }
break; break;
case Hash.SHA384: case Hash.SHA384:
if (rom.Type == ItemType.Rom) if (rom.ItemType == ItemType.Rom)
{ {
state += (!ExcludeFields[(int)Field.SHA384] ? ((Rom)rom).SHA384 : "") state += (!ExcludeFields[(int)Field.SHA384] ? ((Rom)rom).SHA384 : "")
+ " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "") + " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "")
+ (!ExcludeFields[(int)Field.Name] ? rom.Name : "") + "\n"; + (!ExcludeFields[(int)Field.Name] ? rom.Name : "") + "\n";
} }
else if (rom.Type == ItemType.Disk) else if (rom.ItemType == ItemType.Disk)
{ {
state += (!ExcludeFields[(int)Field.SHA384] ? ((Disk)rom).SHA384 : "") state += (!ExcludeFields[(int)Field.SHA384] ? ((Disk)rom).SHA384 : "")
+ " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "") + " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "")
@@ -270,13 +270,13 @@ namespace SabreTools.Library.DatFiles
} }
break; break;
case Hash.SHA512: case Hash.SHA512:
if (rom.Type == ItemType.Rom) if (rom.ItemType == ItemType.Rom)
{ {
state += (!ExcludeFields[(int)Field.SHA512] ? ((Rom)rom).SHA512 : "") state += (!ExcludeFields[(int)Field.SHA512] ? ((Rom)rom).SHA512 : "")
+ " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "") + " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "")
+ (!ExcludeFields[(int)Field.Name] ? rom.Name : "") + "\n"; + (!ExcludeFields[(int)Field.Name] ? rom.Name : "") + "\n";
} }
else if (rom.Type == ItemType.Disk) else if (rom.ItemType == ItemType.Disk)
{ {
state += (!ExcludeFields[(int)Field.SHA512] ? ((Disk)rom).SHA512 : "") state += (!ExcludeFields[(int)Field.SHA512] ? ((Disk)rom).SHA512 : "")
+ " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "") + " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "")

View File

@@ -297,7 +297,7 @@ namespace SabreTools.Library.DatFiles
} }
// If we have a "null" game (created by DATFromDir or something similar), log it to file // If we have a "null" game (created by DATFromDir or something similar), log it to file
if (rom.Type == ItemType.Rom if (rom.ItemType == ItemType.Rom
&& ((Rom)rom).Size == -1 && ((Rom)rom).Size == -1
&& ((Rom)rom).CRC == "null") && ((Rom)rom).CRC == "null")
{ {
@@ -399,7 +399,7 @@ namespace SabreTools.Library.DatFiles
{ {
// If we are in ignore blanks mode AND we have a blank (0-size) rom, skip // If we are in ignore blanks mode AND we have a blank (0-size) rom, skip
if (ignoreblanks if (ignoreblanks
&& (rom.Type == ItemType.Rom && (rom.ItemType == ItemType.Rom
&& (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1))) && (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1)))
{ {
return true; return true;
@@ -412,7 +412,7 @@ namespace SabreTools.Library.DatFiles
// Pre-process the item name // Pre-process the item name
ProcessItemName(rom, true); ProcessItemName(rom, true);
switch (rom.Type) switch (rom.ItemType)
{ {
case ItemType.Archive: case ItemType.Archive:
case ItemType.BiosSet: case ItemType.BiosSet:

View File

@@ -617,7 +617,7 @@ namespace SabreTools.Library.DatFiles
} }
// If we have a "null" game (created by DATFromDir or something similar), log it to file // If we have a "null" game (created by DATFromDir or something similar), log it to file
if (rom.Type == ItemType.Rom if (rom.ItemType == ItemType.Rom
&& ((Rom)rom).Size == -1 && ((Rom)rom).Size == -1
&& ((Rom)rom).CRC == "null") && ((Rom)rom).CRC == "null")
{ {
@@ -771,7 +771,7 @@ namespace SabreTools.Library.DatFiles
{ {
// If we are in ignore blanks mode AND we have a blank (0-size) rom, skip // If we are in ignore blanks mode AND we have a blank (0-size) rom, skip
if (ignoreblanks if (ignoreblanks
&& (rom.Type == ItemType.Rom && (rom.ItemType == ItemType.Rom
&& (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1))) && (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1)))
{ {
return true; return true;
@@ -784,7 +784,7 @@ namespace SabreTools.Library.DatFiles
// Pre-process the item name // Pre-process the item name
ProcessItemName(rom, true); ProcessItemName(rom, true);
switch (rom.Type) switch (rom.ItemType)
{ {
case ItemType.Archive: case ItemType.Archive:
break; break;

View File

@@ -700,7 +700,7 @@ namespace SabreTools.Library.DatFiles
} }
// If we have a "null" game (created by DATFromDir or something similar), log it to file // If we have a "null" game (created by DATFromDir or something similar), log it to file
if (rom.Type == ItemType.Rom if (rom.ItemType == ItemType.Rom
&& ((Rom)rom).Size == -1 && ((Rom)rom).Size == -1
&& ((Rom)rom).CRC == "null") && ((Rom)rom).CRC == "null")
{ {
@@ -879,7 +879,7 @@ namespace SabreTools.Library.DatFiles
{ {
// If we are in ignore blanks mode AND we have a blank (0-size) rom, skip // If we are in ignore blanks mode AND we have a blank (0-size) rom, skip
if (ignoreblanks if (ignoreblanks
&& (rom.Type == ItemType.Rom && (rom.ItemType == ItemType.Rom
&& (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1))) && (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1)))
{ {
return true; return true;
@@ -892,7 +892,7 @@ namespace SabreTools.Library.DatFiles
// Pre-process the item name // Pre-process the item name
ProcessItemName(rom, true); ProcessItemName(rom, true);
switch (rom.Type) switch (rom.ItemType)
{ {
case ItemType.Archive: case ItemType.Archive:
state += "\t\t<archive name=\"" + (!ExcludeFields[(int)Field.Name] ? HttpUtility.HtmlEncode(rom.Name) : "") + "\"" state += "\t\t<archive name=\"" + (!ExcludeFields[(int)Field.Name] ? HttpUtility.HtmlEncode(rom.Name) : "") + "\""

View File

@@ -104,7 +104,7 @@ namespace SabreTools.Library.DatFiles
} }
// If we have a "null" game (created by DATFromDir or something similar), log it to file // If we have a "null" game (created by DATFromDir or something similar), log it to file
if (rom.Type == ItemType.Rom if (rom.ItemType == ItemType.Rom
&& ((Rom)rom).Size == -1 && ((Rom)rom).Size == -1
&& ((Rom)rom).CRC == "null") && ((Rom)rom).CRC == "null")
{ {
@@ -146,7 +146,7 @@ namespace SabreTools.Library.DatFiles
{ {
// If we are in ignore blanks mode AND we have a blank (0-size) rom, skip // If we are in ignore blanks mode AND we have a blank (0-size) rom, skip
if (ignoreblanks if (ignoreblanks
&& (rom.Type == ItemType.Rom && (rom.ItemType == ItemType.Rom
&& (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1))) && (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1)))
{ {
return true; return true;

View File

@@ -806,7 +806,7 @@ namespace SabreTools.Library.DatFiles
} }
// If we have a "null" game (created by DATFromDir or something similar), log it to file // If we have a "null" game (created by DATFromDir or something similar), log it to file
if (rom.Type == ItemType.Rom if (rom.ItemType == ItemType.Rom
&& ((Rom)rom).Size == -1 && ((Rom)rom).Size == -1
&& ((Rom)rom).CRC == "null") && ((Rom)rom).CRC == "null")
{ {
@@ -945,7 +945,7 @@ namespace SabreTools.Library.DatFiles
{ {
// If we are in ignore blanks mode AND we have a blank (0-size) rom, skip // If we are in ignore blanks mode AND we have a blank (0-size) rom, skip
if (ignoreblanks if (ignoreblanks
&& (rom.Type == ItemType.Rom && (rom.ItemType == ItemType.Rom
&& (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1))) && (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1)))
{ {
return true; return true;
@@ -964,7 +964,7 @@ namespace SabreTools.Library.DatFiles
+ "\t\t\t<title>" + (!ExcludeFields[(int)Field.Name] ? HttpUtility.HtmlEncode(rom.Name) : "") + "</title>\n" + "\t\t\t<title>" + (!ExcludeFields[(int)Field.Name] ? HttpUtility.HtmlEncode(rom.Name) : "") + "</title>\n"
+ "\t\t\t<saveType>None</saveType>\n"; + "\t\t\t<saveType>None</saveType>\n";
if (rom.Type == ItemType.Rom) if (rom.ItemType == ItemType.Rom)
{ {
state += "\t\t\t<romSize>" + (!ExcludeFields[(int)Field.Size] ? ((Rom)rom).Size.ToString() : "") + "</romSize>\n"; state += "\t\t\t<romSize>" + (!ExcludeFields[(int)Field.Size] ? ((Rom)rom).Size.ToString() : "") + "</romSize>\n";
} }
@@ -974,7 +974,7 @@ namespace SabreTools.Library.DatFiles
+ "\t\t\t<sourceRom>None</sourceRom>\n" + "\t\t\t<sourceRom>None</sourceRom>\n"
+ "\t\t\t<language>0</language>\n"; + "\t\t\t<language>0</language>\n";
if (rom.Type == ItemType.Disk) if (rom.ItemType == ItemType.Disk)
{ {
state += "\t\t\t<files>\n" state += "\t\t\t<files>\n"
+ (((Disk)rom).MD5 != null + (((Disk)rom).MD5 != null
@@ -982,7 +982,7 @@ namespace SabreTools.Library.DatFiles
: "\t\t\t\t<romSHA1 extension=\".chd\">" + (!ExcludeFields[(int)Field.SHA1] ? ((Disk)rom).SHA1.ToUpperInvariant() : "") + "</romSHA1>\n") : "\t\t\t\t<romSHA1 extension=\".chd\">" + (!ExcludeFields[(int)Field.SHA1] ? ((Disk)rom).SHA1.ToUpperInvariant() : "") + "</romSHA1>\n")
+ "\t\t\t</files>\n"; + "\t\t\t</files>\n";
} }
else if (rom.Type == ItemType.Rom) else if (rom.ItemType == ItemType.Rom)
{ {
string tempext = "." + Utilities.GetExtension(((Rom)rom).Name); string tempext = "." + Utilities.GetExtension(((Rom)rom).Name);

View File

@@ -572,7 +572,7 @@ namespace SabreTools.Library.DatFiles
} }
// If we have a "null" game (created by DATFromDir or something similar), log it to file // If we have a "null" game (created by DATFromDir or something similar), log it to file
if (rom.Type == ItemType.Rom if (rom.ItemType == ItemType.Rom
&& ((Rom)rom).Size == -1 && ((Rom)rom).Size == -1
&& ((Rom)rom).CRC == "null") && ((Rom)rom).CRC == "null")
{ {
@@ -715,7 +715,7 @@ Generation MSXIDs by www.generation-msx.nl
{ {
// If we are in ignore blanks mode AND we have a blank (0-size) rom, skip // If we are in ignore blanks mode AND we have a blank (0-size) rom, skip
if (ignoreblanks if (ignoreblanks
&& (rom.Type == ItemType.Rom && (rom.ItemType == ItemType.Rom
&& (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1))) && (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1)))
{ {
return true; return true;
@@ -728,7 +728,7 @@ Generation MSXIDs by www.generation-msx.nl
// Pre-process the item name // Pre-process the item name
ProcessItemName(rom, true); ProcessItemName(rom, true);
switch (rom.Type) switch (rom.ItemType)
{ {
case ItemType.Archive: case ItemType.Archive:
break; break;

View File

@@ -247,7 +247,7 @@ namespace SabreTools.Library.DatFiles
} }
// If we have a "null" game (created by DATFromDir or something similar), log it to file // If we have a "null" game (created by DATFromDir or something similar), log it to file
if (rom.Type == ItemType.Rom if (rom.ItemType == ItemType.Rom
&& ((Rom)rom).Size == -1 && ((Rom)rom).Size == -1
&& ((Rom)rom).CRC == "null") && ((Rom)rom).CRC == "null")
{ {
@@ -330,7 +330,7 @@ namespace SabreTools.Library.DatFiles
{ {
// If we are in ignore blanks mode AND we have a blank (0-size) rom, skip // If we are in ignore blanks mode AND we have a blank (0-size) rom, skip
if (ignoreblanks if (ignoreblanks
&& (rom.Type == ItemType.Rom && (rom.ItemType == ItemType.Rom
&& (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1))) && (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1)))
{ {
return true; return true;
@@ -343,7 +343,7 @@ namespace SabreTools.Library.DatFiles
// Pre-process the item name // Pre-process the item name
ProcessItemName(rom, true); ProcessItemName(rom, true);
if (rom.Type == ItemType.Rom) if (rom.ItemType == ItemType.Rom)
{ {
state += "¬" + (!ExcludeFields[(int)Field.CloneOf] && String.IsNullOrWhiteSpace(rom.CloneOf) ? HttpUtility.HtmlEncode(rom.CloneOf) : "") + state += "¬" + (!ExcludeFields[(int)Field.CloneOf] && String.IsNullOrWhiteSpace(rom.CloneOf) ? HttpUtility.HtmlEncode(rom.CloneOf) : "") +
"¬" + (!ExcludeFields[(int)Field.CloneOf] && String.IsNullOrWhiteSpace(rom.CloneOf) ? HttpUtility.HtmlEncode(rom.CloneOf) : "") + "¬" + (!ExcludeFields[(int)Field.CloneOf] && String.IsNullOrWhiteSpace(rom.CloneOf) ? HttpUtility.HtmlEncode(rom.CloneOf) : "") +
@@ -353,7 +353,7 @@ namespace SabreTools.Library.DatFiles
"¬" + (!ExcludeFields[(int)Field.CRC] ? ((Rom)rom).CRC.ToLowerInvariant() : "") + "¬" + (!ExcludeFields[(int)Field.CRC] ? ((Rom)rom).CRC.ToLowerInvariant() : "") +
"¬" + (!ExcludeFields[(int)Field.Size] && ((Rom)rom).Size != -1 ? ((Rom)rom).Size.ToString() : "") + "¬¬¬\n"; "¬" + (!ExcludeFields[(int)Field.Size] && ((Rom)rom).Size != -1 ? ((Rom)rom).Size.ToString() : "") + "¬¬¬\n";
} }
else if (rom.Type == ItemType.Disk) else if (rom.ItemType == ItemType.Disk)
{ {
state += "¬" + (!ExcludeFields[(int)Field.CloneOf] && String.IsNullOrWhiteSpace(rom.CloneOf) ? HttpUtility.HtmlEncode(rom.CloneOf) : "") + state += "¬" + (!ExcludeFields[(int)Field.CloneOf] && String.IsNullOrWhiteSpace(rom.CloneOf) ? HttpUtility.HtmlEncode(rom.CloneOf) : "") +
"¬" + (!ExcludeFields[(int)Field.CloneOf] && String.IsNullOrWhiteSpace(rom.CloneOf) ? HttpUtility.HtmlEncode(rom.CloneOf) : "") + "¬" + (!ExcludeFields[(int)Field.CloneOf] && String.IsNullOrWhiteSpace(rom.CloneOf) ? HttpUtility.HtmlEncode(rom.CloneOf) : "") +

View File

@@ -613,7 +613,7 @@ namespace SabreTools.Library.DatFiles
} }
// If we have a "null" game (created by DATFromDir or something similar), log it to file // If we have a "null" game (created by DATFromDir or something similar), log it to file
if (rom.Type == ItemType.Rom if (rom.ItemType == ItemType.Rom
&& ((Rom)rom).Size == -1 && ((Rom)rom).Size == -1
&& ((Rom)rom).CRC == "null") && ((Rom)rom).CRC == "null")
{ {
@@ -813,7 +813,7 @@ namespace SabreTools.Library.DatFiles
{ {
// If we are in ignore blanks mode AND we have a blank (0-size) rom, skip // If we are in ignore blanks mode AND we have a blank (0-size) rom, skip
if (ignoreblanks if (ignoreblanks
&& (rom.Type == ItemType.Rom && (rom.ItemType == ItemType.Rom
&& (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1))) && (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1)))
{ {
return true; return true;
@@ -832,7 +832,7 @@ namespace SabreTools.Library.DatFiles
} }
state += prefix; state += prefix;
switch (rom.Type) switch (rom.ItemType)
{ {
case ItemType.Archive: case ItemType.Archive:
state += "<file type=\"archive\" name=\"" + (!ExcludeFields[(int)Field.Name] ? HttpUtility.HtmlEncode(rom.Name) : "") + "\"" state += "<file type=\"archive\" name=\"" + (!ExcludeFields[(int)Field.Name] ? HttpUtility.HtmlEncode(rom.Name) : "") + "\""

View File

@@ -381,7 +381,7 @@ namespace SabreTools.Library.DatFiles
} }
// If we have a "null" game (created by DATFromDir or something similar), log it to file // If we have a "null" game (created by DATFromDir or something similar), log it to file
if (rom.Type == ItemType.Rom if (rom.ItemType == ItemType.Rom
&& ((Rom)rom).Size == -1 && ((Rom)rom).Size == -1
&& ((Rom)rom).CRC == "null") && ((Rom)rom).CRC == "null")
{ {
@@ -442,7 +442,7 @@ namespace SabreTools.Library.DatFiles
{ {
// If we are in ignore blanks mode AND we have a blank (0-size) rom, skip // If we are in ignore blanks mode AND we have a blank (0-size) rom, skip
if (ignoreblanks if (ignoreblanks
&& (rom.Type == ItemType.Rom && (rom.ItemType == ItemType.Rom
&& (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1))) && (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1)))
{ {
return true; return true;
@@ -467,12 +467,12 @@ namespace SabreTools.Library.DatFiles
status = ""; status = "";
// Separated values should only output Rom and Disk // Separated values should only output Rom and Disk
if (rom.Type != ItemType.Disk && rom.Type != ItemType.Rom) if (rom.ItemType != ItemType.Disk && rom.ItemType != ItemType.Rom)
{ {
return true; return true;
} }
if (rom.Type == ItemType.Rom) if (rom.ItemType == ItemType.Rom)
{ {
type = "rom"; type = "rom";
romname = rom.Name; romname = rom.Name;
@@ -485,7 +485,7 @@ namespace SabreTools.Library.DatFiles
sha512 = ((Rom)rom).SHA512; sha512 = ((Rom)rom).SHA512;
status = (((Rom)rom).ItemStatus != ItemStatus.None ? "\"" + ((Rom)rom).ItemStatus.ToString() + "\"" : "\"\""); status = (((Rom)rom).ItemStatus != ItemStatus.None ? "\"" + ((Rom)rom).ItemStatus.ToString() + "\"" : "\"\"");
} }
else if (rom.Type == ItemType.Disk) else if (rom.ItemType == ItemType.Disk)
{ {
type = "disk"; type = "disk";
diskname = rom.Name; diskname = rom.Name;

View File

@@ -417,7 +417,7 @@ namespace SabreTools.Library.DatFiles
{ {
int index = this[key].Count - 1; int index = this[key].Count - 1;
DatItem lastrom = this[key][index]; DatItem lastrom = this[key][index];
if (lastrom.Type == ItemType.Rom) if (lastrom.ItemType == ItemType.Rom)
{ {
((Rom)lastrom).Size += Utilities.GetSize(reader.GetAttribute("size")); ((Rom)lastrom).Size += Utilities.GetSize(reader.GetAttribute("size"));
} }
@@ -624,7 +624,7 @@ namespace SabreTools.Library.DatFiles
} }
// If we have a "null" game (created by DATFromDir or something similar), log it to file // If we have a "null" game (created by DATFromDir or something similar), log it to file
if (rom.Type == ItemType.Rom if (rom.ItemType == ItemType.Rom
&& ((Rom)rom).Size == -1 && ((Rom)rom).Size == -1
&& ((Rom)rom).CRC == "null") && ((Rom)rom).CRC == "null")
{ {
@@ -773,7 +773,7 @@ namespace SabreTools.Library.DatFiles
{ {
// If we are in ignore blanks mode AND we have a blank (0-size) rom, skip // If we are in ignore blanks mode AND we have a blank (0-size) rom, skip
if (ignoreblanks if (ignoreblanks
&& (rom.Type == ItemType.Rom && (rom.ItemType == ItemType.Rom
&& (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1))) && (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1)))
{ {
return true; return true;
@@ -797,7 +797,7 @@ namespace SabreTools.Library.DatFiles
} }
} }
switch (rom.Type) switch (rom.ItemType)
{ {
case ItemType.Disk: case ItemType.Disk:
state += "\t\t\t<diskarea name=\"" + (!ExcludeFields[(int)Field.AreaName] ? (String.IsNullOrWhiteSpace(rom.AreaName) ? "cdrom" : rom.AreaName) : "") + "\"" state += "\t\t\t<diskarea name=\"" + (!ExcludeFields[(int)Field.AreaName] ? (String.IsNullOrWhiteSpace(rom.AreaName) ? "cdrom" : rom.AreaName) : "") + "\""

View File

@@ -27,8 +27,8 @@ namespace SabreTools.Library.DatItems
return new Archive() return new Archive()
{ {
Name = this.Name, Name = this.Name,
Type = this.Type, ItemType = this.ItemType,
Dupe = this.Dupe, DupeType = this.DupeType,
Supported = this.Supported, Supported = this.Supported,
Publisher = this.Publisher, Publisher = this.Publisher,
@@ -68,7 +68,7 @@ namespace SabreTools.Library.DatItems
public override bool Equals(DatItem other) public override bool Equals(DatItem other)
{ {
// If we don't have an archive, return false // If we don't have an archive, return false
if (_itemType != other.Type) if (_itemType != other.ItemType)
{ {
return false; return false;
} }

View File

@@ -49,8 +49,8 @@ namespace SabreTools.Library.DatItems
return new BiosSet() return new BiosSet()
{ {
Name = this.Name, Name = this.Name,
Type = this.Type, ItemType = this.ItemType,
Dupe = this.Dupe, DupeType = this.DupeType,
Supported = this.Supported, Supported = this.Supported,
Publisher = this.Publisher, Publisher = this.Publisher,
@@ -93,7 +93,7 @@ namespace SabreTools.Library.DatItems
public override bool Equals(DatItem other) public override bool Equals(DatItem other)
{ {
// If we don't have a biosset, return false // If we don't have a biosset, return false
if (_itemType != other.Type) if (_itemType != other.ItemType)
{ {
return false; return false;
} }

View File

@@ -27,8 +27,8 @@ namespace SabreTools.Library.DatItems
return new Blank() return new Blank()
{ {
Name = this.Name, Name = this.Name,
Type = this.Type, ItemType = this.ItemType,
Dupe = this.Dupe, DupeType = this.DupeType,
Supported = this.Supported, Supported = this.Supported,
Publisher = this.Publisher, Publisher = this.Publisher,
@@ -68,7 +68,7 @@ namespace SabreTools.Library.DatItems
public override bool Equals(DatItem other) public override bool Equals(DatItem other)
{ {
// If we don't have a blank, return false // If we don't have a blank, return false
if (_itemType != other.Type) if (_itemType != other.ItemType)
{ {
return false; return false;
} }

File diff suppressed because it is too large Load Diff

View File

@@ -129,8 +129,8 @@ namespace SabreTools.Library.DatItems
return new Disk() return new Disk()
{ {
Name = this.Name, Name = this.Name,
Type = this.Type, ItemType = this.ItemType,
Dupe = this.Dupe, DupeType = this.DupeType,
Supported = this.Supported, Supported = this.Supported,
Publisher = this.Publisher, Publisher = this.Publisher,
@@ -179,7 +179,7 @@ namespace SabreTools.Library.DatItems
bool dupefound = false; bool dupefound = false;
// If we don't have a rom, return false // If we don't have a rom, return false
if (_itemType != other.Type) if (_itemType != other.ItemType)
{ {
return dupefound; return dupefound;
} }

View File

@@ -1,126 +1,197 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using SabreTools.Library.Data; using SabreTools.Library.Data;
namespace SabreTools.Library.DatItems namespace SabreTools.Library.DatItems
{ {
/// <summary> /// <summary>
/// Represents the information specific to a set/game/machine /// Represents the information specific to a set/game/machine
/// </summary> /// </summary>
public class Machine : ICloneable public class Machine : ICloneable
{ {
#region Publicly facing variables #region Publicly facing variables
// Machine information /// <summary>
public string Name; /// Name of the machine
public string Comment; /// </summary>
public string Description; public string Name { get; set; }
public string Year;
public string Manufacturer;
public string Publisher;
public string RomOf;
public string CloneOf;
public string SampleOf;
public bool? Supported;
public string SourceFile;
public bool? Runnable;
public string Board;
public string RebuildTo;
public List<string> Devices;
public List<string> SlotOptions;
public List<Tuple<string, string>> Infos;
public MachineType MachineType;
#endregion /// <summary>
/// Additional notes
/// </summary>
public string Comment { get; set; }
#region Constructors /// <summary>
/// Extended description
/// </summary>
public string Description { get; set; }
/// <summary> /// <summary>
/// Create a new Machine object /// Year(s) of release/manufacture
/// </summary> /// </summary>
public Machine() public string Year { get; set; }
{
Name = null;
Comment = null;
Description = null;
Year = null;
Manufacturer = null;
Publisher = null;
RomOf = null;
CloneOf = null;
SampleOf = null;
Supported = true;
SourceFile = null;
Runnable = null;
Board = null;
RebuildTo = null;
Devices = null;
SlotOptions = null;
Infos = null;
MachineType = MachineType.NULL;
}
/// <summary> /// <summary>
/// Create a new Machine object with the included information /// Manufacturer, if available
/// </summary> /// </summary>
/// <param name="name">Name of the machine</param> public string Manufacturer { get; set; }
/// <param name="description">Description of the machine</param>
public Machine(string name, string description)
{
Name = name;
Comment = null;
Description = description;
Year = null;
Manufacturer = null;
Publisher = null;
RomOf = null;
CloneOf = null;
SampleOf = null;
Supported = true;
SourceFile = null;
Runnable = null;
Board = null;
RebuildTo = null;
Devices = null;
SlotOptions = null;
Infos = null;
MachineType = MachineType.NULL;
}
#endregion /// <summary>
/// Publisher, if available
/// </summary>
public string Publisher { get; set; }
#region Cloning methods /// <summary>
/// fomof parent
/// </summary>
public string RomOf { get; set; }
/// <summary> /// <summary>
/// Create a clone of the current machine /// cloneof parent
/// </summary> /// </summary>
/// <returns>New machine with the same values as the current one</returns> public string CloneOf { get; set; }
public object Clone()
{
return new Machine()
{
Name = this.Name,
Comment = this.Comment,
Description = this.Description,
Year = this.Year,
Manufacturer = this.Manufacturer,
Publisher = this.Publisher,
RomOf = this.RomOf,
CloneOf = this.CloneOf,
SampleOf = this.SampleOf,
Supported = this.Supported,
SourceFile = this.SourceFile,
Runnable = this.Runnable,
Board = this.Board,
RebuildTo = this.RebuildTo,
Devices = this.Devices,
SlotOptions = this.SlotOptions,
Infos = this.Infos,
MachineType = this.MachineType,
};
}
#endregion /// <summary>
} /// sampleof parent
/// </summary>
public string SampleOf { get; set; }
/// <summary>
/// Support status
/// </summary>
/// <remarks>yes = true, partial = null, no = false</remarks>
public bool? Supported { get; set; }
/// <summary>
/// Emulator source file related to the machine
/// </summary>
public string SourceFile { get; set; }
/// <summary>
/// Machine runnable status
/// </summary>
/// <remarks>yes = true, partial = null, no = false</remarks>
public bool? Runnable { get; set; }
/// <summary>
/// Machine board name
/// </summary>
public string Board { get; set; }
/// <summary>
/// Rebuild location if different than machine name
/// </summary>
public string RebuildTo { get; set; }
/// <summary>
/// List of associated device names
/// </summary>
public List<string> Devices { get; set; }
/// <summary>
/// List of slot options
/// </summary>
public List<string> SlotOptions { get; set; }
/// <summary>
/// List of info items
/// </summary>
public List<Tuple<string, string>> Infos { get; set; }
/// <summary>
/// Type of the machine
/// </summary>
public MachineType MachineType { get; set; }
#endregion
#region Constructors
/// <summary>
/// Create a new Machine object
/// </summary>
public Machine()
{
Name = null;
Comment = null;
Description = null;
Year = null;
Manufacturer = null;
Publisher = null;
RomOf = null;
CloneOf = null;
SampleOf = null;
Supported = true;
SourceFile = null;
Runnable = null;
Board = null;
RebuildTo = null;
Devices = null;
SlotOptions = null;
Infos = null;
MachineType = MachineType.NULL;
}
/// <summary>
/// Create a new Machine object with the included information
/// </summary>
/// <param name="name">Name of the machine</param>
/// <param name="description">Description of the machine</param>
public Machine(string name, string description)
{
Name = name;
Comment = null;
Description = description;
Year = null;
Manufacturer = null;
Publisher = null;
RomOf = null;
CloneOf = null;
SampleOf = null;
Supported = true;
SourceFile = null;
Runnable = null;
Board = null;
RebuildTo = null;
Devices = null;
SlotOptions = null;
Infos = null;
MachineType = MachineType.NULL;
}
#endregion
#region Cloning methods
/// <summary>
/// Create a clone of the current machine
/// </summary>
/// <returns>New machine with the same values as the current one</returns>
public object Clone()
{
return new Machine()
{
Name = this.Name,
Comment = this.Comment,
Description = this.Description,
Year = this.Year,
Manufacturer = this.Manufacturer,
Publisher = this.Publisher,
RomOf = this.RomOf,
CloneOf = this.CloneOf,
SampleOf = this.SampleOf,
Supported = this.Supported,
SourceFile = this.SourceFile,
Runnable = this.Runnable,
Board = this.Board,
RebuildTo = this.RebuildTo,
Devices = this.Devices,
SlotOptions = this.SlotOptions,
Infos = this.Infos,
MachineType = this.MachineType,
};
}
#endregion
}
} }

View File

@@ -65,8 +65,8 @@ namespace SabreTools.Library.DatItems
return new Release() return new Release()
{ {
Name = this.Name, Name = this.Name,
Type = this.Type, ItemType = this.ItemType,
Dupe = this.Dupe, DupeType = this.DupeType,
Supported = this.Supported, Supported = this.Supported,
Publisher = this.Publisher, Publisher = this.Publisher,
@@ -111,7 +111,7 @@ namespace SabreTools.Library.DatItems
public override bool Equals(DatItem other) public override bool Equals(DatItem other)
{ {
// If we don't have a release return false // If we don't have a release return false
if (_itemType != other.Type) if (_itemType != other.ItemType)
{ {
return false; return false;
} }

View File

@@ -196,8 +196,8 @@ namespace SabreTools.Library.DatItems
return new Rom() return new Rom()
{ {
Name = this.Name, Name = this.Name,
Type = this.Type, ItemType = this.ItemType,
Dupe = this.Dupe, DupeType = this.DupeType,
Supported = this.Supported, Supported = this.Supported,
Publisher = this.Publisher, Publisher = this.Publisher,
@@ -249,7 +249,7 @@ namespace SabreTools.Library.DatItems
bool dupefound = false; bool dupefound = false;
// If we don't have a rom, return false // If we don't have a rom, return false
if (_itemType != other.Type) if (_itemType != other.ItemType)
{ {
return dupefound; return dupefound;
} }

View File

@@ -27,8 +27,8 @@ namespace SabreTools.Library.DatItems
return new Sample() return new Sample()
{ {
Name = this.Name, Name = this.Name,
Type = this.Type, ItemType = this.ItemType,
Dupe = this.Dupe, DupeType = this.DupeType,
Supported = this.Supported, Supported = this.Supported,
Publisher = this.Publisher, Publisher = this.Publisher,
@@ -68,7 +68,7 @@ namespace SabreTools.Library.DatItems
public override bool Equals(DatItem other) public override bool Equals(DatItem other)
{ {
// If we don't have a sample, return false // If we don't have a sample, return false
if (_itemType != other.Type) if (_itemType != other.ItemType)
{ {
return false; return false;
} }

View File

@@ -283,7 +283,7 @@ namespace SabreTools.Library.FileTypes
} }
outputStream.Dispose(); outputStream.Dispose();
if (rom.Type == ItemType.Rom) if (rom.ItemType == ItemType.Rom)
{ {
if (date && !String.IsNullOrWhiteSpace(((Rom)rom).Date)) if (date && !String.IsNullOrWhiteSpace(((Rom)rom).Date))
{ {

View File

@@ -2617,7 +2617,7 @@ namespace SabreTools.Library.Tools
switch (sortedBy) switch (sortedBy)
{ {
case SortedBy.CRC: case SortedBy.CRC:
key = (item.Type == ItemType.Rom ? ((Rom)item).CRC : Constants.CRCZero); key = (item.ItemType == ItemType.Rom ? ((Rom)item).CRC : Constants.CRCZero);
break; break;
case SortedBy.Game: case SortedBy.Game:
key = (norename ? "" key = (norename ? ""
@@ -2639,37 +2639,37 @@ namespace SabreTools.Library.Tools
key = HttpUtility.HtmlEncode(key); key = HttpUtility.HtmlEncode(key);
break; break;
case SortedBy.MD5: case SortedBy.MD5:
key = (item.Type == ItemType.Rom key = (item.ItemType == ItemType.Rom
? ((Rom)item).MD5 ? ((Rom)item).MD5
: (item.Type == ItemType.Disk : (item.ItemType == ItemType.Disk
? ((Disk)item).MD5 ? ((Disk)item).MD5
: Constants.MD5Zero)); : Constants.MD5Zero));
break; break;
case SortedBy.SHA1: case SortedBy.SHA1:
key = (item.Type == ItemType.Rom key = (item.ItemType == ItemType.Rom
? ((Rom)item).SHA1 ? ((Rom)item).SHA1
: (item.Type == ItemType.Disk : (item.ItemType == ItemType.Disk
? ((Disk)item).SHA1 ? ((Disk)item).SHA1
: Constants.SHA1Zero)); : Constants.SHA1Zero));
break; break;
case SortedBy.SHA256: case SortedBy.SHA256:
key = (item.Type == ItemType.Rom key = (item.ItemType == ItemType.Rom
? ((Rom)item).SHA256 ? ((Rom)item).SHA256
: (item.Type == ItemType.Disk : (item.ItemType == ItemType.Disk
? ((Disk)item).SHA256 ? ((Disk)item).SHA256
: Constants.SHA256Zero)); : Constants.SHA256Zero));
break; break;
case SortedBy.SHA384: case SortedBy.SHA384:
key = (item.Type == ItemType.Rom key = (item.ItemType == ItemType.Rom
? ((Rom)item).SHA384 ? ((Rom)item).SHA384
: (item.Type == ItemType.Disk : (item.ItemType == ItemType.Disk
? ((Disk)item).SHA384 ? ((Disk)item).SHA384
: Constants.SHA384Zero)); : Constants.SHA384Zero));
break; break;
case SortedBy.SHA512: case SortedBy.SHA512:
key = (item.Type == ItemType.Rom key = (item.ItemType == ItemType.Rom
? ((Rom)item).SHA512 ? ((Rom)item).SHA512
: (item.Type == ItemType.Disk : (item.ItemType == ItemType.Disk
? ((Disk)item).SHA512 ? ((Disk)item).SHA512
: Constants.SHA512Zero)); : Constants.SHA512Zero));
break; break;