[SabreTools, Filter] Fully implement new flags

This commit is contained in:
Matt Nadareski
2017-01-11 17:27:25 -08:00
parent 2419de8777
commit 6488e294bc
5 changed files with 655 additions and 478 deletions

View File

@@ -398,6 +398,10 @@ namespace SabreTools.Helper.Data
helptext.Add(""); helptext.Add("");
helptext.Add("Filter parameters for size can use postfixes for inputs:"); helptext.Add("Filter parameters for size can use postfixes for inputs:");
helptext.Add(" e.g. 8kb => 8000 or 8kib => 8192"); helptext.Add(" e.g. 8kb => 8000 or 8kib => 8192");
helptext.Add("");
helptext.Add("Most of the filter parameters allow for multiple inputs:");
helptext.Add(" e.g. --game-name=foo --game-name=bar");
break; break;
default: default:

File diff suppressed because it is too large Load Diff

View File

@@ -823,12 +823,15 @@ Options:
00* means starts with '00' 00* means starts with '00'
*00* means contains '00' *00* means contains '00'
00 means exactly equals '00' 00 means exactly equals '00'
Multiples of each of the above inputs are allowed.
-rt=, --rom-type= Filter by rom type -rt=, --rom-type= Filter by rom type
This allows users to only include roms or disks to their liking This allows users to only include roms or disks to their liking. Multiples of this
input are allowed.
-nrt=, --not-type= Exclude by rom type -nrt=, --not-type= Exclude by rom type
This allows users to only exclude roms or disks to their liking This allows users to only exclude roms or disks to their liking. Multiples of this
input are allowed.
-sgt=, --greater= Filter by size >= -sgt=, --greater= Filter by size >=
-slt=, --less= Filter by size <= -slt=, --less= Filter by size <=

View File

@@ -427,23 +427,23 @@ namespace SabreTools
/// <param name="skip">True if the first cascaded diff file should be skipped on output, false otherwise</param> /// <param name="skip">True if the first cascaded diff file should be skipped on output, false otherwise</param>
/// <param name="bare">True if the date should not be appended to the default name, false otherwise [OBSOLETE]</param> /// <param name="bare">True if the date should not be appended to the default name, false otherwise [OBSOLETE]</param>
/// /* Filtering info */ /// /* Filtering info */
/// <param name="gamename">Name of the game to match (can use asterisk-partials)</param> /// <param name="gamenames">Names of the games to match (can use asterisk-partials)</param>
/// <param name="romname">Name of the rom to match (can use asterisk-partials)</param> /// <param name="romnames">Names of the roms to match (can use asterisk-partials)</param>
/// <param name="romtype">Type of the rom to match</param> /// <param name="romtypes">Types of the roms to match</param>
/// <param name="sgt">Find roms greater than or equal to this size</param> /// <param name="sgt">Find roms greater than or equal to this size</param>
/// <param name="slt">Find roms less than or equal to this size</param> /// <param name="slt">Find roms less than or equal to this size</param>
/// <param name="seq">Find roms equal to this size</param> /// <param name="seq">Find roms equal to this size</param>
/// <param name="crc">CRC of the rom to match (can use asterisk-partials)</param> /// <param name="crcs">CRCs of the roms to match (can use asterisk-partials)</param>
/// <param name="md5">MD5 of the rom to match (can use asterisk-partials)</param> /// <param name="md5s">MD5s of the roms to match (can use asterisk-partials)</param>
/// <param name="sha1">SHA-1 of the rom to match (can use asterisk-partials)</param> /// <param name="sha1s">SHA-1s of the roms to match (can use asterisk-partials)</param>
/// <param name="statuses">Select roms with the given item statuses</param> /// <param name="statuses">Select roms with the given item statuses</param>
/// <param name="gametypes">Select games with the given types</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="notgamenames">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="notromnames">Name of the rom to match (can use asterisk-partials)</param>
/// <param name="notromtype">Type of the rom to match</param> /// <param name="notromtypes">Type of the rom to match</param>
/// <param name="notcrc">CRC of the rom to match (can use asterisk-partials)</param> /// <param name="notcrcs">CRCs of the roms to match (can use asterisk-partials)</param>
/// <param name="notmd5">MD5 of the rom to match (can use asterisk-partials)</param> /// <param name="notmd5s">MD5s of the roms to match (can use asterisk-partials)</param>
/// <param name="notsha1">SHA-1 of the rom to match (can use asterisk-partials)</param> /// <param name="notsha1s">SHA-1s of the roms to match (can use asterisk-partials)</param>
/// <param name="notstatuses">Select roms without the given item statuses</param> /// <param name="notstatuses">Select roms without the given item statuses</param>
/// <param name="notgametypes">Select games without the given types</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>
@@ -500,23 +500,23 @@ namespace SabreTools
bool bare, bool bare,
/* Filtering info */ /* Filtering info */
string gamename, List<string> gamenames,
string romname, List<string> romnames,
string romtype, List<string> romtypes,
long sgt, long sgt,
long slt, long slt,
long seq, long seq,
string crc, List<string> crcs,
string md5, List<string> md5s,
string sha1, List<string> sha1s,
List<string> statuses, List<string> statuses,
List<string> gametypes, List<string> gametypes,
string notgamename, List<string> notgamenames,
string notromname, List<string> notromnames,
string notromtype, List<string> notromtypes,
string notcrc, List<string> notcrcs,
string notmd5, List<string> notmd5s,
string notsha1, List<string> notsha1s,
List<string> notstatuses, List<string> notstatuses,
List<string> notgametypes, List<string> notgametypes,
bool? runnable, bool? runnable,
@@ -767,8 +767,8 @@ namespace SabreTools
}; };
// Create the Filter object to be used // Create the Filter object to be used
Filter filter = new Filter(gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, itemStatus, machineType, Filter filter = new Filter(gamenames, romnames, romtypes, sgt, slt, seq, crcs, md5s, sha1s, itemStatus, machineType,
notgamename, notromname, notromtype, notcrc, notmd5, notsha1, itemNotStatus, machineNotType, runnable); notgamenames, notromnames, notromtypes, notcrcs, notmd5s, notsha1s, itemNotStatus, machineNotType, runnable);
userInputDat.DetermineUpdateType(inputs, outDir, merge, diffMode, inplace, skip, bare, clean, softlist, userInputDat.DetermineUpdateType(inputs, outDir, merge, diffMode, inplace, skip, bare, clean, softlist,
filter, splitType, trim, single, root, maxDegreeOfParallelism, _logger); filter, splitType, trim, single, root, maxDegreeOfParallelism, _logger);

View File

@@ -118,7 +118,6 @@ namespace SabreTools
author = null, author = null,
category = null, category = null,
comment = null, comment = null,
crc = "",
date = null, date = null,
description = null, description = null,
email = null, email = null,
@@ -128,48 +127,37 @@ namespace SabreTools
forcemerge = "", forcemerge = "",
forcend = "", forcend = "",
forcepack = "", forcepack = "",
gamename = "",
header = null, header = null,
homepage = null, homepage = null,
md5 = "",
name = null, name = null,
notcrc = null,
notgamename = null,
notmd5 = null,
notromname = null,
notromtype = null,
notsha1 = null,
outDir = "", outDir = "",
postfix = "", postfix = "",
prefix = "", prefix = "",
repext = "", repext = "",
romname = "",
romtype = "",
root = "", root = "",
rootdir = null, rootdir = null,
sha1 = "",
tempDir = "", tempDir = "",
url = null, url = null,
version = null; version = null;
//List<string> crc = new List<string>(); List<string> crc = new List<string>();
List<string> datfiles = new List<string>(); // SimpleSort List<string> datfiles = new List<string>(); // SimpleSort
//List<string> exta = new List<string>(); //List<string> exta = new List<string>();
//List<string> extb = new List<string>(); //List<string> extb = new List<string>();
//List<string> gamename = new List<string>(); List<string> gamename = new List<string>();
List<string> gametype = new List<string>(); List<string> gametype = new List<string>();
List<string> inputs = new List<string>(); List<string> inputs = new List<string>();
//List<string> md5 = new List<string>(); List<string> md5 = new List<string>();
//List<string> notcrc = new List<string>(); List<string> notcrc = new List<string>();
//List<string> notgamename = new List<string>(); List<string> notgamename = new List<string>();
List<string> notgametype = new List<string>(); List<string> notgametype = new List<string>();
//List<string> notmd5 = new List<string>(); List<string> notmd5 = new List<string>();
//List<string> notromname = new List<string>(); List<string> notromname = new List<string>();
//List<string> notromtype = new List<string>(); List<string> notromtype = new List<string>();
//List<string> notsha1 = new List<string>(); List<string> notsha1 = new List<string>();
List<string> notstatus = new List<string>(); List<string> notstatus = new List<string>();
//List<string> romname = new List<string>(); List<string> romname = new List<string>();
//List<string> romtype = new List<string>(); List<string> romtype = new List<string>();
//List<string> sha1 = new List<string>(); List<string> sha1 = new List<string>();
List<string> status = 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)
@@ -529,7 +517,7 @@ namespace SabreTools
break; break;
case "-crc": case "-crc":
case "--crc": case "--crc":
crc = args[++i]; crc.Add(args[++i]);
break; break;
case "-da": case "-da":
case "--date": case "--date":
@@ -580,7 +568,7 @@ namespace SabreTools
break; break;
case "-gn": case "-gn":
case "--game-name": case "--game-name":
gamename = args[++i]; gamename.Add(args[++i]);
break; break;
case "-gt": case "-gt":
case "--game-type": case "--game-type":
@@ -607,7 +595,7 @@ namespace SabreTools
break; break;
case "-md5": case "-md5":
case "--md5": case "--md5":
md5 = args[++i]; md5.Add(args[++i]);
break; break;
case "-mt": case "-mt":
case "--mt": case "--mt":
@@ -619,11 +607,11 @@ namespace SabreTools
break; break;
case "-ncrc": case "-ncrc":
case "--not-crc": case "--not-crc":
notcrc = args[++i]; notcrc.Add(args[++i]);
break; break;
case "-ngn": case "-ngn":
case "--not-game": case "--not-game":
notgamename = args[++i]; notgamename.Add(args[++i]);
break; break;
case "-ngt": case "-ngt":
case "--not-gtype": case "--not-gtype":
@@ -635,19 +623,19 @@ namespace SabreTools
break; break;
case "-nmd5": case "-nmd5":
case "--not-md5": case "--not-md5":
notmd5 = args[++i]; notmd5.Add(args[++i]);
break; break;
case "-nrn": case "-nrn":
case "--not-rom": case "--not-rom":
notromname = args[++i]; notromname.Add(args[++i]);
break; break;
case "-nrt": case "-nrt":
case "--not-type": case "--not-type":
notromtype = args[++i]; notromtype.Add(args[++i]);
break; break;
case "-nsha1": case "-nsha1":
case "--not-sha1": case "--not-sha1":
notsha1 = args[++i]; notsha1.Add(args[++i]);
break; break;
case "-out": case "-out":
case "--out": case "--out":
@@ -678,7 +666,7 @@ namespace SabreTools
break; break;
case "-rn": case "-rn":
case "--rom-name": case "--rom-name":
romname = args[++i]; romname.Add(args[++i]);
break; break;
case "-root": case "-root":
case "--root": case "--root":
@@ -686,7 +674,7 @@ namespace SabreTools
break; break;
case "-rt": case "-rt":
case "--rom-type": case "--rom-type":
romtype = args[++i]; romtype.Add(args[++i]);
break; break;
case "-seq": case "-seq":
case "--equal": case "--equal":
@@ -698,7 +686,7 @@ namespace SabreTools
break; break;
case "-sha1": case "-sha1":
case "--sha1": case "--sha1":
sha1 = args[++i]; sha1.Add(args[++i]);
break; break;
case "-slt": case "-slt":
case "--less": case "--less":
@@ -763,7 +751,7 @@ namespace SabreTools
break; break;
case "-crc": case "-crc":
case "--crc": case "--crc":
crc = split[1]; crc.Add(split[1]);
break; break;
case "-da": case "-da":
case "--date": case "--date":
@@ -813,7 +801,7 @@ namespace SabreTools
break; break;
case "-gn": case "-gn":
case "--game-name": case "--game-name":
gamename = split[1]; gamename.Add(split[1]);
break; break;
case "-gt": case "-gt":
case "--game-type": case "--game-type":
@@ -840,7 +828,7 @@ namespace SabreTools
break; break;
case "-md5": case "-md5":
case "--md5": case "--md5":
md5 = split[1]; md5.Add(split[1]);
break; break;
case "-mt": case "-mt":
case "--mt": case "--mt":
@@ -852,11 +840,11 @@ namespace SabreTools
break; break;
case "-ncrc": case "-ncrc":
case "--not-crc": case "--not-crc":
notcrc = split[1]; notcrc.Add(split[1]);
break; break;
case "-ngn": case "-ngn":
case "--not-game": case "--not-game":
notgamename = split[1]; notgamename.Add(split[1]);
break; break;
case "-ngt": case "-ngt":
case "--not-gtype": case "--not-gtype":
@@ -868,19 +856,19 @@ namespace SabreTools
break; break;
case "-nmd5": case "-nmd5":
case "--not-md5": case "--not-md5":
notmd5 = split[1]; notmd5.Add(split[1]);
break; break;
case "-nrn": case "-nrn":
case "--not-rom": case "--not-rom":
notromname = split[1]; notromname.Add(split[1]);
break; break;
case "-nrt": case "-nrt":
case "--not-type": case "--not-type":
notromtype = split[1]; notromtype.Add(split[1]);
break; break;
case "-nsha1": case "-nsha1":
case "--not-sha1": case "--not-sha1":
notsha1 = split[1]; notsha1.Add(split[1]);
break; break;
case "-out": case "-out":
case "--out": case "--out":
@@ -915,11 +903,11 @@ namespace SabreTools
break; break;
case "-rn": case "-rn":
case "--rom-name": case "--rom-name":
romname = split[1]; romname.Add(split[1]);
break; break;
case "-rt": case "-rt":
case "--rom-type": case "--rom-type":
romtype = split[1]; romtype.Add(split[1]);
break; break;
case "-seq": case "-seq":
case "--equal": case "--equal":
@@ -931,7 +919,7 @@ namespace SabreTools
break; break;
case "-sha1": case "-sha1":
case "--sha1": case "--sha1":
sha1 = split[1]; sha1.Add(split[1]);
break; break;
case "-slt": case "-slt":
case "--less": case "--less":