[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

@@ -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 (item.Type == ItemType.Rom
if (item.ItemType == ItemType.Rom
&& ((Rom)item).Size == -1
&& ((Rom)item).CRC == "null")
{

View File

@@ -433,11 +433,11 @@ namespace SabreTools.Library.DatFiles
case "nodump":
case "verified":
ItemStatus tempStandaloneStatus = Utilities.GetItemStatus(quoteless);
if (item.Type == ItemType.Rom)
if (item.ItemType == ItemType.Rom)
{
((Rom)item).ItemStatus = tempStandaloneStatus;
}
else if (item.Type == ItemType.Disk)
else if (item.ItemType == ItemType.Disk)
{
((Disk)item).ItemStatus = tempStandaloneStatus;
}
@@ -449,7 +449,7 @@ namespace SabreTools.Library.DatFiles
item.Name = quoteless;
break;
case "size":
if (item.Type == ItemType.Rom)
if (item.ItemType == ItemType.Rom)
{
quoteless = linegc[++i].Replace("\"", "");
if (Int64.TryParse(quoteless, out long size))
@@ -463,19 +463,19 @@ namespace SabreTools.Library.DatFiles
}
break;
case "crc":
if (item.Type == ItemType.Rom)
if (item.ItemType == ItemType.Rom)
{
quoteless = linegc[++i].Replace("\"", "");
((Rom)item).CRC = Utilities.CleanHashData(quoteless, Constants.CRCLength);
}
break;
case "md5":
if (item.Type == ItemType.Rom)
if (item.ItemType == ItemType.Rom)
{
quoteless = linegc[++i].Replace("\"", "");
((Rom)item).MD5 = Utilities.CleanHashData(quoteless, Constants.MD5Length);
}
else if (item.Type == ItemType.Disk)
else if (item.ItemType == ItemType.Disk)
{
i++;
quoteless = linegc[i].Replace("\"", "");
@@ -483,48 +483,48 @@ namespace SabreTools.Library.DatFiles
}
break;
case "sha1":
if (item.Type == ItemType.Rom)
if (item.ItemType == ItemType.Rom)
{
quoteless = linegc[++i].Replace("\"", "");
((Rom)item).SHA1 = Utilities.CleanHashData(quoteless, Constants.SHA1Length);
}
else if (item.Type == ItemType.Disk)
else if (item.ItemType == ItemType.Disk)
{
quoteless = linegc[++i].Replace("\"", "");
((Disk)item).SHA1 = Utilities.CleanHashData(quoteless, Constants.SHA1Length);
}
break;
case "sha256":
if (item.Type == ItemType.Rom)
if (item.ItemType == ItemType.Rom)
{
quoteless = linegc[++i].Replace("\"", "");
((Rom)item).SHA256 = Utilities.CleanHashData(quoteless, Constants.SHA256Length);
}
else if (item.Type == ItemType.Disk)
else if (item.ItemType == ItemType.Disk)
{
quoteless = linegc[++i].Replace("\"", "");
((Disk)item).SHA256 = Utilities.CleanHashData(quoteless, Constants.SHA256Length);
}
break;
case "sha384":
if (item.Type == ItemType.Rom)
if (item.ItemType == ItemType.Rom)
{
quoteless = linegc[++i].Replace("\"", "");
((Rom)item).SHA384 = Utilities.CleanHashData(quoteless, Constants.SHA384Length);
}
else if (item.Type == ItemType.Disk)
else if (item.ItemType == ItemType.Disk)
{
quoteless = linegc[++i].Replace("\"", "");
((Disk)item).SHA384 = Utilities.CleanHashData(quoteless, Constants.SHA384Length);
}
break;
case "sha512":
if (item.Type == ItemType.Rom)
if (item.ItemType == ItemType.Rom)
{
quoteless = linegc[++i].Replace("\"", "");
((Rom)item).SHA512 = Utilities.CleanHashData(quoteless, Constants.SHA512Length);
}
else if (item.Type == ItemType.Disk)
else if (item.ItemType == ItemType.Disk)
{
quoteless = linegc[++i].Replace("\"", "");
((Disk)item).SHA512 = Utilities.CleanHashData(quoteless, Constants.SHA512Length);
@@ -534,17 +534,17 @@ namespace SabreTools.Library.DatFiles
case "flags":
quoteless = linegc[++i].Replace("\"", "");
ItemStatus tempFlagStatus = Utilities.GetItemStatus(quoteless);
if (item.Type == ItemType.Rom)
if (item.ItemType == ItemType.Rom)
{
((Rom)item).ItemStatus = tempFlagStatus;
}
else if (item.Type == ItemType.Disk)
else if (item.ItemType == ItemType.Disk)
{
((Disk)item).ItemStatus = tempFlagStatus;
}
break;
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 (linegc[i + 1].Contains("\""))
@@ -558,7 +558,7 @@ namespace SabreTools.Library.DatFiles
}
((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 (linegc[i + 1].Contains("\""))
@@ -574,33 +574,33 @@ namespace SabreTools.Library.DatFiles
}
break;
case "default":
if (item.Type == ItemType.BiosSet)
if (item.ItemType == ItemType.BiosSet)
{
quoteless = linegc[++i].Replace("\"", "");
((BiosSet)item).Default = Utilities.GetYesNo(quoteless.ToLowerInvariant());
}
else if (item.Type == ItemType.Release)
else if (item.ItemType == ItemType.Release)
{
quoteless = linegc[++i].Replace("\"", "");
((Release)item).Default = Utilities.GetYesNo(quoteless.ToLowerInvariant());
}
break;
case "description":
if (item.Type == ItemType.BiosSet)
if (item.ItemType == ItemType.BiosSet)
{
quoteless = linegc[++i].Replace("\"", "");
((BiosSet)item).Description = quoteless.ToLowerInvariant();
}
break;
case "region":
if (item.Type == ItemType.Release)
if (item.ItemType == ItemType.Release)
{
quoteless = linegc[++i].Replace("\"", "");
((Release)item).Region = quoteless.ToLowerInvariant();
}
break;
case "language":
if (item.Type == ItemType.Release)
if (item.ItemType == ItemType.Release)
{
quoteless = linegc[++i].Replace("\"", "");
((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 (rom.Type == ItemType.Rom
if (rom.ItemType == ItemType.Rom
&& ((Rom)rom).Size == -1
&& ((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 (ignoreblanks
&& (rom.Type == ItemType.Rom
&& (rom.ItemType == ItemType.Rom
&& (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1)))
{
return true;
@@ -895,7 +895,7 @@ namespace SabreTools.Library.DatFiles
// Pre-process the item name
ProcessItemName(rom, true);
switch (rom.Type)
switch (rom.ItemType)
{
case ItemType.Archive:
state += "\tarchive ( name\"" + (!ExcludeFields[(int)Field.Name] ? rom.Name : "") + "\""

View File

@@ -1671,7 +1671,7 @@ namespace SabreTools.Library.DatFiles
foreach (DatItem datItem in datItems)
{
// 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());
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 ((replaceMode & ReplaceMode.Hash) != 0)
{
if (newDatItem.Type == ItemType.Rom)
if (newDatItem.ItemType == ItemType.Rom)
{
Rom newRomItem = (Rom)newDatItem;
if (String.IsNullOrEmpty(newRomItem.CRC) && !String.IsNullOrEmpty(((Rom)dupes[0]).CRC))
@@ -1721,7 +1721,7 @@ namespace SabreTools.Library.DatFiles
newDatItem = (Rom)newRomItem.Clone();
}
else if (newDatItem.Type == ItemType.Disk)
else if (newDatItem.ItemType == ItemType.Disk)
{
Disk newDiskItem = (Disk)newDatItem;
if (String.IsNullOrEmpty(newDiskItem.MD5) && !String.IsNullOrEmpty(((Disk)dupes[0]).MD5))
@@ -2072,7 +2072,7 @@ namespace SabreTools.Library.DatFiles
// No duplicates
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
if ((diff & UpdateMode.DiffIndividualsOnly) != 0)
@@ -2094,7 +2094,7 @@ namespace SabreTools.Library.DatFiles
// Duplicates only
if ((diff & UpdateMode.DiffDupesOnly) != 0)
{
if ((item.Dupe & DupeType.External) != 0)
if ((item.DupeType & DupeType.External) != 0)
{
DatItem newrom = item.Clone() as DatItem;
newrom.MachineName += " (" + Path.GetFileNameWithoutExtension(inputs[item.SystemID].Split('¬')[0]) + ")";
@@ -2786,14 +2786,14 @@ namespace SabreTools.Library.DatFiles
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 (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);
Add(parent, item);
}
// 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
item.Name = item.MachineName + "\\" + item.Name;
@@ -3080,7 +3080,7 @@ namespace SabreTools.Library.DatFiles
List<DatItem> newitems = new List<DatItem>();
foreach (DatItem item in items)
{
if (item.Type != ItemType.Blank)
if (item.ItemType != ItemType.Blank)
{
newitems.Add(item);
}
@@ -3122,7 +3122,7 @@ namespace SabreTools.Library.DatFiles
}
// 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;
@@ -3190,7 +3190,7 @@ namespace SabreTools.Library.DatFiles
item = itemRom;
}
else if (item.Type == ItemType.Disk)
else if (item.ItemType == ItemType.Disk)
{
Disk itemDisk = (Disk)item;
@@ -3527,7 +3527,7 @@ namespace SabreTools.Library.DatFiles
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 (datItem.Type != ItemType.Rom && datItem.Type != ItemType.Disk)
if (datItem.ItemType != ItemType.Rom && datItem.ItemType != ItemType.Disk)
{
return;
}
@@ -3641,7 +3641,7 @@ namespace SabreTools.Library.DatFiles
datItem.MachineDescription = gamename;
// 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", "");
}
@@ -3800,7 +3800,7 @@ namespace SabreTools.Library.DatFiles
}
// 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,
updateDat, false /* isZip */, headerToCheckAgainst);
@@ -4091,7 +4091,7 @@ namespace SabreTools.Library.DatFiles
bool rebuilt = true;
// 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;
}
@@ -4099,12 +4099,12 @@ namespace SabreTools.Library.DatFiles
// Prepopluate a few key strings based on DatItem type
string crc = null;
string sha1 = null;
if (datItem.Type == ItemType.Rom)
if (datItem.ItemType == ItemType.Rom)
{
crc = ((Rom)datItem).CRC;
sha1 = ((Rom)datItem).SHA1;
}
else if (datItem.Type == ItemType.Disk)
else if (datItem.ItemType == ItemType.Disk)
{
crc = "";
sha1 = ((Disk)datItem).SHA1;
@@ -4560,7 +4560,7 @@ namespace SabreTools.Library.DatFiles
{
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);
}
@@ -4937,49 +4937,49 @@ namespace SabreTools.Library.DatFiles
foreach (DatItem item in items)
{
// 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;
}
// If the file is a nodump
if ((item.Type == ItemType.Rom && ((Rom)item).ItemStatus == ItemStatus.Nodump)
|| (item.Type == ItemType.Disk && ((Disk)item).ItemStatus == ItemStatus.Nodump))
if ((item.ItemType == ItemType.Rom && ((Rom)item).ItemStatus == ItemStatus.Nodump)
|| (item.ItemType == ItemType.Disk && ((Disk)item).ItemStatus == ItemStatus.Nodump))
{
nodump.Add(key, item);
}
// If the file has a SHA-512
else if ((item.Type == ItemType.Rom && !String.IsNullOrWhiteSpace(((Rom)item).SHA512))
|| (item.Type == ItemType.Disk && !String.IsNullOrWhiteSpace(((Disk)item).SHA512)))
else if ((item.ItemType == ItemType.Rom && !String.IsNullOrWhiteSpace(((Rom)item).SHA512))
|| (item.ItemType == ItemType.Disk && !String.IsNullOrWhiteSpace(((Disk)item).SHA512)))
{
sha512.Add(key, item);
}
// If the file has a SHA-384
else if ((item.Type == ItemType.Rom && !String.IsNullOrWhiteSpace(((Rom)item).SHA384))
|| (item.Type == ItemType.Disk && !String.IsNullOrWhiteSpace(((Disk)item).SHA384)))
else if ((item.ItemType == ItemType.Rom && !String.IsNullOrWhiteSpace(((Rom)item).SHA384))
|| (item.ItemType == ItemType.Disk && !String.IsNullOrWhiteSpace(((Disk)item).SHA384)))
{
sha384.Add(key, item);
}
// If the file has a SHA-256
else if ((item.Type == ItemType.Rom && !String.IsNullOrWhiteSpace(((Rom)item).SHA256))
|| (item.Type == ItemType.Disk && !String.IsNullOrWhiteSpace(((Disk)item).SHA256)))
else if ((item.ItemType == ItemType.Rom && !String.IsNullOrWhiteSpace(((Rom)item).SHA256))
|| (item.ItemType == ItemType.Disk && !String.IsNullOrWhiteSpace(((Disk)item).SHA256)))
{
sha256.Add(key, item);
}
// If the file has a SHA-1
else if ((item.Type == ItemType.Rom && !String.IsNullOrWhiteSpace(((Rom)item).SHA1))
|| (item.Type == ItemType.Disk && !String.IsNullOrWhiteSpace(((Disk)item).SHA1)))
else if ((item.ItemType == ItemType.Rom && !String.IsNullOrWhiteSpace(((Rom)item).SHA1))
|| (item.ItemType == ItemType.Disk && !String.IsNullOrWhiteSpace(((Disk)item).SHA1)))
{
sha1.Add(key, item);
}
// If the file has no SHA-1 but has an MD5
else if ((item.Type == ItemType.Rom && !String.IsNullOrWhiteSpace(((Rom)item).MD5))
|| (item.Type == ItemType.Disk && !String.IsNullOrWhiteSpace(((Disk)item).MD5)))
else if ((item.ItemType == ItemType.Rom && !String.IsNullOrWhiteSpace(((Rom)item).MD5))
|| (item.ItemType == ItemType.Disk && !String.IsNullOrWhiteSpace(((Disk)item).MD5)))
{
md5.Add(key, item);
}
// 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);
}
@@ -5164,17 +5164,17 @@ namespace SabreTools.Library.DatFiles
foreach (DatItem item in items)
{
// 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);
}
// 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);
}
// 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);
}
@@ -5271,17 +5271,17 @@ namespace SabreTools.Library.DatFiles
foreach (DatItem item in items)
{
// If the file is a Rom
if (item.Type == ItemType.Rom)
if (item.ItemType == ItemType.Rom)
{
romdat.Add(key, item);
}
// If the file is a Disk
else if (item.Type == ItemType.Disk)
else if (item.ItemType == ItemType.Disk)
{
diskdat.Add(key, item);
}
// If the file is a Sample
else if (item.Type == ItemType.Sample)
else if (item.ItemType == ItemType.Sample)
{
sampledat.Add(key, item);
}
@@ -5799,7 +5799,7 @@ namespace SabreTools.Library.DatFiles
// If we're in Romba mode, take care of that instead
if (Romba)
{
if (item.Type == ItemType.Rom)
if (item.ItemType == ItemType.Rom)
{
// We can only write out if there's a SHA-1
if (!String.IsNullOrWhiteSpace(((Rom)item).SHA1))
@@ -5812,7 +5812,7 @@ namespace SabreTools.Library.DatFiles
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
if (!String.IsNullOrWhiteSpace(((Disk)item).SHA1))
@@ -5898,7 +5898,7 @@ namespace SabreTools.Library.DatFiles
}
// Ensure we have the proper values for replacement
if (item.Type == ItemType.Rom)
if (item.ItemType == ItemType.Rom)
{
crc = ((Rom)item).CRC;
md5 = ((Rom)item).MD5;
@@ -5908,7 +5908,7 @@ namespace SabreTools.Library.DatFiles
sha512 = ((Rom)item).SHA512;
size = ((Rom)item).Size.ToString();
}
else if (item.Type == ItemType.Disk)
else if (item.ItemType == ItemType.Disk)
{
md5 = ((Disk)item).MD5;
sha1 = ((Disk)item).SHA1;

View File

@@ -138,7 +138,7 @@ namespace SabreTools.Library.DatFiles
// Now we do different things for each item type
switch (item.Type)
switch (item.ItemType)
{
case ItemType.Archive:
this.ArchiveCount += 1;
@@ -237,7 +237,7 @@ namespace SabreTools.Library.DatFiles
// Now we do different things for each item type
switch (item.Type)
switch (item.ItemType)
{
case ItemType.Archive:
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 (rom.Type == ItemType.Rom
if (rom.ItemType == ItemType.Rom
&& ((Rom)rom).Size == -1
&& ((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 (ignoreblanks
&& (rom.Type == ItemType.Rom
&& (rom.ItemType == ItemType.Rom
&& (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1)))
{
return true;
@@ -274,7 +274,7 @@ namespace SabreTools.Library.DatFiles
// Pre-process the item name
ProcessItemName(rom, true);
switch (rom.Type)
switch (rom.ItemType)
{
case ItemType.Archive:
case ItemType.BiosSet:

View File

@@ -389,7 +389,7 @@ namespace SabreTools.Library.DatFiles
}
// Take care of Rom and Disk specific differences
if (item.Type == ItemType.Rom)
if (item.ItemType == ItemType.Rom)
{
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;
@@ -710,14 +710,14 @@ namespace SabreTools.Library.DatFiles
}
// 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;
}
if (_romTypes.Count > 0)
{
// 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;
}
@@ -725,7 +725,7 @@ namespace SabreTools.Library.DatFiles
if (_notRomTypes.Count > 0)
{
// 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;
}

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 (rom.Type == ItemType.Rom
if (rom.ItemType == ItemType.Rom
&& ((Rom)rom).Size == -1
&& ((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 (ignoreblanks
&& (rom.Type == ItemType.Rom
&& (rom.ItemType == ItemType.Rom
&& (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1)))
{
return true;
@@ -206,13 +206,13 @@ namespace SabreTools.Library.DatFiles
switch (_hash)
{
case Hash.MD5:
if (rom.Type == ItemType.Rom)
if (rom.ItemType == ItemType.Rom)
{
state += (!ExcludeFields[(int)Field.MD5] ? ((Rom)rom).MD5 : "")
+ " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "")
+ (!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 : "")
+ " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "")
@@ -220,7 +220,7 @@ namespace SabreTools.Library.DatFiles
}
break;
case Hash.CRC:
if (rom.Type == ItemType.Rom)
if (rom.ItemType == ItemType.Rom)
{
state += (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "")
+ (!ExcludeFields[(int)Field.Name] ? rom.Name : "")
@@ -228,13 +228,13 @@ namespace SabreTools.Library.DatFiles
}
break;
case Hash.SHA1:
if (rom.Type == ItemType.Rom)
if (rom.ItemType == ItemType.Rom)
{
state += (!ExcludeFields[(int)Field.SHA1] ? ((Rom)rom).SHA1 : "")
+ " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "")
+ (!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 : "")
+ " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "")
@@ -242,13 +242,13 @@ namespace SabreTools.Library.DatFiles
}
break;
case Hash.SHA256:
if (rom.Type == ItemType.Rom)
if (rom.ItemType == ItemType.Rom)
{
state += (!ExcludeFields[(int)Field.SHA256] ? ((Rom)rom).SHA256 : "")
+ " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "")
+ (!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 : "")
+ " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "")
@@ -256,13 +256,13 @@ namespace SabreTools.Library.DatFiles
}
break;
case Hash.SHA384:
if (rom.Type == ItemType.Rom)
if (rom.ItemType == ItemType.Rom)
{
state += (!ExcludeFields[(int)Field.SHA384] ? ((Rom)rom).SHA384 : "")
+ " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "")
+ (!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 : "")
+ " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "")
@@ -270,13 +270,13 @@ namespace SabreTools.Library.DatFiles
}
break;
case Hash.SHA512:
if (rom.Type == ItemType.Rom)
if (rom.ItemType == ItemType.Rom)
{
state += (!ExcludeFields[(int)Field.SHA512] ? ((Rom)rom).SHA512 : "")
+ " *" + (!ExcludeFields[(int)Field.MachineName] && GameName ? rom.MachineName + Path.DirectorySeparatorChar : "")
+ (!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 : "")
+ " *" + (!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 (rom.Type == ItemType.Rom
if (rom.ItemType == ItemType.Rom
&& ((Rom)rom).Size == -1
&& ((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 (ignoreblanks
&& (rom.Type == ItemType.Rom
&& (rom.ItemType == ItemType.Rom
&& (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1)))
{
return true;
@@ -412,7 +412,7 @@ namespace SabreTools.Library.DatFiles
// Pre-process the item name
ProcessItemName(rom, true);
switch (rom.Type)
switch (rom.ItemType)
{
case ItemType.Archive:
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 (rom.Type == ItemType.Rom
if (rom.ItemType == ItemType.Rom
&& ((Rom)rom).Size == -1
&& ((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 (ignoreblanks
&& (rom.Type == ItemType.Rom
&& (rom.ItemType == ItemType.Rom
&& (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1)))
{
return true;
@@ -784,7 +784,7 @@ namespace SabreTools.Library.DatFiles
// Pre-process the item name
ProcessItemName(rom, true);
switch (rom.Type)
switch (rom.ItemType)
{
case ItemType.Archive:
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 (rom.Type == ItemType.Rom
if (rom.ItemType == ItemType.Rom
&& ((Rom)rom).Size == -1
&& ((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 (ignoreblanks
&& (rom.Type == ItemType.Rom
&& (rom.ItemType == ItemType.Rom
&& (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1)))
{
return true;
@@ -892,7 +892,7 @@ namespace SabreTools.Library.DatFiles
// Pre-process the item name
ProcessItemName(rom, true);
switch (rom.Type)
switch (rom.ItemType)
{
case ItemType.Archive:
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 (rom.Type == ItemType.Rom
if (rom.ItemType == ItemType.Rom
&& ((Rom)rom).Size == -1
&& ((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 (ignoreblanks
&& (rom.Type == ItemType.Rom
&& (rom.ItemType == ItemType.Rom
&& (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1)))
{
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 (rom.Type == ItemType.Rom
if (rom.ItemType == ItemType.Rom
&& ((Rom)rom).Size == -1
&& ((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 (ignoreblanks
&& (rom.Type == ItemType.Rom
&& (rom.ItemType == ItemType.Rom
&& (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1)))
{
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<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";
}
@@ -974,7 +974,7 @@ namespace SabreTools.Library.DatFiles
+ "\t\t\t<sourceRom>None</sourceRom>\n"
+ "\t\t\t<language>0</language>\n";
if (rom.Type == ItemType.Disk)
if (rom.ItemType == ItemType.Disk)
{
state += "\t\t\t<files>\n"
+ (((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</files>\n";
}
else if (rom.Type == ItemType.Rom)
else if (rom.ItemType == ItemType.Rom)
{
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 (rom.Type == ItemType.Rom
if (rom.ItemType == ItemType.Rom
&& ((Rom)rom).Size == -1
&& ((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 (ignoreblanks
&& (rom.Type == ItemType.Rom
&& (rom.ItemType == ItemType.Rom
&& (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1)))
{
return true;
@@ -728,7 +728,7 @@ Generation MSXIDs by www.generation-msx.nl
// Pre-process the item name
ProcessItemName(rom, true);
switch (rom.Type)
switch (rom.ItemType)
{
case ItemType.Archive:
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 (rom.Type == ItemType.Rom
if (rom.ItemType == ItemType.Rom
&& ((Rom)rom).Size == -1
&& ((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 (ignoreblanks
&& (rom.Type == ItemType.Rom
&& (rom.ItemType == ItemType.Rom
&& (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1)))
{
return true;
@@ -343,7 +343,7 @@ namespace SabreTools.Library.DatFiles
// Pre-process the item name
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) : "") +
"¬" + (!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.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) : "") +
"¬" + (!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 (rom.Type == ItemType.Rom
if (rom.ItemType == ItemType.Rom
&& ((Rom)rom).Size == -1
&& ((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 (ignoreblanks
&& (rom.Type == ItemType.Rom
&& (rom.ItemType == ItemType.Rom
&& (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1)))
{
return true;
@@ -832,7 +832,7 @@ namespace SabreTools.Library.DatFiles
}
state += prefix;
switch (rom.Type)
switch (rom.ItemType)
{
case ItemType.Archive:
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 (rom.Type == ItemType.Rom
if (rom.ItemType == ItemType.Rom
&& ((Rom)rom).Size == -1
&& ((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 (ignoreblanks
&& (rom.Type == ItemType.Rom
&& (rom.ItemType == ItemType.Rom
&& (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1)))
{
return true;
@@ -467,12 +467,12 @@ namespace SabreTools.Library.DatFiles
status = "";
// 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;
}
if (rom.Type == ItemType.Rom)
if (rom.ItemType == ItemType.Rom)
{
type = "rom";
romname = rom.Name;
@@ -485,7 +485,7 @@ namespace SabreTools.Library.DatFiles
sha512 = ((Rom)rom).SHA512;
status = (((Rom)rom).ItemStatus != ItemStatus.None ? "\"" + ((Rom)rom).ItemStatus.ToString() + "\"" : "\"\"");
}
else if (rom.Type == ItemType.Disk)
else if (rom.ItemType == ItemType.Disk)
{
type = "disk";
diskname = rom.Name;

View File

@@ -417,7 +417,7 @@ namespace SabreTools.Library.DatFiles
{
int index = this[key].Count - 1;
DatItem lastrom = this[key][index];
if (lastrom.Type == ItemType.Rom)
if (lastrom.ItemType == ItemType.Rom)
{
((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 (rom.Type == ItemType.Rom
if (rom.ItemType == ItemType.Rom
&& ((Rom)rom).Size == -1
&& ((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 (ignoreblanks
&& (rom.Type == ItemType.Rom
&& (rom.ItemType == ItemType.Rom
&& (((Rom)rom).Size == 0 || ((Rom)rom).Size == -1)))
{
return true;
@@ -797,7 +797,7 @@ namespace SabreTools.Library.DatFiles
}
}
switch (rom.Type)
switch (rom.ItemType)
{
case ItemType.Disk:
state += "\t\t\t<diskarea name=\"" + (!ExcludeFields[(int)Field.AreaName] ? (String.IsNullOrWhiteSpace(rom.AreaName) ? "cdrom" : rom.AreaName) : "") + "\""