mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[SabreTools] Implement flags further down
This commit is contained in:
@@ -264,12 +264,12 @@ namespace SabreTools.Helper.Data
|
|||||||
[Flags]
|
[Flags]
|
||||||
public enum ItemStatus
|
public enum ItemStatus
|
||||||
{
|
{
|
||||||
NULL = -0x01, // This is a fake flag that is used for filter only
|
NULL = 0x00, // This is a fake flag that is used for filter only
|
||||||
None = 0x00,
|
None = 0x01,
|
||||||
Good = 0x01,
|
Good = 0x02,
|
||||||
BadDump = 0x02,
|
BadDump = 0x04,
|
||||||
Nodump = 0x04,
|
Nodump = 0x08,
|
||||||
Verified = 0x08,
|
Verified = 0x10,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -278,11 +278,11 @@ namespace SabreTools.Helper.Data
|
|||||||
[Flags]
|
[Flags]
|
||||||
public enum MachineType
|
public enum MachineType
|
||||||
{
|
{
|
||||||
NULL = -0x01, // This is a fake flag used for filter only
|
NULL = 0x00, // This is a fake flag used for filter only
|
||||||
None = 0x00,
|
None = 0x01,
|
||||||
Bios = 0x01,
|
Bios = 0x02,
|
||||||
Device = 0x02,
|
Device = 0x04,
|
||||||
Mechanical = 0x04,
|
Mechanical = 0x08,
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -436,16 +436,16 @@ namespace SabreTools
|
|||||||
/// <param name="crc">CRC of the rom to match (can use asterisk-partials)</param>
|
/// <param name="crc">CRC of the rom to match (can use asterisk-partials)</param>
|
||||||
/// <param name="md5">MD5 of the rom to match (can use asterisk-partials)</param>
|
/// <param name="md5">MD5 of the rom to match (can use asterisk-partials)</param>
|
||||||
/// <param name="sha1">SHA-1 of the rom to match (can use asterisk-partials)</param>
|
/// <param name="sha1">SHA-1 of the rom to match (can use asterisk-partials)</param>
|
||||||
/// <param name="status">Select roms with the given item status</param>
|
/// <param name="statuses">Select roms with the given item statuses</param>
|
||||||
/// <param name="gametype">Select games with the given type</param>
|
/// <param name="gametypes">Select games with the given types</param>
|
||||||
/// <param name="notgamename">Name of the game to match (can use asterisk-partials)</param>
|
/// <param name="notgamename">Name of the game to match (can use asterisk-partials)</param>
|
||||||
/// <param name="notromname">Name of the rom to match (can use asterisk-partials)</param>
|
/// <param name="notromname">Name of the rom to match (can use asterisk-partials)</param>
|
||||||
/// <param name="notromtype">Type of the rom to match</param>
|
/// <param name="notromtype">Type of the rom to match</param>
|
||||||
/// <param name="notcrc">CRC of the rom to match (can use asterisk-partials)</param>
|
/// <param name="notcrc">CRC of the rom to match (can use asterisk-partials)</param>
|
||||||
/// <param name="notmd5">MD5 of the rom to match (can use asterisk-partials)</param>
|
/// <param name="notmd5">MD5 of the rom to match (can use asterisk-partials)</param>
|
||||||
/// <param name="notsha1">SHA-1 of the rom to match (can use asterisk-partials)</param>
|
/// <param name="notsha1">SHA-1 of the rom to match (can use asterisk-partials)</param>
|
||||||
/// <param name="notstatus">Select roms without the given item status</param>
|
/// <param name="notstatuses">Select roms without the given item statuses</param>
|
||||||
/// <param name="notgametype">Select games without the given type</param>
|
/// <param name="notgametypes">Select games without the given types</param>
|
||||||
/// <param name="runnable">Select games with the given runability</param>
|
/// <param name="runnable">Select games with the given runability</param>
|
||||||
/// /* Trimming info */
|
/// /* Trimming info */
|
||||||
/// <param name="splitType">Type of the split that should be performed (split, merged, fully merged)</param>
|
/// <param name="splitType">Type of the split that should be performed (split, merged, fully merged)</param>
|
||||||
@@ -509,16 +509,16 @@ namespace SabreTools
|
|||||||
string crc,
|
string crc,
|
||||||
string md5,
|
string md5,
|
||||||
string sha1,
|
string sha1,
|
||||||
string status,
|
List<string> statuses,
|
||||||
string gametype,
|
List<string> gametypes,
|
||||||
string notgamename,
|
string notgamename,
|
||||||
string notromname,
|
string notromname,
|
||||||
string notromtype,
|
string notromtype,
|
||||||
string notcrc,
|
string notcrc,
|
||||||
string notmd5,
|
string notmd5,
|
||||||
string notsha1,
|
string notsha1,
|
||||||
string notstatus,
|
List<string> notstatuses,
|
||||||
string notgametype,
|
List<string> notgametypes,
|
||||||
bool? runnable,
|
bool? runnable,
|
||||||
|
|
||||||
/* Trimming info */
|
/* Trimming info */
|
||||||
@@ -587,68 +587,80 @@ namespace SabreTools
|
|||||||
|
|
||||||
// Set the status flag for filtering
|
// Set the status flag for filtering
|
||||||
ItemStatus itemStatus = ItemStatus.NULL;
|
ItemStatus itemStatus = ItemStatus.NULL;
|
||||||
switch(status?.ToLowerInvariant())
|
foreach (string status in statuses)
|
||||||
|
{
|
||||||
|
switch (status.ToLowerInvariant())
|
||||||
{
|
{
|
||||||
case "none":
|
case "none":
|
||||||
itemStatus = ItemStatus.None;
|
itemStatus |= ItemStatus.None;
|
||||||
break;
|
break;
|
||||||
case "good":
|
case "good":
|
||||||
itemStatus = ItemStatus.Good;
|
itemStatus |= ItemStatus.Good;
|
||||||
break;
|
break;
|
||||||
case "baddump":
|
case "baddump":
|
||||||
itemStatus = ItemStatus.BadDump;
|
itemStatus |= ItemStatus.BadDump;
|
||||||
break;
|
break;
|
||||||
case "nodump":
|
case "nodump":
|
||||||
itemStatus = ItemStatus.Nodump;
|
itemStatus |= ItemStatus.Nodump;
|
||||||
break;
|
break;
|
||||||
case "verified":
|
case "verified":
|
||||||
itemStatus = ItemStatus.Verified;
|
itemStatus |= ItemStatus.Verified;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Set the not status flag for filtering
|
// Set the not status flag for filtering
|
||||||
ItemStatus itemNotStatus = ItemStatus.NULL;
|
ItemStatus itemNotStatus = ItemStatus.NULL;
|
||||||
switch (notstatus?.ToLowerInvariant())
|
foreach (string status in notstatuses)
|
||||||
|
{
|
||||||
|
switch (status.ToLowerInvariant())
|
||||||
{
|
{
|
||||||
case "none":
|
case "none":
|
||||||
itemNotStatus = ItemStatus.None;
|
itemNotStatus |= ItemStatus.None;
|
||||||
break;
|
break;
|
||||||
case "good":
|
case "good":
|
||||||
itemNotStatus = ItemStatus.Good;
|
itemNotStatus |= ItemStatus.Good;
|
||||||
break;
|
break;
|
||||||
case "baddump":
|
case "baddump":
|
||||||
itemNotStatus = ItemStatus.BadDump;
|
itemNotStatus |= ItemStatus.BadDump;
|
||||||
break;
|
break;
|
||||||
case "nodump":
|
case "nodump":
|
||||||
itemNotStatus = ItemStatus.Nodump;
|
itemNotStatus |= ItemStatus.Nodump;
|
||||||
break;
|
break;
|
||||||
case "verified":
|
case "verified":
|
||||||
itemNotStatus = ItemStatus.Verified;
|
itemNotStatus |= ItemStatus.Verified;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Set the machine type flag for filtering
|
// Set the machine type flag for filtering
|
||||||
MachineType machineType = MachineType.NULL;
|
MachineType machineType = MachineType.NULL;
|
||||||
switch(gametype?.ToLowerInvariant())
|
foreach (string gametype in gametypes)
|
||||||
|
{
|
||||||
|
switch (gametype.ToLowerInvariant())
|
||||||
{
|
{
|
||||||
case "none":
|
case "none":
|
||||||
machineType = MachineType.None;
|
machineType |= MachineType.None;
|
||||||
break;
|
break;
|
||||||
case "bios":
|
case "bios":
|
||||||
machineType = MachineType.Bios;
|
machineType |= MachineType.Bios;
|
||||||
break;
|
break;
|
||||||
|
case "dev":
|
||||||
case "device":
|
case "device":
|
||||||
machineType = MachineType.Device;
|
machineType |= MachineType.Device;
|
||||||
break;
|
break;
|
||||||
case "mech":
|
case "mech":
|
||||||
case "mechanical":
|
case "mechanical":
|
||||||
machineType = MachineType.Mechanical;
|
machineType |= MachineType.Mechanical;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Set the not machine type flag for filtering
|
// Set the not machine type flag for filtering
|
||||||
MachineType machineNotType = MachineType.NULL;
|
MachineType machineNotType = MachineType.NULL;
|
||||||
switch (notgametype?.ToLowerInvariant())
|
foreach (string gametype in notgametypes)
|
||||||
|
{
|
||||||
|
switch (gametype.ToLowerInvariant())
|
||||||
{
|
{
|
||||||
case "none":
|
case "none":
|
||||||
machineNotType = MachineType.None;
|
machineNotType = MachineType.None;
|
||||||
@@ -665,6 +677,7 @@ namespace SabreTools
|
|||||||
machineNotType = MachineType.Mechanical;
|
machineNotType = MachineType.Mechanical;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// Normalize the extensions
|
// Normalize the extensions
|
||||||
addext = (addext == "" || addext.StartsWith(".") ? addext : "." + addext);
|
addext = (addext == "" || addext.StartsWith(".") ? addext : "." + addext);
|
||||||
|
|||||||
@@ -129,19 +129,16 @@ namespace SabreTools
|
|||||||
forcend = "",
|
forcend = "",
|
||||||
forcepack = "",
|
forcepack = "",
|
||||||
gamename = "",
|
gamename = "",
|
||||||
gametype = "",
|
|
||||||
header = null,
|
header = null,
|
||||||
homepage = null,
|
homepage = null,
|
||||||
md5 = "",
|
md5 = "",
|
||||||
name = null,
|
name = null,
|
||||||
notcrc = null,
|
notcrc = null,
|
||||||
notgamename = null,
|
notgamename = null,
|
||||||
notgametype = "",
|
|
||||||
notmd5 = null,
|
notmd5 = null,
|
||||||
notromname = null,
|
notromname = null,
|
||||||
notromtype = null,
|
notromtype = null,
|
||||||
notsha1 = null,
|
notsha1 = null,
|
||||||
notstatus = null,
|
|
||||||
outDir = "",
|
outDir = "",
|
||||||
postfix = "",
|
postfix = "",
|
||||||
prefix = "",
|
prefix = "",
|
||||||
@@ -151,12 +148,15 @@ namespace SabreTools
|
|||||||
root = "",
|
root = "",
|
||||||
rootdir = null,
|
rootdir = null,
|
||||||
sha1 = "",
|
sha1 = "",
|
||||||
status = "",
|
|
||||||
tempDir = "",
|
tempDir = "",
|
||||||
url = null,
|
url = null,
|
||||||
version = null;
|
version = null;
|
||||||
List<string> datfiles = new List<string>(); // SimpleSort
|
List<string> datfiles = new List<string>(); // SimpleSort
|
||||||
|
List<string> gametype = new List<string>();
|
||||||
List<string> inputs = new List<string>();
|
List<string> inputs = new List<string>();
|
||||||
|
List<string> notgametype = new List<string>();
|
||||||
|
List<string> notstatus = new List<string>();
|
||||||
|
List<string> status = new List<string>();
|
||||||
|
|
||||||
// Determine which switches are enabled (with values if necessary)
|
// Determine which switches are enabled (with values if necessary)
|
||||||
for (int i = 0; i < args.Length; i++)
|
for (int i = 0; i < args.Length; i++)
|
||||||
@@ -570,7 +570,7 @@ namespace SabreTools
|
|||||||
break;
|
break;
|
||||||
case "-gt":
|
case "-gt":
|
||||||
case "--game-type":
|
case "--game-type":
|
||||||
gametype = args[++i];
|
gametype.Add(args[++i]);
|
||||||
break;
|
break;
|
||||||
case "-gz":
|
case "-gz":
|
||||||
case "--gz":
|
case "--gz":
|
||||||
@@ -589,7 +589,7 @@ namespace SabreTools
|
|||||||
break;
|
break;
|
||||||
case "-is":
|
case "-is":
|
||||||
case "--status":
|
case "--status":
|
||||||
status = args[++i];
|
status.Add(args[++i]);
|
||||||
break;
|
break;
|
||||||
case "-md5":
|
case "-md5":
|
||||||
case "--md5":
|
case "--md5":
|
||||||
@@ -613,11 +613,11 @@ namespace SabreTools
|
|||||||
break;
|
break;
|
||||||
case "-ngt":
|
case "-ngt":
|
||||||
case "--not-gtype":
|
case "--not-gtype":
|
||||||
notgametype = args[++i];
|
notgametype.Add(args[++i]);
|
||||||
break;
|
break;
|
||||||
case "-nis":
|
case "-nis":
|
||||||
case "--not-status":
|
case "--not-status":
|
||||||
notstatus = args[++i];
|
notstatus.Add(args[++i]);
|
||||||
break;
|
break;
|
||||||
case "-nmd5":
|
case "-nmd5":
|
||||||
case "--not-md5":
|
case "--not-md5":
|
||||||
@@ -803,7 +803,7 @@ namespace SabreTools
|
|||||||
break;
|
break;
|
||||||
case "-gt":
|
case "-gt":
|
||||||
case "--game-type":
|
case "--game-type":
|
||||||
gametype = split[1];
|
gametype.Add(split[1]);
|
||||||
break;
|
break;
|
||||||
case "-gz":
|
case "-gz":
|
||||||
case "--gz":
|
case "--gz":
|
||||||
@@ -822,7 +822,7 @@ namespace SabreTools
|
|||||||
break;
|
break;
|
||||||
case "-is":
|
case "-is":
|
||||||
case "--status":
|
case "--status":
|
||||||
status = split[1];
|
status.Add(split[1]);
|
||||||
break;
|
break;
|
||||||
case "-md5":
|
case "-md5":
|
||||||
case "--md5":
|
case "--md5":
|
||||||
@@ -846,11 +846,11 @@ namespace SabreTools
|
|||||||
break;
|
break;
|
||||||
case "-ngt":
|
case "-ngt":
|
||||||
case "--not-gtype":
|
case "--not-gtype":
|
||||||
notgametype = split[1];
|
notgametype.Add(split[1]);
|
||||||
break;
|
break;
|
||||||
case "-nis":
|
case "-nis":
|
||||||
case "--not-status":
|
case "--not-status":
|
||||||
notstatus = split[1];
|
notstatus.Add(split[1]);
|
||||||
break;
|
break;
|
||||||
case "-nmd5":
|
case "-nmd5":
|
||||||
case "--not-md5":
|
case "--not-md5":
|
||||||
|
|||||||
Reference in New Issue
Block a user