mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[Filter] Filter was getting unweildy, make it more streamlined to use
This commit is contained in:
@@ -9,106 +9,199 @@ namespace SabreTools.Helper.Dats
|
|||||||
{
|
{
|
||||||
#region Private instance variables
|
#region Private instance variables
|
||||||
|
|
||||||
|
#region Positive
|
||||||
|
|
||||||
private List<string> _gameNames;
|
private List<string> _gameNames;
|
||||||
private List<string> _notGameNames;
|
|
||||||
private List<string> _romNames;
|
private List<string> _romNames;
|
||||||
private List<string> _notRomNames;
|
|
||||||
private List<string> _romTypes;
|
private List<string> _romTypes;
|
||||||
|
private List<string> _crcs;
|
||||||
|
private List<string> _md5s;
|
||||||
|
private List<string> _sha1s;
|
||||||
|
private ItemStatus _itemStatuses;
|
||||||
|
private MachineType _machineTypes;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Negative
|
||||||
|
|
||||||
|
private List<string> _notGameNames;
|
||||||
|
private List<string> _notRomNames;
|
||||||
private List<string> _notRomTypes;
|
private List<string> _notRomTypes;
|
||||||
|
private List<string> _notCrcs;
|
||||||
|
private List<string> _notMd5s;
|
||||||
|
private List<string> _notSha1s;
|
||||||
|
private ItemStatus _itemNotStatuses;
|
||||||
|
private MachineType _machineNotTypes;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Neutral
|
||||||
|
|
||||||
private long _sizeGreaterThanOrEqual;
|
private long _sizeGreaterThanOrEqual;
|
||||||
private long _sizeLessThanOrEqual;
|
private long _sizeLessThanOrEqual;
|
||||||
private long _sizeEqualTo;
|
private long _sizeEqualTo;
|
||||||
private List<string> _crcs;
|
|
||||||
private List<string> _notCrcs;
|
|
||||||
private List<string> _md5s;
|
|
||||||
private List<string> _notMd5s;
|
|
||||||
private List<string> _sha1s;
|
|
||||||
private List<string> _notSha1s;
|
|
||||||
private ItemStatus _itemStatuses;
|
|
||||||
private ItemStatus _itemNotStatuses;
|
|
||||||
private MachineType _machineTypes;
|
|
||||||
private MachineType _machineNotTypes;
|
|
||||||
private bool? _runnable;
|
private bool? _runnable;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
#endregion // Private instance variables
|
||||||
|
|
||||||
|
#region Pubically facing variables
|
||||||
|
|
||||||
|
#region Positive
|
||||||
|
|
||||||
|
public List<string> GameNames
|
||||||
|
{
|
||||||
|
get { return _gameNames; }
|
||||||
|
set { _gameNames = value; }
|
||||||
|
}
|
||||||
|
public List<string> RomNames
|
||||||
|
{
|
||||||
|
get { return _romNames; }
|
||||||
|
set { _romNames = value; }
|
||||||
|
}
|
||||||
|
public List<string> RomTypes
|
||||||
|
{
|
||||||
|
get { return _romTypes; }
|
||||||
|
set { _romTypes = value; }
|
||||||
|
}
|
||||||
|
public List<string> CRCs
|
||||||
|
{
|
||||||
|
get { return _crcs; }
|
||||||
|
set { _crcs = value; }
|
||||||
|
}
|
||||||
|
public List<string> MD5s
|
||||||
|
{
|
||||||
|
get { return _md5s; }
|
||||||
|
set { _md5s = value; }
|
||||||
|
}
|
||||||
|
public List<string> SHA1s
|
||||||
|
{
|
||||||
|
get { return _sha1s; }
|
||||||
|
set { _sha1s = value; }
|
||||||
|
}
|
||||||
|
public ItemStatus ItemStatuses
|
||||||
|
{
|
||||||
|
get { return _itemStatuses; }
|
||||||
|
set { _itemStatuses = value; }
|
||||||
|
}
|
||||||
|
public MachineType MachineTypes
|
||||||
|
{
|
||||||
|
get { return _machineTypes; }
|
||||||
|
set { _machineTypes = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Negative
|
||||||
|
|
||||||
|
public List<string> NotGameNames
|
||||||
|
{
|
||||||
|
get { return _notGameNames; }
|
||||||
|
set { _notGameNames = value; }
|
||||||
|
}
|
||||||
|
public List<string> NotRomNames
|
||||||
|
{
|
||||||
|
get { return _notRomNames; }
|
||||||
|
set { _notRomNames = value; }
|
||||||
|
}
|
||||||
|
public List<string> NotRomTypes
|
||||||
|
{
|
||||||
|
get { return _notRomTypes; }
|
||||||
|
set { _notRomTypes = value; }
|
||||||
|
}
|
||||||
|
public List<string> NotCRCs
|
||||||
|
{
|
||||||
|
get { return _notCrcs; }
|
||||||
|
set { _notCrcs = value; }
|
||||||
|
}
|
||||||
|
public List<string> NotMD5s
|
||||||
|
{
|
||||||
|
get { return _notMd5s; }
|
||||||
|
set { _notMd5s = value; }
|
||||||
|
}
|
||||||
|
public List<string> NotSHA1s
|
||||||
|
{
|
||||||
|
get { return _notSha1s; }
|
||||||
|
set { _notSha1s = value; }
|
||||||
|
}
|
||||||
|
public ItemStatus NotItemStatuses
|
||||||
|
{
|
||||||
|
get { return _itemNotStatuses; }
|
||||||
|
set { _itemNotStatuses = value; }
|
||||||
|
}
|
||||||
|
public MachineType NotMachineTypes
|
||||||
|
{
|
||||||
|
get { return _machineNotTypes; }
|
||||||
|
set { _machineNotTypes = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Neutral
|
||||||
|
|
||||||
|
public long SizeGreaterThanOrEqual
|
||||||
|
{
|
||||||
|
get { return _sizeGreaterThanOrEqual; }
|
||||||
|
set { _sizeGreaterThanOrEqual = value; }
|
||||||
|
}
|
||||||
|
public long SizeLessThanOrEqual
|
||||||
|
{
|
||||||
|
get { return _sizeLessThanOrEqual; }
|
||||||
|
set { _sizeLessThanOrEqual = value; }
|
||||||
|
}
|
||||||
|
public long SizeEqualTo
|
||||||
|
{
|
||||||
|
get { return _sizeEqualTo; }
|
||||||
|
set { _sizeEqualTo = value; }
|
||||||
|
}
|
||||||
|
public bool? Runnable
|
||||||
|
{
|
||||||
|
get { return _runnable; }
|
||||||
|
set { _runnable = value; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#endregion // Pubically facing variables
|
||||||
|
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create an empty Filter object
|
/// Create an empty Filter object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Filter()
|
public Filter()
|
||||||
{
|
{
|
||||||
|
// Positive
|
||||||
_gameNames = new List<string>();
|
_gameNames = new List<string>();
|
||||||
_notGameNames = new List<string>();
|
|
||||||
_romNames = new List<string>();
|
_romNames = new List<string>();
|
||||||
_notRomNames = new List<string>();
|
|
||||||
_romTypes = new List<string>();
|
_romTypes = new List<string>();
|
||||||
|
_crcs = new List<string>();
|
||||||
|
_md5s = new List<string>();
|
||||||
|
_sha1s = new List<string>();
|
||||||
|
_itemStatuses = ItemStatus.NULL;
|
||||||
|
_machineTypes = MachineType.NULL;
|
||||||
|
|
||||||
|
// Negative
|
||||||
|
_notGameNames = new List<string>();
|
||||||
|
_notRomNames = new List<string>();
|
||||||
_notRomTypes = new List<string>();
|
_notRomTypes = new List<string>();
|
||||||
|
_notCrcs = new List<string>();
|
||||||
|
_notMd5s = new List<string>();
|
||||||
|
_notSha1s = new List<string>();
|
||||||
|
_itemNotStatuses = ItemStatus.NULL;
|
||||||
|
_machineNotTypes = MachineType.NULL;
|
||||||
|
|
||||||
|
// Neutral
|
||||||
_sizeGreaterThanOrEqual = -1;
|
_sizeGreaterThanOrEqual = -1;
|
||||||
_sizeLessThanOrEqual = -1;
|
_sizeLessThanOrEqual = -1;
|
||||||
_sizeEqualTo = -1;
|
_sizeEqualTo = -1;
|
||||||
_crcs = new List<string>();
|
|
||||||
_notCrcs = new List<string>();
|
|
||||||
_md5s = new List<string>();
|
|
||||||
_notMd5s = new List<string>();
|
|
||||||
_sha1s = new List<string>();
|
|
||||||
_notSha1s = new List<string>();
|
|
||||||
_itemStatuses = ItemStatus.NULL;
|
|
||||||
_itemNotStatuses = ItemStatus.NULL;
|
|
||||||
_machineTypes = MachineType.NULL;
|
|
||||||
_machineNotTypes = MachineType.NULL;
|
|
||||||
_runnable = null;
|
_runnable = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
#endregion
|
||||||
/// Create a populated Filter object
|
|
||||||
/// </summary>
|
#region Instance methods
|
||||||
/// <param name="gamenames">Names of the games to match (can use asterisk-partials)</param>
|
|
||||||
/// <param name="romnames">Names of the roms to match (can use asterisk-partials)</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="slt">Find roms less than or equal to this size</param>
|
|
||||||
/// <param name="seq">Find roms equal to this size</param>
|
|
||||||
/// <param name="crcs">CRCs of the roms to match (can use asterisk-partials)</param>
|
|
||||||
/// <param name="md5s">MD5s of the roms to match (can use asterisk-partials)</param>
|
|
||||||
/// <param name="sha1s">SHA-1s of the roms to match (can use asterisk-partials)</param>
|
|
||||||
/// <param name="itemStatuses">Select roms with the given status</param>
|
|
||||||
/// <param name="machineTypes">Select games with the given type</param>
|
|
||||||
/// <param name="notgamenames">Names of the games to match (can use asterisk-partials)</param>
|
|
||||||
/// <param name="notromnames">Names of the roms to match (can use asterisk-partials)</param>
|
|
||||||
/// <param name="notromtypes">Type of the roms to match</param>
|
|
||||||
/// <param name="notcrcs">CRCs of the roms to match (can use asterisk-partials)</param>
|
|
||||||
/// <param name="notmd5s">MD5s of the roms to match (can use asterisk-partials)</param>
|
|
||||||
/// <param name="notsha1s">SHA-1s of the roms to match (can use asterisk-partials)</param>
|
|
||||||
/// <param name="itemNotStatuses">Select roms without the given status</param>
|
|
||||||
/// <param name="machineNotTypes">Select games without the given type</param>
|
|
||||||
/// <param name="runnable">Select games that have a value for runnable</param>
|
|
||||||
public Filter(List<string> gamenames, List<string> romnames, List<string> romtypes, long sgt,
|
|
||||||
long slt, long seq, List<string> crcs, List<string> md5s, List<string> sha1s, ItemStatus itemStatuses,
|
|
||||||
MachineType machineTypes, List<string> notgamenames, List<string> notromnames, List<string> notromtypes,
|
|
||||||
List<string> notcrcs, List<string> notmd5s, List<string> notsha1s, ItemStatus itemNotStatuses,
|
|
||||||
MachineType machineNotTypes, bool? runnable)
|
|
||||||
{
|
|
||||||
_gameNames = gamenames;
|
|
||||||
_notGameNames = notgamenames;
|
|
||||||
_romNames = romnames;
|
|
||||||
_notRomNames = notromnames;
|
|
||||||
_romTypes = romtypes;
|
|
||||||
_notRomTypes = notromtypes;
|
|
||||||
_sizeGreaterThanOrEqual = sgt;
|
|
||||||
_sizeLessThanOrEqual = slt;
|
|
||||||
_sizeEqualTo = seq;
|
|
||||||
_crcs = crcs;
|
|
||||||
_notCrcs = notcrcs;
|
|
||||||
_md5s = md5s;
|
|
||||||
_notMd5s = notmd5s;
|
|
||||||
_sha1s = sha1s;
|
|
||||||
_notSha1s = notsha1s;
|
|
||||||
_itemStatuses = itemStatuses;
|
|
||||||
_itemNotStatuses = itemNotStatuses;
|
|
||||||
_machineTypes = machineTypes;
|
|
||||||
_machineNotTypes = machineNotTypes;
|
|
||||||
_runnable = runnable;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Check to see if a DatItem passes the filter
|
/// Check to see if a DatItem passes the filter
|
||||||
@@ -838,5 +931,78 @@ namespace SabreTools.Helper.Dats
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Static methods
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the machine type from a string
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="gametype">Machine type as a string</param>
|
||||||
|
/// <param name="logger">Logger object for file and console output</param>
|
||||||
|
/// <returns>A machine type based on the input</returns>
|
||||||
|
public static MachineType GetMachneTypeFromString(string gametype, Logger logger)
|
||||||
|
{
|
||||||
|
MachineType machineType = MachineType.NULL;
|
||||||
|
switch (gametype.ToLowerInvariant())
|
||||||
|
{
|
||||||
|
case "none":
|
||||||
|
machineType |= MachineType.None;
|
||||||
|
break;
|
||||||
|
case "bios":
|
||||||
|
machineType |= MachineType.Bios;
|
||||||
|
break;
|
||||||
|
case "dev":
|
||||||
|
case "device":
|
||||||
|
machineType |= MachineType.Device;
|
||||||
|
break;
|
||||||
|
case "mech":
|
||||||
|
case "mechanical":
|
||||||
|
machineType |= MachineType.Mechanical;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
logger.Warning(gametype + " is not a valid type");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return machineType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Get the item status from a string
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="status">Item status as a string</param>
|
||||||
|
/// <param name="logger">Logger object for file and console output</param>
|
||||||
|
/// <returns>An item status based on the input</returns>
|
||||||
|
public static ItemStatus GetStatusFromString(string status, Logger logger)
|
||||||
|
{
|
||||||
|
ItemStatus itemStatus = ItemStatus.NULL;
|
||||||
|
switch (status.ToLowerInvariant())
|
||||||
|
{
|
||||||
|
case "none":
|
||||||
|
itemStatus |= ItemStatus.None;
|
||||||
|
break;
|
||||||
|
case "good":
|
||||||
|
itemStatus |= ItemStatus.Good;
|
||||||
|
break;
|
||||||
|
case "baddump":
|
||||||
|
itemStatus |= ItemStatus.BadDump;
|
||||||
|
break;
|
||||||
|
case "nodump":
|
||||||
|
itemStatus |= ItemStatus.Nodump;
|
||||||
|
break;
|
||||||
|
case "verified":
|
||||||
|
itemStatus |= ItemStatus.Verified;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
logger.Warning(status + " is not a valid status");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return itemStatus;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -460,26 +460,7 @@ 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="gamenames">Names of the games to match (can use asterisk-partials)</param>
|
/// <param name="filter">Pre-populated filter object for DAT filtering</param>
|
||||||
/// <param name="romnames">Names of the roms to match (can use asterisk-partials)</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="slt">Find roms less than or equal to this size</param>
|
|
||||||
/// <param name="seq">Find roms equal to this size</param>
|
|
||||||
/// <param name="crcs">CRCs of the roms to match (can use asterisk-partials)</param>
|
|
||||||
/// <param name="md5s">MD5s of the roms 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="gametypes">Select games with the given types</param>
|
|
||||||
/// <param name="notgamenames">Name of the game to match (can use asterisk-partials)</param>
|
|
||||||
/// <param name="notromnames">Name of the rom to match (can use asterisk-partials)</param>
|
|
||||||
/// <param name="notromtypes">Type of the rom to match</param>
|
|
||||||
/// <param name="notcrcs">CRCs of the roms to match (can use asterisk-partials)</param>
|
|
||||||
/// <param name="notmd5s">MD5s of the roms 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="notgametypes">Select games without the given types</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>
|
||||||
/// <param name="trim">True if we are supposed to trim names to NTFS length, false otherwise</param>
|
/// <param name="trim">True if we are supposed to trim names to NTFS length, false otherwise</param>
|
||||||
@@ -533,26 +514,7 @@ namespace SabreTools
|
|||||||
bool bare,
|
bool bare,
|
||||||
|
|
||||||
/* Filtering info */
|
/* Filtering info */
|
||||||
List<string> gamenames,
|
Filter filter,
|
||||||
List<string> romnames,
|
|
||||||
List<string> romtypes,
|
|
||||||
long sgt,
|
|
||||||
long slt,
|
|
||||||
long seq,
|
|
||||||
List<string> crcs,
|
|
||||||
List<string> md5s,
|
|
||||||
List<string> sha1s,
|
|
||||||
List<string> statuses,
|
|
||||||
List<string> gametypes,
|
|
||||||
List<string> notgamenames,
|
|
||||||
List<string> notromnames,
|
|
||||||
List<string> notromtypes,
|
|
||||||
List<string> notcrcs,
|
|
||||||
List<string> notmd5s,
|
|
||||||
List<string> notsha1s,
|
|
||||||
List<string> notstatuses,
|
|
||||||
List<string> notgametypes,
|
|
||||||
bool? runnable,
|
|
||||||
|
|
||||||
/* Trimming info */
|
/* Trimming info */
|
||||||
SplitType splitType,
|
SplitType splitType,
|
||||||
@@ -633,112 +595,6 @@ namespace SabreTools
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set the status flag for filtering
|
|
||||||
ItemStatus itemStatus = ItemStatus.NULL;
|
|
||||||
foreach (string status in statuses)
|
|
||||||
{
|
|
||||||
switch (status.ToLowerInvariant())
|
|
||||||
{
|
|
||||||
case "none":
|
|
||||||
itemStatus |= ItemStatus.None;
|
|
||||||
break;
|
|
||||||
case "good":
|
|
||||||
itemStatus |= ItemStatus.Good;
|
|
||||||
break;
|
|
||||||
case "baddump":
|
|
||||||
itemStatus |= ItemStatus.BadDump;
|
|
||||||
break;
|
|
||||||
case "nodump":
|
|
||||||
itemStatus |= ItemStatus.Nodump;
|
|
||||||
break;
|
|
||||||
case "verified":
|
|
||||||
itemStatus |= ItemStatus.Verified;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
_logger.Warning(status + " is not a valid status");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the not status flag for filtering
|
|
||||||
ItemStatus itemNotStatus = ItemStatus.NULL;
|
|
||||||
foreach (string status in notstatuses)
|
|
||||||
{
|
|
||||||
switch (status.ToLowerInvariant())
|
|
||||||
{
|
|
||||||
case "none":
|
|
||||||
itemNotStatus |= ItemStatus.None;
|
|
||||||
break;
|
|
||||||
case "good":
|
|
||||||
itemNotStatus |= ItemStatus.Good;
|
|
||||||
break;
|
|
||||||
case "baddump":
|
|
||||||
itemNotStatus |= ItemStatus.BadDump;
|
|
||||||
break;
|
|
||||||
case "nodump":
|
|
||||||
itemNotStatus |= ItemStatus.Nodump;
|
|
||||||
break;
|
|
||||||
case "verified":
|
|
||||||
itemNotStatus |= ItemStatus.Verified;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
_logger.Warning(status + " is not a valid status");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the machine type flag for filtering
|
|
||||||
MachineType machineType = MachineType.NULL;
|
|
||||||
foreach (string gametype in gametypes)
|
|
||||||
{
|
|
||||||
switch (gametype.ToLowerInvariant())
|
|
||||||
{
|
|
||||||
case "none":
|
|
||||||
machineType |= MachineType.None;
|
|
||||||
break;
|
|
||||||
case "bios":
|
|
||||||
machineType |= MachineType.Bios;
|
|
||||||
break;
|
|
||||||
case "dev":
|
|
||||||
case "device":
|
|
||||||
machineType |= MachineType.Device;
|
|
||||||
break;
|
|
||||||
case "mech":
|
|
||||||
case "mechanical":
|
|
||||||
machineType |= MachineType.Mechanical;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
_logger.Warning(gametype + " is not a valid type");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set the not machine type flag for filtering
|
|
||||||
MachineType machineNotType = MachineType.NULL;
|
|
||||||
foreach (string gametype in notgametypes)
|
|
||||||
{
|
|
||||||
switch (gametype.ToLowerInvariant())
|
|
||||||
{
|
|
||||||
case "none":
|
|
||||||
machineNotType = MachineType.None;
|
|
||||||
break;
|
|
||||||
case "bios":
|
|
||||||
machineNotType = MachineType.Bios;
|
|
||||||
break;
|
|
||||||
case "dev":
|
|
||||||
case "device":
|
|
||||||
machineNotType = MachineType.Device;
|
|
||||||
break;
|
|
||||||
case "mech":
|
|
||||||
case "mechanical":
|
|
||||||
machineNotType = MachineType.Mechanical;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
_logger.Warning(gametype + " is not a valid type");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Normalize the extensions
|
// Normalize the extensions
|
||||||
addext = (addext == "" || addext.StartsWith(".") ? addext : "." + addext);
|
addext = (addext == "" || addext.StartsWith(".") ? addext : "." + addext);
|
||||||
repext = (repext == "" || repext.StartsWith(".") ? repext : "." + repext);
|
repext = (repext == "" || repext.StartsWith(".") ? repext : "." + repext);
|
||||||
@@ -808,10 +664,6 @@ namespace SabreTools
|
|||||||
Romba = romba,
|
Romba = romba,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Create the Filter object to be used
|
|
||||||
Filter filter = new Filter(gamenames, romnames, romtypes, sgt, slt, seq, crcs, md5s, sha1s, itemStatus, machineType,
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ using System.Linq;
|
|||||||
|
|
||||||
using SabreTools.Helper;
|
using SabreTools.Helper;
|
||||||
using SabreTools.Helper.Data;
|
using SabreTools.Helper.Data;
|
||||||
|
using SabreTools.Helper.Dats;
|
||||||
using SabreTools.Helper.Help;
|
using SabreTools.Helper.Help;
|
||||||
|
|
||||||
#if MONO
|
#if MONO
|
||||||
@@ -118,7 +119,6 @@ namespace SabreTools
|
|||||||
skip = false,
|
skip = false,
|
||||||
updateDat = false,
|
updateDat = false,
|
||||||
usegame = true;
|
usegame = true;
|
||||||
bool? runnable = null;
|
|
||||||
DatFormat datFormat = 0x0;
|
DatFormat datFormat = 0x0;
|
||||||
DiffMode diffMode = 0x0;
|
DiffMode diffMode = 0x0;
|
||||||
OutputFormat outputFormat = OutputFormat.Folder;
|
OutputFormat outputFormat = OutputFormat.Folder;
|
||||||
@@ -131,9 +131,6 @@ namespace SabreTools
|
|||||||
rar = 2,
|
rar = 2,
|
||||||
sevenzip = 1,
|
sevenzip = 1,
|
||||||
zip = 1;
|
zip = 1;
|
||||||
long sgt = -1,
|
|
||||||
slt = -1,
|
|
||||||
seq = -1;
|
|
||||||
string addext = "",
|
string addext = "",
|
||||||
author = null,
|
author = null,
|
||||||
category = null,
|
category = null,
|
||||||
@@ -157,26 +154,11 @@ namespace SabreTools
|
|||||||
tempDir = "",
|
tempDir = "",
|
||||||
url = null,
|
url = null,
|
||||||
version = null;
|
version = null;
|
||||||
List<string> crc = new List<string>();
|
Filter filter = new Filter();
|
||||||
List<string> datfiles = new List<string>();
|
List<string> datfiles = new List<string>();
|
||||||
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> gametype = new List<string>();
|
|
||||||
List<string> inputs = new List<string>();
|
List<string> inputs = new List<string>();
|
||||||
List<string> md5 = new List<string>();
|
|
||||||
List<string> notcrc = new List<string>();
|
|
||||||
List<string> notgamename = new List<string>();
|
|
||||||
List<string> notgametype = new List<string>();
|
|
||||||
List<string> notmd5 = new List<string>();
|
|
||||||
List<string> notromname = new List<string>();
|
|
||||||
List<string> notromtype = new List<string>();
|
|
||||||
List<string> notsha1 = new List<string>();
|
|
||||||
List<string> notstatus = new List<string>();
|
|
||||||
List<string> romname = new List<string>();
|
|
||||||
List<string> romtype = new List<string>();
|
|
||||||
List<string> sha1 = new List<string>();
|
|
||||||
List<string> status = new List<string>();
|
|
||||||
|
|
||||||
// Get the first argument as a feature flag
|
// Get the first argument as a feature flag
|
||||||
string feature = args[0];
|
string feature = args[0];
|
||||||
@@ -406,7 +388,7 @@ namespace SabreTools
|
|||||||
break;
|
break;
|
||||||
case "-nrun":
|
case "-nrun":
|
||||||
case "--not-run":
|
case "--not-run":
|
||||||
runnable = false;
|
filter.Runnable = false;
|
||||||
break;
|
break;
|
||||||
case "-ns":
|
case "-ns":
|
||||||
case "--noSHA1":
|
case "--noSHA1":
|
||||||
@@ -498,7 +480,7 @@ namespace SabreTools
|
|||||||
break;
|
break;
|
||||||
case "-run":
|
case "-run":
|
||||||
case "--runnable":
|
case "--runnable":
|
||||||
runnable = true;
|
filter.Runnable = true;
|
||||||
break;
|
break;
|
||||||
case "-s":
|
case "-s":
|
||||||
case "--short":
|
case "--short":
|
||||||
@@ -591,7 +573,7 @@ namespace SabreTools
|
|||||||
break;
|
break;
|
||||||
case "-crc":
|
case "-crc":
|
||||||
case "--crc":
|
case "--crc":
|
||||||
crc.Add(args[++i]);
|
filter.CRCs.Add(args[++i]);
|
||||||
break;
|
break;
|
||||||
case "-da":
|
case "-da":
|
||||||
case "--date":
|
case "--date":
|
||||||
@@ -642,11 +624,11 @@ namespace SabreTools
|
|||||||
break;
|
break;
|
||||||
case "-gn":
|
case "-gn":
|
||||||
case "--game-name":
|
case "--game-name":
|
||||||
gamename.Add(args[++i]);
|
filter.GameNames.Add(args[++i]);
|
||||||
break;
|
break;
|
||||||
case "-gt":
|
case "-gt":
|
||||||
case "--game-type":
|
case "--game-type":
|
||||||
gametype.Add(args[++i]);
|
filter.MachineTypes |= Filter.GetMachneTypeFromString(args[++i], _logger);
|
||||||
break;
|
break;
|
||||||
case "-gz":
|
case "-gz":
|
||||||
case "--gz":
|
case "--gz":
|
||||||
@@ -665,11 +647,11 @@ namespace SabreTools
|
|||||||
break;
|
break;
|
||||||
case "-is":
|
case "-is":
|
||||||
case "--status":
|
case "--status":
|
||||||
status.Add(args[++i]);
|
filter.ItemStatuses |= Filter.GetStatusFromString(args[++i], _logger);
|
||||||
break;
|
break;
|
||||||
case "-md5":
|
case "-md5":
|
||||||
case "--md5":
|
case "--md5":
|
||||||
md5.Add(args[++i]);
|
filter.MD5s.Add(args[++i]);
|
||||||
break;
|
break;
|
||||||
case "-mt":
|
case "-mt":
|
||||||
case "--mt":
|
case "--mt":
|
||||||
@@ -681,35 +663,35 @@ namespace SabreTools
|
|||||||
break;
|
break;
|
||||||
case "-ncrc":
|
case "-ncrc":
|
||||||
case "--not-crc":
|
case "--not-crc":
|
||||||
notcrc.Add(args[++i]);
|
filter.NotCRCs.Add(args[++i]);
|
||||||
break;
|
break;
|
||||||
case "-ngn":
|
case "-ngn":
|
||||||
case "--not-game":
|
case "--not-game":
|
||||||
notgamename.Add(args[++i]);
|
filter.NotGameNames.Add(args[++i]);
|
||||||
break;
|
break;
|
||||||
case "-ngt":
|
case "-ngt":
|
||||||
case "--not-gtype":
|
case "--not-gtype":
|
||||||
notgametype.Add(args[++i]);
|
filter.NotMachineTypes |= Filter.GetMachneTypeFromString(args[++i], _logger);
|
||||||
break;
|
break;
|
||||||
case "-nis":
|
case "-nis":
|
||||||
case "--not-status":
|
case "--not-status":
|
||||||
notstatus.Add(args[++i]);
|
filter.NotItemStatuses |= Filter.GetStatusFromString(args[++i], _logger);
|
||||||
break;
|
break;
|
||||||
case "-nmd5":
|
case "-nmd5":
|
||||||
case "--not-md5":
|
case "--not-md5":
|
||||||
notmd5.Add(args[++i]);
|
filter.NotMD5s.Add(args[++i]);
|
||||||
break;
|
break;
|
||||||
case "-nrn":
|
case "-nrn":
|
||||||
case "--not-rom":
|
case "--not-rom":
|
||||||
notromname.Add(args[++i]);
|
filter.NotRomNames.Add(args[++i]);
|
||||||
break;
|
break;
|
||||||
case "-nrt":
|
case "-nrt":
|
||||||
case "--not-type":
|
case "--not-type":
|
||||||
notromtype.Add(args[++i]);
|
filter.NotRomTypes.Add(args[++i]);
|
||||||
break;
|
break;
|
||||||
case "-nsha1":
|
case "-nsha1":
|
||||||
case "--not-sha1":
|
case "--not-sha1":
|
||||||
notsha1.Add(args[++i]);
|
filter.NotSHA1s.Add(args[++i]);
|
||||||
break;
|
break;
|
||||||
case "-out":
|
case "-out":
|
||||||
case "--out":
|
case "--out":
|
||||||
@@ -740,7 +722,7 @@ namespace SabreTools
|
|||||||
break;
|
break;
|
||||||
case "-rn":
|
case "-rn":
|
||||||
case "--rom-name":
|
case "--rom-name":
|
||||||
romname.Add(args[++i]);
|
filter.RomNames.Add(args[++i]);
|
||||||
break;
|
break;
|
||||||
case "-root":
|
case "-root":
|
||||||
case "--root":
|
case "--root":
|
||||||
@@ -748,23 +730,23 @@ namespace SabreTools
|
|||||||
break;
|
break;
|
||||||
case "-rt":
|
case "-rt":
|
||||||
case "--rom-type":
|
case "--rom-type":
|
||||||
romtype.Add(args[++i]);
|
filter.RomTypes.Add(args[++i]);
|
||||||
break;
|
break;
|
||||||
case "-seq":
|
case "-seq":
|
||||||
case "--equal":
|
case "--equal":
|
||||||
seq = GetSizeFromString(args[++i]);
|
filter.SizeEqualTo = GetSizeFromString(args[++i]);
|
||||||
break;
|
break;
|
||||||
case "-sgt":
|
case "-sgt":
|
||||||
case "--greater":
|
case "--greater":
|
||||||
sgt = GetSizeFromString(args[++i]);
|
filter.SizeGreaterThanOrEqual = GetSizeFromString(args[++i]);
|
||||||
break;
|
break;
|
||||||
case "-sha1":
|
case "-sha1":
|
||||||
case "--sha1":
|
case "--sha1":
|
||||||
sha1.Add(args[++i]);
|
filter.SHA1s.Add(args[++i]);
|
||||||
break;
|
break;
|
||||||
case "-slt":
|
case "-slt":
|
||||||
case "--less":
|
case "--less":
|
||||||
slt = GetSizeFromString(args[++i]);
|
filter.SizeLessThanOrEqual = GetSizeFromString(args[++i]);
|
||||||
break;
|
break;
|
||||||
case "-t":
|
case "-t":
|
||||||
case "--temp":
|
case "--temp":
|
||||||
@@ -825,7 +807,7 @@ namespace SabreTools
|
|||||||
break;
|
break;
|
||||||
case "-crc":
|
case "-crc":
|
||||||
case "--crc":
|
case "--crc":
|
||||||
crc.Add(split[1]);
|
filter.CRCs.Add(split[1]);
|
||||||
break;
|
break;
|
||||||
case "-da":
|
case "-da":
|
||||||
case "--date":
|
case "--date":
|
||||||
@@ -875,11 +857,11 @@ namespace SabreTools
|
|||||||
break;
|
break;
|
||||||
case "-gn":
|
case "-gn":
|
||||||
case "--game-name":
|
case "--game-name":
|
||||||
gamename.Add(split[1]);
|
filter.GameNames.Add(split[1]);
|
||||||
break;
|
break;
|
||||||
case "-gt":
|
case "-gt":
|
||||||
case "--game-type":
|
case "--game-type":
|
||||||
gametype.Add(split[1]);
|
filter.MachineTypes |= Filter.GetMachneTypeFromString(split[1], _logger);
|
||||||
break;
|
break;
|
||||||
case "-gz":
|
case "-gz":
|
||||||
case "--gz":
|
case "--gz":
|
||||||
@@ -898,11 +880,11 @@ namespace SabreTools
|
|||||||
break;
|
break;
|
||||||
case "-is":
|
case "-is":
|
||||||
case "--status":
|
case "--status":
|
||||||
status.Add(split[1]);
|
filter.ItemStatuses |= Filter.GetStatusFromString(split[1], _logger);
|
||||||
break;
|
break;
|
||||||
case "-md5":
|
case "-md5":
|
||||||
case "--md5":
|
case "--md5":
|
||||||
md5.Add(split[1]);
|
filter.MD5s.Add(split[1]);
|
||||||
break;
|
break;
|
||||||
case "-mt":
|
case "-mt":
|
||||||
case "--mt":
|
case "--mt":
|
||||||
@@ -914,35 +896,35 @@ namespace SabreTools
|
|||||||
break;
|
break;
|
||||||
case "-ncrc":
|
case "-ncrc":
|
||||||
case "--not-crc":
|
case "--not-crc":
|
||||||
notcrc.Add(split[1]);
|
filter.NotCRCs.Add(split[i]);
|
||||||
break;
|
break;
|
||||||
case "-ngn":
|
case "-ngn":
|
||||||
case "--not-game":
|
case "--not-game":
|
||||||
notgamename.Add(split[1]);
|
filter.NotGameNames.Add(split[1]);
|
||||||
break;
|
break;
|
||||||
case "-ngt":
|
case "-ngt":
|
||||||
case "--not-gtype":
|
case "--not-gtype":
|
||||||
notgametype.Add(split[1]);
|
filter.NotMachineTypes |= Filter.GetMachneTypeFromString(split[1], _logger);
|
||||||
break;
|
break;
|
||||||
case "-nis":
|
case "-nis":
|
||||||
case "--not-status":
|
case "--not-status":
|
||||||
notstatus.Add(split[1]);
|
filter.NotItemStatuses |= Filter.GetStatusFromString(split[1], _logger);
|
||||||
break;
|
break;
|
||||||
case "-nmd5":
|
case "-nmd5":
|
||||||
case "--not-md5":
|
case "--not-md5":
|
||||||
notmd5.Add(split[1]);
|
filter.NotMD5s.Add(split[1]);
|
||||||
break;
|
break;
|
||||||
case "-nrn":
|
case "-nrn":
|
||||||
case "--not-rom":
|
case "--not-rom":
|
||||||
notromname.Add(split[1]);
|
filter.NotRomNames.Add(split[1]);
|
||||||
break;
|
break;
|
||||||
case "-nrt":
|
case "-nrt":
|
||||||
case "--not-type":
|
case "--not-type":
|
||||||
notromtype.Add(split[1]);
|
filter.NotRomTypes.Add(split[1]);
|
||||||
break;
|
break;
|
||||||
case "-nsha1":
|
case "-nsha1":
|
||||||
case "--not-sha1":
|
case "--not-sha1":
|
||||||
notsha1.Add(split[1]);
|
filter.NotSHA1s.Add(split[1]);
|
||||||
break;
|
break;
|
||||||
case "-out":
|
case "-out":
|
||||||
case "--out":
|
case "--out":
|
||||||
@@ -977,27 +959,27 @@ namespace SabreTools
|
|||||||
break;
|
break;
|
||||||
case "-rn":
|
case "-rn":
|
||||||
case "--rom-name":
|
case "--rom-name":
|
||||||
romname.Add(split[1]);
|
filter.RomNames.Add(split[1]);
|
||||||
break;
|
break;
|
||||||
case "-rt":
|
case "-rt":
|
||||||
case "--rom-type":
|
case "--rom-type":
|
||||||
romtype.Add(split[1]);
|
filter.RomTypes.Add(split[1]);
|
||||||
break;
|
break;
|
||||||
case "-seq":
|
case "-seq":
|
||||||
case "--equal":
|
case "--equal":
|
||||||
seq = GetSizeFromString(split[1]);
|
filter.SizeEqualTo = GetSizeFromString(split[1]);
|
||||||
break;
|
break;
|
||||||
case "-sgt":
|
case "-sgt":
|
||||||
case "--greater":
|
case "--greater":
|
||||||
sgt = GetSizeFromString(split[1]);
|
filter.SizeGreaterThanOrEqual = GetSizeFromString(split[1]);
|
||||||
break;
|
break;
|
||||||
case "-sha1":
|
case "-sha1":
|
||||||
case "--sha1":
|
case "--sha1":
|
||||||
sha1.Add(split[1]);
|
filter.SHA1s.Add(split[1]);
|
||||||
break;
|
break;
|
||||||
case "-slt":
|
case "-slt":
|
||||||
case "--less":
|
case "--less":
|
||||||
slt = GetSizeFromString(split[1]);
|
filter.SizeLessThanOrEqual = GetSizeFromString(split[1]);
|
||||||
break;
|
break;
|
||||||
case "-t":
|
case "-t":
|
||||||
case "--temp":
|
case "--temp":
|
||||||
@@ -1168,9 +1150,7 @@ namespace SabreTools
|
|||||||
InitUpdate(inputs, filename, name, description, rootdir, category, version, date, author, email, homepage, url, comment, header,
|
InitUpdate(inputs, filename, name, description, rootdir, category, version, date, author, email, homepage, url, comment, header,
|
||||||
superdat, forcemerge, forcend, forcepack, excludeOf, datFormat, usegame, prefix,
|
superdat, forcemerge, forcend, forcepack, excludeOf, datFormat, usegame, prefix,
|
||||||
postfix, quotes, repext, addext, remext, datPrefix, romba, merge, diffMode, inplace, skip, removeDateFromAutomaticName,
|
postfix, quotes, repext, addext, remext, datPrefix, romba, merge, diffMode, inplace, skip, removeDateFromAutomaticName,
|
||||||
gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, status, gametype,
|
filter, splitType, trim, single, root, outDir, cleanGameNames, softlist, dedup, maxParallelism);
|
||||||
notgamename, notromname, notromtype, notcrc, notmd5, notsha1, notstatus, notgametype, runnable,
|
|
||||||
splitType, trim, single, root, outDir, cleanGameNames, softlist, dedup, maxParallelism);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// If we're using the verifier
|
// If we're using the verifier
|
||||||
|
|||||||
Reference in New Issue
Block a user