mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[ALL] Fix CMP parsing again, add NotNodump option for filter
This commit is contained in:
@@ -226,7 +226,7 @@ namespace SabreTools.Helper
|
|||||||
helptext.Add(" -sha1=, --sha1= Filter by SHA-1 hash");
|
helptext.Add(" -sha1=, --sha1= Filter by SHA-1 hash");
|
||||||
helptext.Add(" -is=, --status= Include only items with a given status");
|
helptext.Add(" -is=, --status= Include only items with a given status");
|
||||||
helptext.Add(" Supported values are:");
|
helptext.Add(" Supported values are:");
|
||||||
helptext.Add(" None, Good, BadDump, Nodump, Verified");
|
helptext.Add(" None, Good, BadDump, Nodump, Verified, NotNodump");
|
||||||
helptext.Add(" -out= Output directory (overridden by --inplace)");
|
helptext.Add(" -out= Output directory (overridden by --inplace)");
|
||||||
helptext.Add("");
|
helptext.Add("");
|
||||||
helptext.Add("Filenames and directories can't start with a reserved string");
|
helptext.Add("Filenames and directories can't start with a reserved string");
|
||||||
|
|||||||
@@ -88,12 +88,13 @@
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public enum ItemStatus
|
public enum ItemStatus
|
||||||
{
|
{
|
||||||
NULL = -1,
|
NULL = -1, // This is a fake flag that is used for filter only
|
||||||
None = 0,
|
None = 0,
|
||||||
Good = 1,
|
Good = 1,
|
||||||
BadDump = 2,
|
BadDump = 2,
|
||||||
Nodump = 3,
|
Nodump = 3,
|
||||||
Verified = 4,
|
Verified = 4,
|
||||||
|
NotNodump = 5, // This is a fake flag that is used for filter only
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -819,8 +819,30 @@ namespace SabreTools.Helper
|
|||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Special case for itemStatus...
|
// Special cases for item statuses
|
||||||
else if (gc[i] == "itemStatus" && attrib != "status" && attrib != "flags")
|
else if (gc[i] == "good" && attrib != "status" && attrib != "flags")
|
||||||
|
{
|
||||||
|
if (item.Type == ItemType.Rom)
|
||||||
|
{
|
||||||
|
((Rom)item).ItemStatus = ItemStatus.Good;
|
||||||
|
}
|
||||||
|
else if (item.Type == ItemType.Disk)
|
||||||
|
{
|
||||||
|
((Disk)item).ItemStatus = ItemStatus.Good;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (gc[i] == "baddump" && attrib != "status" && attrib != "flags")
|
||||||
|
{
|
||||||
|
if (item.Type == ItemType.Rom)
|
||||||
|
{
|
||||||
|
((Rom)item).ItemStatus = ItemStatus.BadDump;
|
||||||
|
}
|
||||||
|
else if (item.Type == ItemType.Disk)
|
||||||
|
{
|
||||||
|
((Disk)item).ItemStatus = ItemStatus.BadDump;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (gc[i] == "nodump" && attrib != "status" && attrib != "flags")
|
||||||
{
|
{
|
||||||
if (item.Type == ItemType.Rom)
|
if (item.Type == ItemType.Rom)
|
||||||
{
|
{
|
||||||
@@ -831,6 +853,17 @@ namespace SabreTools.Helper
|
|||||||
((Disk)item).ItemStatus = ItemStatus.Nodump;
|
((Disk)item).ItemStatus = ItemStatus.Nodump;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if (gc[i] == "verified" && attrib != "status" && attrib != "flags")
|
||||||
|
{
|
||||||
|
if (item.Type == ItemType.Rom)
|
||||||
|
{
|
||||||
|
((Rom)item).ItemStatus = ItemStatus.Verified;
|
||||||
|
}
|
||||||
|
else if (item.Type == ItemType.Disk)
|
||||||
|
{
|
||||||
|
((Disk)item).ItemStatus = ItemStatus.Verified;
|
||||||
|
}
|
||||||
|
}
|
||||||
// Even number of quotes, not in a quote, not in attribute
|
// Even number of quotes, not in a quote, not in attribute
|
||||||
else if (Regex.Matches(gc[i], "\"").Count % 2 == 0 && !quote && attrib == "")
|
else if (Regex.Matches(gc[i], "\"").Count % 2 == 0 && !quote && attrib == "")
|
||||||
{
|
{
|
||||||
@@ -934,6 +967,48 @@ namespace SabreTools.Helper
|
|||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Special cases for item statuses
|
||||||
|
case "good":
|
||||||
|
if (item.Type == ItemType.Rom)
|
||||||
|
{
|
||||||
|
((Rom)item).ItemStatus = ItemStatus.Good;
|
||||||
|
}
|
||||||
|
else if (item.Type == ItemType.Disk)
|
||||||
|
{
|
||||||
|
((Disk)item).ItemStatus = ItemStatus.Good;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "baddump":
|
||||||
|
if (item.Type == ItemType.Rom)
|
||||||
|
{
|
||||||
|
((Rom)item).ItemStatus = ItemStatus.BadDump;
|
||||||
|
}
|
||||||
|
else if (item.Type == ItemType.Disk)
|
||||||
|
{
|
||||||
|
((Disk)item).ItemStatus = ItemStatus.BadDump;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "nodump":
|
||||||
|
if (item.Type == ItemType.Rom)
|
||||||
|
{
|
||||||
|
((Rom)item).ItemStatus = ItemStatus.Nodump;
|
||||||
|
}
|
||||||
|
else if (item.Type == ItemType.Disk)
|
||||||
|
{
|
||||||
|
((Disk)item).ItemStatus = ItemStatus.Nodump;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case "verified":
|
||||||
|
if (item.Type == ItemType.Rom)
|
||||||
|
{
|
||||||
|
((Rom)item).ItemStatus = ItemStatus.Verified;
|
||||||
|
}
|
||||||
|
else if (item.Type == ItemType.Disk)
|
||||||
|
{
|
||||||
|
((Disk)item).ItemStatus = ItemStatus.Verified;
|
||||||
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
attrib = "";
|
attrib = "";
|
||||||
|
|||||||
@@ -261,10 +261,17 @@ namespace SabreTools.Helper
|
|||||||
Rom rom = (Rom)itemdata;
|
Rom rom = (Rom)itemdata;
|
||||||
|
|
||||||
// Filter on status
|
// Filter on status
|
||||||
if (itemStatus != ItemStatus.NULL && rom.ItemStatus != itemStatus)
|
if (itemStatus != ItemStatus.NULL)
|
||||||
|
{
|
||||||
|
if (itemStatus == ItemStatus.NotNodump && rom.ItemStatus == ItemStatus.Nodump)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
else if (itemStatus != ItemStatus.NotNodump && rom.ItemStatus != itemStatus)
|
||||||
|
{
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Filter on rom size
|
// Filter on rom size
|
||||||
if (seq != -1 && rom.Size != seq)
|
if (seq != -1 && rom.Size != seq)
|
||||||
|
|||||||
@@ -553,7 +553,7 @@ Options:
|
|||||||
|
|
||||||
-is=, status= Include only items with a given status
|
-is=, status= Include only items with a given status
|
||||||
Include items with one of the supported values:
|
Include items with one of the supported values:
|
||||||
None, Good, BadDump, Nodump, Verified
|
None, Good, BadDump, Nodump, Verified, NotNodump
|
||||||
|
|
||||||
-out= Set the name of the output directory
|
-out= Set the name of the output directory
|
||||||
This sets an output folder to be used when the files are created. If a path
|
This sets an output folder to be used when the files are created. If a path
|
||||||
|
|||||||
@@ -513,6 +513,9 @@ namespace SabreTools
|
|||||||
case "verified":
|
case "verified":
|
||||||
itemStatus = ItemStatus.Verified;
|
itemStatus = ItemStatus.Verified;
|
||||||
break;
|
break;
|
||||||
|
case "notnodump":
|
||||||
|
itemStatus = ItemStatus.NotNodump;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Normalize the extensions
|
// Normalize the extensions
|
||||||
|
|||||||
@@ -216,10 +216,18 @@ namespace SabreTools
|
|||||||
case "--merge":
|
case "--merge":
|
||||||
merge = true;
|
merge = true;
|
||||||
break;
|
break;
|
||||||
|
case "-nd":
|
||||||
|
case "--nodump":
|
||||||
|
status = "Nodump";
|
||||||
|
break;
|
||||||
case "-nm":
|
case "-nm":
|
||||||
case "--noMD5":
|
case "--noMD5":
|
||||||
noMD5 = true;
|
noMD5 = true;
|
||||||
break;
|
break;
|
||||||
|
case "-nnd":
|
||||||
|
case "--not-nodump":
|
||||||
|
status = "NotNodump";
|
||||||
|
break;
|
||||||
case "-ns":
|
case "-ns":
|
||||||
case "--noSHA1":
|
case "--noSHA1":
|
||||||
noSHA1 = true;
|
noSHA1 = true;
|
||||||
|
|||||||
Reference in New Issue
Block a user