[ALL] Add full status backup, not just nodump

This commit is contained in:
Matt Nadareski
2016-09-21 15:45:40 -07:00
parent 323b77a78a
commit ae27ba2157
6 changed files with 168 additions and 65 deletions

View File

@@ -83,6 +83,18 @@
Archive = 5, Archive = 5,
} }
/// <summary>
/// Determine the status of the item
/// </summary>
public enum ItemStatus
{
None = 0,
Good = 1,
BadDump = 2,
Nodump = 3,
Verified = 4,
}
#endregion #endregion
#region Skippers and Mappers #region Skippers and Mappers

View File

@@ -824,11 +824,11 @@ namespace SabreTools.Helper
{ {
if (item.Type == ItemType.Rom) if (item.Type == ItemType.Rom)
{ {
((Rom)item).Nodump = true; ((Rom)item).ItemStatus = ItemStatus.Nodump;
} }
else if (item.Type == ItemType.Disk) else if (item.Type == ItemType.Disk)
{ {
((Disk)item).Nodump = true; ((Disk)item).ItemStatus = ItemStatus.Nodump;
} }
} }
// Even number of quotes, not in a quote, not in attribute // Even number of quotes, not in a quote, not in attribute
@@ -882,15 +882,48 @@ namespace SabreTools.Helper
} }
break; break;
case "flags": case "flags":
if (gc[i].Replace("\"", "").ToLowerInvariant() == "nodump") if (val.ToLowerInvariant() == "good")
{ {
if (item.Type == ItemType.Rom) if (item.Type == ItemType.Rom)
{ {
((Rom)item).Nodump = true; ((Rom)item).ItemStatus = ItemStatus.Good;
} }
else if (item.Type == ItemType.Disk) else if (item.Type == ItemType.Disk)
{ {
((Disk)item).Nodump = true; ((Disk)item).ItemStatus = ItemStatus.Good;
}
}
else if (val.ToLowerInvariant() == "baddump")
{
if (item.Type == ItemType.Rom)
{
((Rom)item).ItemStatus = ItemStatus.BadDump;
}
else if (item.Type == ItemType.Disk)
{
((Disk)item).ItemStatus = ItemStatus.BadDump;
}
}
else if (val.ToLowerInvariant() == "nodump")
{
if (item.Type == ItemType.Rom)
{
((Rom)item).ItemStatus = ItemStatus.Nodump;
}
else if (item.Type == ItemType.Disk)
{
((Disk)item).ItemStatus = ItemStatus.Nodump;
}
}
else if (val.ToLowerInvariant() == "verified")
{
if (item.Type == ItemType.Rom)
{
((Rom)item).ItemStatus = ItemStatus.Verified;
}
else if (item.Type == ItemType.Disk)
{
((Disk)item).ItemStatus = ItemStatus.Verified;
} }
} }
break; break;
@@ -977,15 +1010,48 @@ namespace SabreTools.Helper
} }
break; break;
case "flags": case "flags":
if (val.ToLowerInvariant() == "nodump") if (val.ToLowerInvariant() == "good")
{ {
if (item.Type == ItemType.Rom) if (item.Type == ItemType.Rom)
{ {
((Rom)item).Nodump = true; ((Rom)item).ItemStatus = ItemStatus.Good;
} }
else if (item.Type == ItemType.Disk) else if (item.Type == ItemType.Disk)
{ {
((Disk)item).Nodump = true; ((Disk)item).ItemStatus = ItemStatus.Good;
}
}
else if (val.ToLowerInvariant() == "baddump")
{
if (item.Type == ItemType.Rom)
{
((Rom)item).ItemStatus = ItemStatus.BadDump;
}
else if (item.Type == ItemType.Disk)
{
((Disk)item).ItemStatus = ItemStatus.BadDump;
}
}
else if (val.ToLowerInvariant() == "nodump")
{
if (item.Type == ItemType.Rom)
{
((Rom)item).ItemStatus = ItemStatus.Nodump;
}
else if (item.Type == ItemType.Disk)
{
((Disk)item).ItemStatus = ItemStatus.Nodump;
}
}
else if (val.ToLowerInvariant() == "verified")
{
if (item.Type == ItemType.Rom)
{
((Rom)item).ItemStatus = ItemStatus.Verified;
}
else if (item.Type == ItemType.Disk)
{
((Disk)item).ItemStatus = ItemStatus.Verified;
} }
} }
break; break;
@@ -1303,7 +1369,7 @@ namespace SabreTools.Helper
*/ */
string[] rominfo = line.Split('¬'); string[] rominfo = line.Split('¬');
Rom rom = new Rom(rominfo[5], Int64.Parse(rominfo[7]), rominfo[6], null, null, false, null, rominfo[3], null, Rom rom = new Rom(rominfo[5], Int64.Parse(rominfo[7]), rominfo[6], null, null, ItemStatus.None, null, rominfo[3], null,
rominfo[4], null, null, rominfo[8], rominfo[1], null, null, false, null, null, sysid, null, srcid, null); rominfo[4], null, null, rominfo[8], rominfo[1], null, null, false, null, null, sysid, null, srcid, null);
// Now process and add the rom // Now process and add the rom
@@ -1373,9 +1439,10 @@ namespace SabreTools.Helper
{ {
// Prepare all internal variables // Prepare all internal variables
XmlReader subreader, headreader, flagreader; XmlReader subreader, headreader, flagreader;
bool superdat = false, isnodump = false, empty = true; bool superdat = false, empty = true;
string key = "", date = ""; string key = "", date = "";
long size = -1; long size = -1;
ItemStatus its = ItemStatus.None;
List<string> parent = new List<string>(); List<string> parent = new List<string>();
XmlTextReader xtr = GetXmlTextReader(filename, logger); XmlTextReader xtr = GetXmlTextReader(filename, logger);
@@ -1819,13 +1886,27 @@ namespace SabreTools.Helper
case "disk": case "disk":
empty = false; empty = false;
// If the rom is nodump, flag it // If the rom has a status, flag it
isnodump = false; its = ItemStatus.None;
if (subreader.GetAttribute("flags") == "good" || subreader.GetAttribute("status") == "good")
{
its = ItemStatus.Good;
}
if (subreader.GetAttribute("flags") == "baddump" || subreader.GetAttribute("status") == "baddump")
{
logger.Log("Bad dump detected: " +
(subreader.GetAttribute("name") != null && subreader.GetAttribute("name") != "" ? "\"" + xtr.GetAttribute("name") + "\"" : "ROM NAME NOT FOUND"));
its = ItemStatus.BadDump;
}
if (subreader.GetAttribute("flags") == "nodump" || subreader.GetAttribute("status") == "nodump") if (subreader.GetAttribute("flags") == "nodump" || subreader.GetAttribute("status") == "nodump")
{ {
logger.Log("Nodump detected: " + logger.Log("Nodump detected: " +
(subreader.GetAttribute("name") != null && subreader.GetAttribute("name") != "" ? "\"" + xtr.GetAttribute("name") + "\"" : "ROM NAME NOT FOUND")); (subreader.GetAttribute("name") != null && subreader.GetAttribute("name") != "" ? "\"" + xtr.GetAttribute("name") + "\"" : "ROM NAME NOT FOUND"));
isnodump = true; its = ItemStatus.Nodump;
}
if (subreader.GetAttribute("flags") == "verified" || subreader.GetAttribute("status") == "verified")
{
its = ItemStatus.Verified;
} }
// If the rom has a Date attached, read it in and then sanitize it // If the rom has a Date attached, read it in and then sanitize it
@@ -1880,13 +1961,13 @@ namespace SabreTools.Helper
{ {
case "disk": case "disk":
inrom = new Disk(subreader.GetAttribute("name"), subreader.GetAttribute("md5"), subreader.GetAttribute("sha1"), inrom = new Disk(subreader.GetAttribute("name"), subreader.GetAttribute("md5"), subreader.GetAttribute("sha1"),
isnodump, tempname, null, gamedesc, null, null, romof, cloneof, sampleof, null, false, null, null, sysid, its, tempname, null, gamedesc, null, null, romof, cloneof, sampleof, null, false, null, null, sysid,
filename, srcid, null); filename, srcid, null);
break; break;
case "rom": case "rom":
default: default:
inrom = new Rom(subreader.GetAttribute("name"), size, subreader.GetAttribute("crc"), subreader.GetAttribute("md5"), inrom = new Rom(subreader.GetAttribute("name"), size, subreader.GetAttribute("crc"), subreader.GetAttribute("md5"),
subreader.GetAttribute("sha1"), isnodump, date, tempname, null, gamedesc, null, null, romof, cloneof, sampleof, subreader.GetAttribute("sha1"), its, date, tempname, null, gamedesc, null, null, romof, cloneof, sampleof,
null, false, null, null, sysid, filename, srcid, null); null, false, null, null, sysid, filename, srcid, null);
break; break;
} }
@@ -1942,7 +2023,7 @@ namespace SabreTools.Helper
empty = false; empty = false;
// If the rom is nodump, flag it // If the rom is nodump, flag it
isnodump = false; its = ItemStatus.None;
flagreader = xtr.ReadSubtree(); flagreader = xtr.ReadSubtree();
if (flagreader != null) if (flagreader != null)
{ {
@@ -1964,10 +2045,21 @@ namespace SabreTools.Helper
string content = flagreader.GetAttribute("value"); string content = flagreader.GetAttribute("value");
switch (flagreader.GetAttribute("name")) switch (flagreader.GetAttribute("name"))
{ {
case "good":
its = ItemStatus.Good;
break;
case "baddump":
logger.Log("Bad dump detected: " + (xtr.GetAttribute("name") != null && xtr.GetAttribute("name") != "" ?
"\"" + xtr.GetAttribute("name") + "\"" : "ROM NAME NOT FOUND"));
its = ItemStatus.BadDump;
break;
case "nodump": case "nodump":
logger.Log("Nodump detected: " + (xtr.GetAttribute("name") != null && xtr.GetAttribute("name") != "" ? logger.Log("Nodump detected: " + (xtr.GetAttribute("name") != null && xtr.GetAttribute("name") != "" ?
"\"" + xtr.GetAttribute("name") + "\"" : "ROM NAME NOT FOUND")); "\"" + xtr.GetAttribute("name") + "\"" : "ROM NAME NOT FOUND"));
isnodump = true; its = ItemStatus.Nodump;
break;
case "verified":
its = ItemStatus.Verified;
break; break;
} }
} }
@@ -2028,13 +2120,13 @@ namespace SabreTools.Helper
{ {
case "disk": case "disk":
rom = new Disk(xtr.GetAttribute("name"), xtr.GetAttribute("md5")?.ToLowerInvariant(), rom = new Disk(xtr.GetAttribute("name"), xtr.GetAttribute("md5")?.ToLowerInvariant(),
xtr.GetAttribute("sha1")?.ToLowerInvariant(), isnodump, tempname, null, tempname, null, null, xtr.GetAttribute("sha1")?.ToLowerInvariant(), its, tempname, null, tempname, null, null,
null, null, null, null, false, null, null, sysid, filename, srcid, null); null, null, null, null, false, null, null, sysid, filename, srcid, null);
break; break;
case "rom": case "rom":
default: default:
rom = new Rom(xtr.GetAttribute("name"), size, xtr.GetAttribute("crc")?.ToLowerInvariant(), rom = new Rom(xtr.GetAttribute("name"), size, xtr.GetAttribute("crc")?.ToLowerInvariant(),
xtr.GetAttribute("md5")?.ToLowerInvariant(), xtr.GetAttribute("sha1")?.ToLowerInvariant(), isnodump, xtr.GetAttribute("md5")?.ToLowerInvariant(), xtr.GetAttribute("sha1")?.ToLowerInvariant(), its,
date, tempname, null, tempname, null, null, null, null, null, null, false, null, null, sysid, filename, date, tempname, null, tempname, null, null, null, null, null, null, false, null, null, sysid, filename,
srcid, null); srcid, null);
break; break;
@@ -2115,7 +2207,7 @@ namespace SabreTools.Helper
else if (itemRom.Type == ItemType.Rom && (itemRom.Size == 0 || itemRom.Size == -1)) else if (itemRom.Type == ItemType.Rom && (itemRom.Size == 0 || itemRom.Size == -1))
{ {
logger.Warning("Incomplete entry for \"" + itemRom.Name + "\" will be output as nodump"); logger.Warning("Incomplete entry for \"" + itemRom.Name + "\" will be output as nodump");
itemRom.Nodump = true; itemRom.ItemStatus = ItemStatus.Nodump;
} }
item = itemRom; item = itemRom;
@@ -2172,18 +2264,18 @@ namespace SabreTools.Helper
datdata.TotalSize += 0; datdata.TotalSize += 0;
datdata.MD5Count += (String.IsNullOrEmpty(((Disk)item).MD5) ? 0 : 1); datdata.MD5Count += (String.IsNullOrEmpty(((Disk)item).MD5) ? 0 : 1);
datdata.SHA1Count += (String.IsNullOrEmpty(((Disk)item).SHA1) ? 0 : 1); datdata.SHA1Count += (String.IsNullOrEmpty(((Disk)item).SHA1) ? 0 : 1);
datdata.NodumpCount += (((Disk)item).Nodump ? 1 : 0); datdata.NodumpCount += (((Disk)item).ItemStatus == ItemStatus.Nodump ? 1 : 0);
break; break;
case ItemType.Rom: case ItemType.Rom:
key = ((Rom)item).Size + "-" + ((Rom)item).CRC; key = ((Rom)item).Size + "-" + ((Rom)item).CRC;
// Add statistical data // Add statistical data
datdata.RomCount += 1; datdata.RomCount += 1;
datdata.TotalSize += (((Rom)item).Nodump ? 0 : ((Rom)item).Size); datdata.TotalSize += (((Rom)item).ItemStatus == ItemStatus.Nodump ? 0 : ((Rom)item).Size);
datdata.CRCCount += (String.IsNullOrEmpty(((Rom)item).CRC) ? 0 : 1); datdata.CRCCount += (String.IsNullOrEmpty(((Rom)item).CRC) ? 0 : 1);
datdata.MD5Count += (String.IsNullOrEmpty(((Rom)item).MD5) ? 0 : 1); datdata.MD5Count += (String.IsNullOrEmpty(((Rom)item).MD5) ? 0 : 1);
datdata.SHA1Count += (String.IsNullOrEmpty(((Rom)item).SHA1) ? 0 : 1); datdata.SHA1Count += (String.IsNullOrEmpty(((Rom)item).SHA1) ? 0 : 1);
datdata.NodumpCount += (((Rom)item).Nodump ? 1 : 0); datdata.NodumpCount += (((Rom)item).ItemStatus == ItemStatus.Nodump ? 1 : 0);
break; break;
default: default:
key = "default"; key = "default";
@@ -3398,7 +3490,7 @@ namespace SabreTools.Helper
state += "\tdisk ( name \"" + rom.Name + "\"" state += "\tdisk ( name \"" + rom.Name + "\""
+ (!String.IsNullOrEmpty(((Disk)rom).MD5) ? " md5 " + ((Disk)rom).MD5.ToLowerInvariant() : "") + (!String.IsNullOrEmpty(((Disk)rom).MD5) ? " md5 " + ((Disk)rom).MD5.ToLowerInvariant() : "")
+ (!String.IsNullOrEmpty(((Disk)rom).SHA1) ? " sha1 " + ((Disk)rom).SHA1.ToLowerInvariant() : "") + (!String.IsNullOrEmpty(((Disk)rom).SHA1) ? " sha1 " + ((Disk)rom).SHA1.ToLowerInvariant() : "")
+ (((Disk)rom).Nodump ? " flags nodump" : "") + (((Disk)rom).ItemStatus != ItemStatus.None ? " flags " + ((Disk)rom).ItemStatus.ToString().ToLowerInvariant() : "")
+ " )\n"; + " )\n";
break; break;
case ItemType.Release: case ItemType.Release:
@@ -3418,7 +3510,7 @@ namespace SabreTools.Helper
+ (!String.IsNullOrEmpty(((Rom)rom).MD5) ? " md5 " + ((Rom)rom).MD5.ToLowerInvariant() : "") + (!String.IsNullOrEmpty(((Rom)rom).MD5) ? " md5 " + ((Rom)rom).MD5.ToLowerInvariant() : "")
+ (!String.IsNullOrEmpty(((Rom)rom).SHA1) ? " sha1 " + ((Rom)rom).SHA1.ToLowerInvariant() : "") + (!String.IsNullOrEmpty(((Rom)rom).SHA1) ? " sha1 " + ((Rom)rom).SHA1.ToLowerInvariant() : "")
+ (!String.IsNullOrEmpty(((Rom)rom).Date) ? " date \"" + ((Rom)rom).Date + "\"" : "") + (!String.IsNullOrEmpty(((Rom)rom).Date) ? " date \"" + ((Rom)rom).Date + "\"" : "")
+ (((Rom)rom).Nodump ? " flags nodump" : "") + (((Rom)rom).ItemStatus != ItemStatus.None ? " flags " + ((Rom)rom).ItemStatus.ToString().ToLowerInvariant() : "")
+ " )\n"; + " )\n";
break; break;
case ItemType.Sample: case ItemType.Sample:
@@ -3539,7 +3631,7 @@ namespace SabreTools.Helper
+ separator + "\"" + ((Rom)rom).CRC + "\"" + separator + "\"" + ((Rom)rom).CRC + "\""
+ separator + "\"" + ((Rom)rom).MD5 + "\"" + separator + "\"" + ((Rom)rom).MD5 + "\""
+ separator + "\"" + ((Rom)rom).SHA1 + "\"" + separator + "\"" + ((Rom)rom).SHA1 + "\""
+ separator + (((Rom)rom).Nodump ? "\"Nodump\"" : "\"\""); + separator + (((Rom)rom).ItemStatus != ItemStatus.None ? "\"" + ((Rom)rom).ItemStatus.ToString() + "\"" : "\"\"");
state += pre + inline + post + "\n"; state += pre + inline + post + "\n";
} }
else if (rom.Type == ItemType.Disk) else if (rom.Type == ItemType.Disk)
@@ -3556,7 +3648,7 @@ namespace SabreTools.Helper
+ separator + "\"\"" + separator + "\"\""
+ separator + "\"" + ((Disk)rom).MD5 + "\"" + separator + "\"" + ((Disk)rom).MD5 + "\""
+ separator + "\"" + ((Disk)rom).SHA1 + "\"" + separator + "\"" + ((Disk)rom).SHA1 + "\""
+ separator + (((Disk)rom).Nodump ? "\"Nodump\"" : "\"\""); + separator + (((Disk)rom).ItemStatus != ItemStatus.None ? "\"" + ((Disk)rom).ItemStatus.ToString() + "\"" : "\"\"");
state += pre + inline + post + "\n"; state += pre + inline + post + "\n";
} }
} }
@@ -3669,8 +3761,8 @@ namespace SabreTools.Helper
state += "<file type=\"disk\" name=\"" + HttpUtility.HtmlEncode(rom.Name) + "\"" state += "<file type=\"disk\" name=\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
+ (!String.IsNullOrEmpty(((Disk)rom).MD5) ? " md5=\"" + ((Disk)rom).MD5.ToLowerInvariant() + "\"" : "") + (!String.IsNullOrEmpty(((Disk)rom).MD5) ? " md5=\"" + ((Disk)rom).MD5.ToLowerInvariant() + "\"" : "")
+ (!String.IsNullOrEmpty(((Disk)rom).SHA1) ? " sha1=\"" + ((Disk)rom).SHA1.ToLowerInvariant() + "\"" : "") + (!String.IsNullOrEmpty(((Disk)rom).SHA1) ? " sha1=\"" + ((Disk)rom).SHA1.ToLowerInvariant() + "\"" : "")
+ (((Disk)rom).Nodump ? prefix + "/>\n" + prefix + "\t<flags>\n" + + (((Disk)rom).ItemStatus != ItemStatus.None ? prefix + "/>\n" + prefix + "\t<flags>\n" +
prefix + "\t\t<flag name=\"status\" value=\"nodump\"/>\n" + prefix + "\t\t<flag name=\"status\" value=\"" + ((Disk)rom).ItemStatus.ToString().ToLowerInvariant() + "\"/>\n" +
prefix + "\t</flags>\n" + prefix + "\t</flags>\n" +
prefix + "</file>\n" : "/>\n"); prefix + "</file>\n" : "/>\n");
break; break;
@@ -3691,8 +3783,8 @@ namespace SabreTools.Helper
+ (!String.IsNullOrEmpty(((Rom)rom).MD5) ? " md5=\"" + ((Rom)rom).MD5.ToLowerInvariant() + "\"" : "") + (!String.IsNullOrEmpty(((Rom)rom).MD5) ? " md5=\"" + ((Rom)rom).MD5.ToLowerInvariant() + "\"" : "")
+ (!String.IsNullOrEmpty(((Rom)rom).SHA1) ? " sha1=\"" + ((Rom)rom).SHA1.ToLowerInvariant() + "\"" : "") + (!String.IsNullOrEmpty(((Rom)rom).SHA1) ? " sha1=\"" + ((Rom)rom).SHA1.ToLowerInvariant() + "\"" : "")
+ (!String.IsNullOrEmpty(((Rom)rom).Date) ? " date=\"" + ((Rom)rom).Date + "\"" : "") + (!String.IsNullOrEmpty(((Rom)rom).Date) ? " date=\"" + ((Rom)rom).Date + "\"" : "")
+ (((Rom)rom).Nodump ? prefix + "/>\n" + prefix + "\t<flags>\n" + + (((Rom)rom).ItemStatus != ItemStatus.None ? prefix + "/>\n" + prefix + "\t<flags>\n" +
prefix + "\t\t<flag name=\"status\" value=\"nodump\"/>\n" + prefix + "\t\t<flag name=\"status\" value=\"" + ((Rom)rom).ItemStatus.ToString().ToLowerInvariant() + "\"/>\n" +
prefix + "\t</flags>\n" + prefix + "\t</flags>\n" +
prefix + "</file>\n" : "/>\n"); prefix + "</file>\n" : "/>\n");
break; break;
@@ -3721,7 +3813,7 @@ namespace SabreTools.Helper
state += "\t\t<disk name=\"" + HttpUtility.HtmlEncode(rom.Name) + "\"" state += "\t\t<disk name=\"" + HttpUtility.HtmlEncode(rom.Name) + "\""
+ (!String.IsNullOrEmpty(((Disk)rom).MD5) ? " md5=\"" + ((Disk)rom).MD5.ToLowerInvariant() + "\"" : "") + (!String.IsNullOrEmpty(((Disk)rom).MD5) ? " md5=\"" + ((Disk)rom).MD5.ToLowerInvariant() + "\"" : "")
+ (!String.IsNullOrEmpty(((Disk)rom).SHA1) ? " sha1=\"" + ((Disk)rom).SHA1.ToLowerInvariant() + "\"" : "") + (!String.IsNullOrEmpty(((Disk)rom).SHA1) ? " sha1=\"" + ((Disk)rom).SHA1.ToLowerInvariant() + "\"" : "")
+ (((Disk)rom).Nodump ? " status=\"nodump\"" : "") + (((Disk)rom).ItemStatus != ItemStatus.None ? " status=\"" + ((Disk)rom).ItemStatus.ToString().ToLowerInvariant() + "\"" : "")
+ "/>\n"; + "/>\n";
break; break;
case ItemType.Release: case ItemType.Release:
@@ -3741,7 +3833,7 @@ namespace SabreTools.Helper
+ (!String.IsNullOrEmpty(((Rom)rom).MD5) ? " md5=\"" + ((Rom)rom).MD5.ToLowerInvariant() + "\"" : "") + (!String.IsNullOrEmpty(((Rom)rom).MD5) ? " md5=\"" + ((Rom)rom).MD5.ToLowerInvariant() + "\"" : "")
+ (!String.IsNullOrEmpty(((Rom)rom).SHA1) ? " sha1=\"" + ((Rom)rom).SHA1.ToLowerInvariant() + "\"" : "") + (!String.IsNullOrEmpty(((Rom)rom).SHA1) ? " sha1=\"" + ((Rom)rom).SHA1.ToLowerInvariant() + "\"" : "")
+ (!String.IsNullOrEmpty(((Rom)rom).Date) ? " date=\"" + ((Rom)rom).Date + "\"" : "") + (!String.IsNullOrEmpty(((Rom)rom).Date) ? " date=\"" + ((Rom)rom).Date + "\"" : "")
+ (((Rom)rom).Nodump ? " status=\"nodump\"" : "") + (((Rom)rom).ItemStatus != ItemStatus.None ? " status=\"" + ((Rom)rom).ItemStatus.ToString().ToLowerInvariant() + "\"" : "")
+ "/>\n"; + "/>\n";
break; break;
case ItemType.Sample: case ItemType.Sample:
@@ -4138,8 +4230,8 @@ namespace SabreTools.Helper
} }
// If the file is a nodump // If the file is a nodump
if ((rom.Type == ItemType.Rom && ((Rom)rom).Nodump) if ((rom.Type == ItemType.Rom && ((Rom)rom).ItemStatus == ItemStatus.Nodump)
|| (rom.Type == ItemType.Disk && ((Disk)rom).Nodump)) || (rom.Type == ItemType.Disk && ((Disk)rom).ItemStatus == ItemStatus.Nodump))
{ {
if (nodump.Files.ContainsKey(key)) if (nodump.Files.ContainsKey(key))
{ {

View File

@@ -261,11 +261,11 @@ namespace SabreTools.Helper
Rom rom = (Rom)itemdata; Rom rom = (Rom)itemdata;
// Filter on nodump status // Filter on nodump status
if (nodump == true && !rom.Nodump) if (nodump == true && rom.ItemStatus != ItemStatus.Nodump)
{ {
return false; return false;
} }
if (nodump == false && rom.Nodump) if (nodump == false && rom.ItemStatus == ItemStatus.Nodump)
{ {
return false; return false;
} }
@@ -391,11 +391,11 @@ namespace SabreTools.Helper
Disk rom = (Disk)itemdata; Disk rom = (Disk)itemdata;
// Filter on nodump status // Filter on nodump status
if (nodump == true && !rom.Nodump) if (nodump == true && rom.ItemStatus != ItemStatus.Nodump)
{ {
return false; return false;
} }
if (nodump == false && rom.Nodump) if (nodump == false && rom.ItemStatus == ItemStatus.Nodump)
{ {
return false; return false;
} }
@@ -567,12 +567,12 @@ namespace SabreTools.Helper
foreach (DatItem file in infiles) foreach (DatItem file in infiles)
{ {
// If it's a nodump, add and skip // If it's a nodump, add and skip
if (file.Type == ItemType.Rom && ((Rom)file).Nodump) if (file.Type == ItemType.Rom && ((Rom)file).ItemStatus == ItemStatus.Nodump)
{ {
outfiles.Add(file); outfiles.Add(file);
continue; continue;
} }
else if (file.Type == ItemType.Disk && ((Disk)file).Nodump) else if (file.Type == ItemType.Disk && ((Disk)file).ItemStatus == ItemStatus.Nodump)
{ {
outfiles.Add(file); outfiles.Add(file);
continue; continue;

View File

@@ -10,8 +10,7 @@ namespace SabreTools.Helper
protected string _md5; protected string _md5;
protected string _sha1; protected string _sha1;
// private string _merge; // private string _merge;
// private DiskStatus _romStatus; protected ItemStatus _itemStatus;
protected bool _nodump;
#endregion #endregion
@@ -28,10 +27,10 @@ namespace SabreTools.Helper
get { return _sha1; } get { return _sha1; }
set { _sha1 = value; } set { _sha1 = value; }
} }
public bool Nodump public ItemStatus ItemStatus
{ {
get { return _nodump; } get { return _itemStatus; }
set { _nodump = value; } set { _itemStatus = value; }
} }
#endregion #endregion
@@ -46,7 +45,7 @@ namespace SabreTools.Helper
_name = ""; _name = "";
_itemType = ItemType.Disk; _itemType = ItemType.Disk;
_dupeType = DupeType.None; _dupeType = DupeType.None;
_nodump = false; _itemStatus = ItemStatus.None;
} }
/// <summary> /// <summary>
@@ -55,14 +54,14 @@ namespace SabreTools.Helper
/// <param name="name">Name of the item, including extension</param> /// <param name="name">Name of the item, including extension</param>
/// <param name="md5">String representation of the MD5</param> /// <param name="md5">String representation of the MD5</param>
/// <param name="sha1">String representation of the SHA-1</param> /// <param name="sha1">String representation of the SHA-1</param>
/// <param name="nodump">True if the file is a nodump, false otherwise</param> /// <param name="itemStatus">Status of the current item</param>
public Disk(string name, string md5, string sha1, bool nodump) public Disk(string name, string md5, string sha1, ItemStatus itemStatus)
{ {
_name = name; _name = name;
_itemType = ItemType.Disk; _itemType = ItemType.Disk;
_md5 = md5?.ToLowerInvariant(); _md5 = md5?.ToLowerInvariant();
_sha1 = sha1?.ToLowerInvariant(); _sha1 = sha1?.ToLowerInvariant();
_nodump = nodump; _itemStatus = itemStatus;
} }
/// <summary> /// <summary>
@@ -71,7 +70,7 @@ namespace SabreTools.Helper
/// <param name="name">Name of the item, including extension</param> /// <param name="name">Name of the item, including extension</param>
/// <param name="md5">String representation of the MD5</param> /// <param name="md5">String representation of the MD5</param>
/// <param name="sha1">String representation of the SHA-1</param> /// <param name="sha1">String representation of the SHA-1</param>
/// <param name="nodump">True if the file is a nodump, false otherwise</param> /// <param name="itemStatus">Status of the current item</param>
/// <param name="machineName">Name for the machine/game</param> /// <param name="machineName">Name for the machine/game</param>
/// <param name="comment">Comment for the machine/game</param> /// <param name="comment">Comment for the machine/game</param>
/// <param name="machineDescription">Description for the machine/game</param> /// <param name="machineDescription">Description for the machine/game</param>
@@ -88,7 +87,7 @@ namespace SabreTools.Helper
/// <param name="systemName">System Name to be associated with</param> /// <param name="systemName">System Name to be associated with</param>
/// <param name="sourceId">Source ID to be associated with</param> /// <param name="sourceId">Source ID to be associated with</param>
/// <param name="sourceName">Source Name to be associated with</param> /// <param name="sourceName">Source Name to be associated with</param>
public Disk(string name, string md5, string sha1, bool nodump, string machineName, string comment, public Disk(string name, string md5, string sha1, ItemStatus itemStatus, string machineName, string comment,
string machineDescription, string year, string manufacturer, string romOf, string cloneOf, string sampleOf, string sourceFile, string machineDescription, string year, string manufacturer, string romOf, string cloneOf, string sampleOf, string sourceFile,
bool isBios, string board, string rebuildTo, int systemId, string systemName, int sourceId, string sourceName) bool isBios, string board, string rebuildTo, int systemId, string systemName, int sourceId, string sourceName)
{ {
@@ -96,7 +95,7 @@ namespace SabreTools.Helper
_itemType = ItemType.Disk; _itemType = ItemType.Disk;
_md5 = md5?.ToLowerInvariant(); _md5 = md5?.ToLowerInvariant();
_sha1 = sha1?.ToLowerInvariant(); _sha1 = sha1?.ToLowerInvariant();
_nodump = nodump; _itemStatus = itemStatus;
_machineName = machineName; _machineName = machineName;
_comment = comment; _comment = comment;
_machineDescription = machineDescription; _machineDescription = machineDescription;
@@ -133,7 +132,7 @@ namespace SabreTools.Helper
Disk newOther = (Disk)other; Disk newOther = (Disk)other;
// If either is a nodump, it's never a match // If either is a nodump, it's never a match
if (_nodump || newOther.Nodump) if (_itemStatus == ItemStatus.Nodump || newOther.ItemStatus == ItemStatus.Nodump)
{ {
return dupefound; return dupefound;
} }

View File

@@ -44,7 +44,7 @@ namespace SabreTools.Helper
_name = ""; _name = "";
_itemType = ItemType.Rom; _itemType = ItemType.Rom;
_dupeType = DupeType.None; _dupeType = DupeType.None;
_nodump = false; _itemStatus = ItemStatus.None;
_date = ""; _date = "";
} }
@@ -54,7 +54,7 @@ namespace SabreTools.Helper
/// <param name="name"></param> /// <param name="name"></param>
/// <param name="machineName"></param> /// <param name="machineName"></param>
public Rom(string name, string machineName) : public Rom(string name, string machineName) :
this(name, -1, "null", "null", "null", false, null, machineName, null, machineName, null, null, null, null, null, null, false, null, null, -1, null, -1, null) this(name, -1, "null", "null", "null", ItemStatus.None, null, machineName, null, machineName, null, null, null, null, null, null, false, null, null, -1, null, -1, null)
{ {
} }
@@ -66,9 +66,9 @@ namespace SabreTools.Helper
/// <param name="crc">String representation of the CRC</param> /// <param name="crc">String representation of the CRC</param>
/// <param name="md5">String representation of the MD5</param> /// <param name="md5">String representation of the MD5</param>
/// <param name="sha1">String representation of the SHA-1</param> /// <param name="sha1">String representation of the SHA-1</param>
/// <param name="nodump">True if the file is a nodump, false otherwise</param> /// <param name="itemStatus">Status of the current item</param>
/// <param name="date">String representation of the Date</param> /// <param name="date">String representation of the Date</param>
public Rom(string name, long size, string crc, string md5, string sha1, bool nodump, string date) public Rom(string name, long size, string crc, string md5, string sha1, ItemStatus itemStatus, string date)
{ {
_name = name; _name = name;
_itemType = ItemType.Rom; _itemType = ItemType.Rom;
@@ -76,7 +76,7 @@ namespace SabreTools.Helper
_crc = crc?.ToLowerInvariant(); _crc = crc?.ToLowerInvariant();
_md5 = md5?.ToLowerInvariant(); _md5 = md5?.ToLowerInvariant();
_sha1 = sha1?.ToLowerInvariant(); _sha1 = sha1?.ToLowerInvariant();
_nodump = nodump; _itemStatus = itemStatus;
_date = date; _date = date;
} }
@@ -88,7 +88,7 @@ namespace SabreTools.Helper
/// <param name="crc">String representation of the CRC</param> /// <param name="crc">String representation of the CRC</param>
/// <param name="md5">String representation of the MD5</param> /// <param name="md5">String representation of the MD5</param>
/// <param name="sha1">String representation of the SHA-1</param> /// <param name="sha1">String representation of the SHA-1</param>
/// <param name="nodump">True if the file is a nodump, false otherwise</param> /// <param name="itemStatus">Status of the current item</param>
/// <param name="date">String representation of the Date</param> /// <param name="date">String representation of the Date</param>
/// <param name="machineName">Name for the machine/game</param> /// <param name="machineName">Name for the machine/game</param>
/// <param name="comment">Comment for the machine/game</param> /// <param name="comment">Comment for the machine/game</param>
@@ -106,7 +106,7 @@ namespace SabreTools.Helper
/// <param name="systemName">System Name to be associated with</param> /// <param name="systemName">System Name to be associated with</param>
/// <param name="sourceId">Source ID to be associated with</param> /// <param name="sourceId">Source ID to be associated with</param>
/// <param name="sourceName">Source Name to be associated with</param> /// <param name="sourceName">Source Name to be associated with</param>
public Rom(string name, long size, string crc, string md5, string sha1, bool nodump, string date, string machineName, public Rom(string name, long size, string crc, string md5, string sha1, ItemStatus itemStatus, string date, string machineName,
string comment, string machineDescription, string year, string manufacturer, string romOf, string cloneOf, string sampleOf, string comment, string machineDescription, string year, string manufacturer, string romOf, string cloneOf, string sampleOf,
string sourceFile, bool isBios, string board, string rebuildTo, int systemId, string systemName, int sourceId, string sourceName) string sourceFile, bool isBios, string board, string rebuildTo, int systemId, string systemName, int sourceId, string sourceName)
{ {
@@ -116,7 +116,7 @@ namespace SabreTools.Helper
_crc = crc?.ToLowerInvariant(); _crc = crc?.ToLowerInvariant();
_md5 = md5?.ToLowerInvariant(); _md5 = md5?.ToLowerInvariant();
_sha1 = sha1?.ToLowerInvariant(); _sha1 = sha1?.ToLowerInvariant();
_nodump = nodump; _itemStatus = itemStatus;
_date = date; _date = date;
_machineName = machineName; _machineName = machineName;
_comment = comment; _comment = comment;
@@ -154,7 +154,7 @@ namespace SabreTools.Helper
Rom newOther = (Rom)other; Rom newOther = (Rom)other;
// If either is a nodump, it's never a match // If either is a nodump, it's never a match
if (_nodump || newOther.Nodump) if (_itemStatus == ItemStatus.Nodump || newOther.ItemStatus == ItemStatus.Nodump)
{ {
return dupefound; return dupefound;
} }

View File

@@ -122,11 +122,11 @@ Please check the log folder if the stats scrolled offscreen");
{ {
datdata.RomCount += (rom.Type == ItemType.Rom ? 1 : 0); datdata.RomCount += (rom.Type == ItemType.Rom ? 1 : 0);
datdata.DiskCount += (rom.Type == ItemType.Disk ? 1 : 0); datdata.DiskCount += (rom.Type == ItemType.Disk ? 1 : 0);
datdata.TotalSize += (rom.Nodump ? 0 : rom.Size); datdata.TotalSize += (rom.ItemStatus == ItemStatus.Nodump ? 0 : rom.Size);
datdata.CRCCount += (String.IsNullOrEmpty(rom.CRC) ? 0 : 1); datdata.CRCCount += (String.IsNullOrEmpty(rom.CRC) ? 0 : 1);
datdata.MD5Count += (String.IsNullOrEmpty(rom.MD5) ? 0 : 1); datdata.MD5Count += (String.IsNullOrEmpty(rom.MD5) ? 0 : 1);
datdata.SHA1Count += (String.IsNullOrEmpty(rom.SHA1) ? 0 : 1); datdata.SHA1Count += (String.IsNullOrEmpty(rom.SHA1) ? 0 : 1);
datdata.NodumpCount += (rom.Nodump ? 1 : 0); datdata.NodumpCount += (rom.ItemStatus == ItemStatus.Nodump ? 1 : 0);
} }
} }
} }