[ALL] Add filtering support to D2D and Verify

Verify came for free since it uses the D2D code
This commit is contained in:
Matt Nadareski
2019-01-08 17:55:27 -08:00
parent 6be188dc0d
commit 723537f556
6 changed files with 3448 additions and 3055 deletions

View File

@@ -66,8 +66,8 @@ namespace RombaSharp
foreach (string dir in onlyDirs) foreach (string dir in onlyDirs)
{ {
// TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually // TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually
df.PopulateFromDir(dir, Hash.DeepHashes, false, false, SkipFileType.None, false, false, _tmpdir, false, null, true); df.PopulateFromDir(dir, Hash.DeepHashes, false, false, SkipFileType.None, false, false, _tmpdir, false, null, true, null);
df.PopulateFromDir(dir, Hash.DeepHashes, false, true, SkipFileType.None, false, false, _tmpdir, false, null, true); df.PopulateFromDir(dir, Hash.DeepHashes, false, true, SkipFileType.None, false, false, _tmpdir, false, null, true, null);
} }
// Create an empty Dat for files that need to be rebuilt // Create an empty Dat for files that need to be rebuilt
@@ -390,7 +390,7 @@ namespace RombaSharp
// Now run the D2D on the input and write out // Now run the D2D on the input and write out
// TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually // TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually
datfile.PopulateFromDir(source, Hash.DeepHashes, true /* bare */, false /* archivesAsFiles */, SkipFileType.None, false /* addBlanks */, datfile.PopulateFromDir(source, Hash.DeepHashes, true /* bare */, false /* archivesAsFiles */, SkipFileType.None, false /* addBlanks */,
false /* addDate */, _tmpdir, false /* copyFiles */, null /* headerToCheckAgainst */, true /* chdsAsFiles */); false /* addDate */, _tmpdir, false /* copyFiles */, null /* headerToCheckAgainst */, true /* chdsAsFiles */, null /* filter */);
datfile.Write(outDir: outdat); datfile.Write(outDir: outdat);
} }
@@ -897,7 +897,7 @@ namespace RombaSharp
// First get a list of SHA-1's from the input DATs // First get a list of SHA-1's from the input DATs
DatFile datroot = new DatFile { Type = "SuperDAT", }; DatFile datroot = new DatFile { Type = "SuperDAT", };
// TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually // TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually
datroot.PopulateFromDir(_dats, Hash.DeepHashes, false, false, SkipFileType.None, false, false, _tmpdir, false, null, true); datroot.PopulateFromDir(_dats, Hash.DeepHashes, false, false, SkipFileType.None, false, false, _tmpdir, false, null, true, null);
datroot.BucketBy(SortedBy.SHA1, DedupeType.None); datroot.BucketBy(SortedBy.SHA1, DedupeType.None);
// Create a List of dat hashes in the database (SHA-1) // Create a List of dat hashes in the database (SHA-1)
@@ -1013,7 +1013,7 @@ namespace RombaSharp
// Now rescan the depot itself // Now rescan the depot itself
DatFile depot = new DatFile(); DatFile depot = new DatFile();
// TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually // TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually
depot.PopulateFromDir(depotname, Hash.DeepHashes, false, false, SkipFileType.None, false, false, _tmpdir, false, null, true); depot.PopulateFromDir(depotname, Hash.DeepHashes, false, false, SkipFileType.None, false, false, _tmpdir, false, null, true, null);
depot.BucketBy(SortedBy.SHA1, DedupeType.None); depot.BucketBy(SortedBy.SHA1, DedupeType.None);
// Set the base queries to use // Set the base queries to use

View File

@@ -3277,8 +3277,9 @@ namespace SabreTools.Library.DatFiles
/// <param name="copyFiles">True if files should be copied to the temp directory before hashing, false otherwise</param> /// <param name="copyFiles">True if files should be copied to the temp directory before hashing, false otherwise</param>
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param> /// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
/// <param name="chdsAsFiles">True if CHDs should be treated like regular files, false otherwise</param> /// <param name="chdsAsFiles">True if CHDs should be treated like regular files, false otherwise</param>
/// <param name="filter">Filter object to be passed to the DatItem level</param>
public bool PopulateFromDir(string basePath, Hash omitFromScan, bool bare, bool archivesAsFiles, SkipFileType skipFileType, public bool PopulateFromDir(string basePath, Hash omitFromScan, bool bare, bool archivesAsFiles, SkipFileType skipFileType,
bool addBlanks, bool addDate, string tempDir, bool copyFiles, string headerToCheckAgainst, bool chdsAsFiles) bool addBlanks, bool addDate, string tempDir, bool copyFiles, string headerToCheckAgainst, bool chdsAsFiles, Filter filter)
{ {
// If the description is defined but not the name, set the name from the description // If the description is defined but not the name, set the name from the description
if (String.IsNullOrWhiteSpace(Name) && !String.IsNullOrWhiteSpace(Description)) if (String.IsNullOrWhiteSpace(Name) && !String.IsNullOrWhiteSpace(Description))
@@ -3379,6 +3380,12 @@ namespace SabreTools.Library.DatFiles
Utilities.TryDeleteDirectory(tempDir); Utilities.TryDeleteDirectory(tempDir);
} }
// If we have a valid filter, perform the filtering now
if (filter != null && filter != default(Filter))
{
filter.FilterDatFile(this);
}
return true; return true;
} }
@@ -4523,8 +4530,9 @@ namespace SabreTools.Library.DatFiles
/// <param name="quickScan">True to enable external scanning of archives, false otherwise</param> /// <param name="quickScan">True to enable external scanning of archives, false otherwise</param>
/// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param> /// <param name="headerToCheckAgainst">Populated string representing the name of the skipper to use, a blank string to use the first available checker, null otherwise</param>
/// <param name="chdsAsFiles">True if CHDs should be treated like regular files, false otherwise</param> /// <param name="chdsAsFiles">True if CHDs should be treated like regular files, false otherwise</param>
/// <param name="filter">Filter object to be passed to the DatItem level</param>
/// <returns>True if verification was a success, false otherwise</returns> /// <returns>True if verification was a success, false otherwise</returns>
public bool VerifyGeneric(List<string> inputs, bool hashOnly, bool quickScan, string headerToCheckAgainst, bool chdsAsFiles) public bool VerifyGeneric(List<string> inputs, bool hashOnly, bool quickScan, string headerToCheckAgainst, bool chdsAsFiles, Filter filter)
{ {
// TODO: We want the cross section of what's the folder and what's in the DAT. Right now, it just has what's in the DAT that's not in the folder // TODO: We want the cross section of what's the folder and what's in the DAT. Right now, it just has what's in the DAT that's not in the folder
bool success = true; bool success = true;
@@ -4535,7 +4543,7 @@ namespace SabreTools.Library.DatFiles
{ {
// TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually // TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually
PopulateFromDir(input, (quickScan ? Hash.SecureHashes : Hash.DeepHashes) /* omitFromScan */, true /* bare */, false /* archivesAsFiles */, PopulateFromDir(input, (quickScan ? Hash.SecureHashes : Hash.DeepHashes) /* omitFromScan */, true /* bare */, false /* archivesAsFiles */,
SkipFileType.None, false /* addBlanks */, false /* addDate */, "" /* tempDir */, false /* copyFiles */, headerToCheckAgainst, chdsAsFiles); SkipFileType.None, false /* addBlanks */, false /* addDate */, "" /* tempDir */, false /* copyFiles */, headerToCheckAgainst, chdsAsFiles, filter);
} }
// Setup the fixdat // Setup the fixdat

View File

@@ -330,6 +330,165 @@ Options:
compare against the input DATs. This flag forces all CHDs to be compare against the input DATs. This flag forces all CHDs to be
treated like regular files. treated like regular files.
-gn=, --game-name= Filter by game name
Include only items with this game name in the output. Additionally,
the user can specify an exact match or full C#-style regex for
pattern matching. Multiple instances of this flag are allowed.
-ngn=, --not-game-name= Filter by not game name
Include only items without this game name in the output.
Additionally, the user can specify an exact match or full C#-style
regex for pattern matching. Multiple instances of this flag are
allowed.
-gd=, --game-description= Filter by game description
Include only items with this game description in the output.
Additionally, the user can specify an exact match or full C#-style
regex for pattern matching. Multiple instances of this flag are
allowed.
-ngd=, --not-game-description= Filter by not game description
Include only items without this game description in the output.
Additionally, the user can specify an exact match or full C#-style
regex for pattern matching. Multiple instances of this flag are
allowed.
-ofg, --match-of-tags Allow cloneof and romof tags to match game name filters
If filter or exclude by game name is used, this flag will allow those
filters to be checked against the romof and cloneof tags as well.
This can allow for more advanced set-building, especially in
arcade-based sets.
-rn=, --item-name= Filter by item name
Include only items with this item name in the output. Additionally,
the user can specify an exact match or full C#-style regex for
pattern matching. Multiple instances of this flag are allowed.
-nrn=, --not-item-name= Filter by not item name
Include only items without this item name in the output.
Additionally, the user can specify an exact match or full C#-style
regex for pattern matching. Multiple instances of this flag are
allowed.
-rt=, --item-type= Filter by item type
Include only items with this item type in the output. Additionally,
the user can specify an exact match or full C#-style regex for
pattern matching. Multiple instances of this flag are allowed.
-nrt=, --not-item-type= Filter by not item type
Include only items without this item type in the output.
Additionally, the user can specify an exact match or full C#-style
regex for pattern matching. Multiple instances of this flag are
allowed.
-sgt=, --greater= Filter by size >=
Only include items whose size is greater than or equal to this value
in the output DAT. Users can specify either a regular integer number
or a number with a standard postfix. e.g. 8kb => 8000 or 8kib => 8192
-slt=, --less= Filter by size =<
Only include items whose size is less than or equal to this value in
the output DAT. Users can specify either a regular integer number or
a number with a standard postfix. e.g. 8kb => 8000 or 8kib => 8192
-seq=, --equal= Filter by size ==
Only include items of this exact size in the output DAT. Users can
specify either a regular integer number or a number with a standard
postfix. e.g. 8kb => 8000 or 8kib => 8192
-crc=, --crc= Filter by CRC hash
Include only items with this CRC hash in the output. Additionally,
the user can specify an exact match or full C#-style regex for
pattern matching. Multiple instances of this flag are allowed.
-ncrc=, --not-crc= Filter by not CRC hash
Include only items without this CRC hash in the output. Additionally,
the user can specify an exact match or full C#-style regex for
pattern matching. Multiple instances of this flag are allowed.
-md5=, --md5= Filter by MD5 hash
Include only items with this MD5 hash in the output. Additionally,
the user can specify an exact match or full C#-style regex for
pattern matching. Multiple instances of this flag are allowed.
-nmd5=, --not-md5= Filter by not MD5 hash
Include only items without this MD5 hash in the output. Additionally,
the user can specify an exact match or full C#-style regex for
pattern matching. Multiple instances of this flag are allowed.
-sha1=, --sha1= Filter by SHA-1 hash
Include only items with this SHA-1 hash in the output. Additionally,
the user can specify an exact match or full C#-style regex for
pattern matching. Multiple instances of this flag are allowed.
-nsha1=, --not-sha1= Filter by not SHA-1 hash
Include only items without this SHA-1 hash in the output.
Additionally, the user can specify an exact match or full C#-style
regex for pattern matching. Multiple instances of this flag are
allowed.
-sha256=, --sha256= Filter by SHA-256 hash
Include only items with this SHA-256 hash in the output.
Additionally, the user can specify an exact match or full C#-style
regex for pattern matching. Multiple instances of this flag are
allowed.
-nsha256=, --not-sha256= Filter by not SHA-256 hash
Include only items without this SHA-256 hash in the output.
Additionally, the user can specify an exact match or full C#-style
regex for pattern matching. Multiple instances of this flag are
allowed.
-sha384=, --sha384= Filter by SHA-384 hash
Include only items with this SHA-384 hash in the output.
Additionally, the user can specify an exact match or full C#-style
regex for pattern matching. Multiple instances of this flag are
allowed.
-nsha384=, --not-sha384= Filter by not SHA-384 hash
Include only items without this SHA-384 hash in the output.
Additionally, the user can specify an exact match or full C#-style
regex for pattern matching. Multiple instances of this flag are
allowed.
-sha512=, --sha512= Filter by SHA-512 hash
Include only items with this SHA-512 hash in the output.
Additionally, the user can specify an exact match or full C#-style
regex for pattern matching. Multiple instances of this flag are
allowed.
-nsha512=, --not-sha512= Filter by not SHA-512 hash
Include only items without this SHA-512 hash in the output.
Additionally, the user can specify an exact match or full C#-style
regex for pattern matching. Multiple instances of this flag are
allowed.
-is=, --status= Include only items with a given status
Include only items with this item status in the output. Multiple
instances of this flag are allowed.
Possible values are: None, Good, BadDump, Nodump, Verified
-nis=, --not-status= Exclude only items with a given status
Include only items without this item status in the output. Multiple
instances of this flag are allowed.
Possible values are: None, Good, BadDump, Nodump, Verified
-gt=, --game-type= Include only games with a given type
Include only items with this game type in the output. Multiple
instances of this flag are allowed.
Possible values are: None, Bios, Device, Mechanical
-ngt=, --not-game-type= Exclude only games with a given type
Include only items without this game type in the output. Multiple
instances of this flag are allowed.
Possible values are: None, Bios, Device, Mechanical
-run, --runnable Include only items that are marked runnable
This allows users to include only verified runnable games.
-nrun, --not-runnable Include only items that are not marked runnable
This allows users to include only unrunnable games.
-t=, --temp= Set the temporary directory to use -t=, --temp= Set the temporary directory to use
Optionally, a temp folder can be supplied in the case the default Optionally, a temp folder can be supplied in the case the default
temp directory is not preferred. temp directory is not preferred.
@@ -1368,6 +1527,165 @@ Options:
parent sets based on the cloneof and romof tags as well as device parent sets based on the cloneof and romof tags as well as device
references. This is incompatible with the other --dat-X flags. references. This is incompatible with the other --dat-X flags.
-gn=, --game-name= Filter by game name
Include only items with this game name in the output. Additionally,
the user can specify an exact match or full C#-style regex for
pattern matching. Multiple instances of this flag are allowed.
-ngn=, --not-game-name= Filter by not game name
Include only items without this game name in the output.
Additionally, the user can specify an exact match or full C#-style
regex for pattern matching. Multiple instances of this flag are
allowed.
-gd=, --game-description= Filter by game description
Include only items with this game description in the output.
Additionally, the user can specify an exact match or full C#-style
regex for pattern matching. Multiple instances of this flag are
allowed.
-ngd=, --not-game-description= Filter by not game description
Include only items without this game description in the output.
Additionally, the user can specify an exact match or full C#-style
regex for pattern matching. Multiple instances of this flag are
allowed.
-ofg, --match-of-tags Allow cloneof and romof tags to match game name filters
If filter or exclude by game name is used, this flag will allow those
filters to be checked against the romof and cloneof tags as well.
This can allow for more advanced set-building, especially in
arcade-based sets.
-rn=, --item-name= Filter by item name
Include only items with this item name in the output. Additionally,
the user can specify an exact match or full C#-style regex for
pattern matching. Multiple instances of this flag are allowed.
-nrn=, --not-item-name= Filter by not item name
Include only items without this item name in the output.
Additionally, the user can specify an exact match or full C#-style
regex for pattern matching. Multiple instances of this flag are
allowed.
-rt=, --item-type= Filter by item type
Include only items with this item type in the output. Additionally,
the user can specify an exact match or full C#-style regex for
pattern matching. Multiple instances of this flag are allowed.
-nrt=, --not-item-type= Filter by not item type
Include only items without this item type in the output.
Additionally, the user can specify an exact match or full C#-style
regex for pattern matching. Multiple instances of this flag are
allowed.
-sgt=, --greater= Filter by size >=
Only include items whose size is greater than or equal to this value
in the output DAT. Users can specify either a regular integer number
or a number with a standard postfix. e.g. 8kb => 8000 or 8kib => 8192
-slt=, --less= Filter by size =<
Only include items whose size is less than or equal to this value in
the output DAT. Users can specify either a regular integer number or
a number with a standard postfix. e.g. 8kb => 8000 or 8kib => 8192
-seq=, --equal= Filter by size ==
Only include items of this exact size in the output DAT. Users can
specify either a regular integer number or a number with a standard
postfix. e.g. 8kb => 8000 or 8kib => 8192
-crc=, --crc= Filter by CRC hash
Include only items with this CRC hash in the output. Additionally,
the user can specify an exact match or full C#-style regex for
pattern matching. Multiple instances of this flag are allowed.
-ncrc=, --not-crc= Filter by not CRC hash
Include only items without this CRC hash in the output. Additionally,
the user can specify an exact match or full C#-style regex for
pattern matching. Multiple instances of this flag are allowed.
-md5=, --md5= Filter by MD5 hash
Include only items with this MD5 hash in the output. Additionally,
the user can specify an exact match or full C#-style regex for
pattern matching. Multiple instances of this flag are allowed.
-nmd5=, --not-md5= Filter by not MD5 hash
Include only items without this MD5 hash in the output. Additionally,
the user can specify an exact match or full C#-style regex for
pattern matching. Multiple instances of this flag are allowed.
-sha1=, --sha1= Filter by SHA-1 hash
Include only items with this SHA-1 hash in the output. Additionally,
the user can specify an exact match or full C#-style regex for
pattern matching. Multiple instances of this flag are allowed.
-nsha1=, --not-sha1= Filter by not SHA-1 hash
Include only items without this SHA-1 hash in the output.
Additionally, the user can specify an exact match or full C#-style
regex for pattern matching. Multiple instances of this flag are
allowed.
-sha256=, --sha256= Filter by SHA-256 hash
Include only items with this SHA-256 hash in the output.
Additionally, the user can specify an exact match or full C#-style
regex for pattern matching. Multiple instances of this flag are
allowed.
-nsha256=, --not-sha256= Filter by not SHA-256 hash
Include only items without this SHA-256 hash in the output.
Additionally, the user can specify an exact match or full C#-style
regex for pattern matching. Multiple instances of this flag are
allowed.
-sha384=, --sha384= Filter by SHA-384 hash
Include only items with this SHA-384 hash in the output.
Additionally, the user can specify an exact match or full C#-style
regex for pattern matching. Multiple instances of this flag are
allowed.
-nsha384=, --not-sha384= Filter by not SHA-384 hash
Include only items without this SHA-384 hash in the output.
Additionally, the user can specify an exact match or full C#-style
regex for pattern matching. Multiple instances of this flag are
allowed.
-sha512=, --sha512= Filter by SHA-512 hash
Include only items with this SHA-512 hash in the output.
Additionally, the user can specify an exact match or full C#-style
regex for pattern matching. Multiple instances of this flag are
allowed.
-nsha512=, --not-sha512= Filter by not SHA-512 hash
Include only items without this SHA-512 hash in the output.
Additionally, the user can specify an exact match or full C#-style
regex for pattern matching. Multiple instances of this flag are
allowed.
-is=, --status= Include only items with a given status
Include only items with this item status in the output. Multiple
instances of this flag are allowed.
Possible values are: None, Good, BadDump, Nodump, Verified
-nis=, --not-status= Exclude only items with a given status
Include only items without this item status in the output. Multiple
instances of this flag are allowed.
Possible values are: None, Good, BadDump, Nodump, Verified
-gt=, --game-type= Include only games with a given type
Include only items with this game type in the output. Multiple
instances of this flag are allowed.
Possible values are: None, Bios, Device, Mechanical
-ngt=, --not-game-type= Exclude only games with a given type
Include only items without this game type in the output. Multiple
instances of this flag are allowed.
Possible values are: None, Bios, Device, Mechanical
-run, --runnable Include only items that are marked runnable
This allows users to include only verified runnable games.
-nrun, --not-runnable Include only items that are not marked runnable
This allows users to include only unrunnable games.
** Section 3.0 - Examples ** Section 3.0 - Examples
Here are a few usage examples based on features that are commonly used by most Here are a few usage examples based on features that are commonly used by most

View File

@@ -2405,6 +2405,36 @@ Some special strings that can be used:
datFromDir.AddFeature(_copyFilesFlag); datFromDir.AddFeature(_copyFilesFlag);
datFromDir.AddFeature(_headerStringInput); datFromDir.AddFeature(_headerStringInput);
datFromDir.AddFeature(_chdsAsFilesFlag); datFromDir.AddFeature(_chdsAsFilesFlag);
datFromDir.AddFeature(_gameNameListInput);
datFromDir.AddFeature(_notGameNameListInput);
datFromDir.AddFeature(_gameDescriptionListInput);
datFromDir.AddFeature(_notGameDescriptionListInput);
datFromDir.AddFeature(_matchOfTagsFlag);
datFromDir.AddFeature(_itemNameListInput);
datFromDir.AddFeature(_notItemNameListInput);
datFromDir.AddFeature(_itemTypeListInput);
datFromDir.AddFeature(_notItemTypeListInput);
datFromDir.AddFeature(_greaterStringInput);
datFromDir.AddFeature(_lessStringInput);
datFromDir.AddFeature(_equalStringInput);
datFromDir.AddFeature(_crcListInput);
datFromDir.AddFeature(_notCrcListInput);
datFromDir.AddFeature(_md5ListInput);
datFromDir.AddFeature(_notMd5ListInput);
datFromDir.AddFeature(_sha1ListInput);
datFromDir.AddFeature(_notSha1ListInput);
datFromDir.AddFeature(_sha256ListInput);
datFromDir.AddFeature(_notSha256ListInput);
datFromDir.AddFeature(_sha384ListInput);
datFromDir.AddFeature(_notSha384ListInput);
datFromDir.AddFeature(_sha512ListInput);
datFromDir.AddFeature(_notSha512ListInput);
datFromDir.AddFeature(_statusListInput);
datFromDir.AddFeature(_notStatusListInput);
datFromDir.AddFeature(_gameTypeListInput);
datFromDir.AddFeature(_notGameTypeListInput);
datFromDir.AddFeature(_runnableFlag);
datFromDir.AddFeature(_notRunnableFlag);
datFromDir.AddFeature(_tempStringInput); datFromDir.AddFeature(_tempStringInput);
datFromDir.AddFeature(_outputDirStringInput); datFromDir.AddFeature(_outputDirStringInput);
datFromDir.AddFeature(_threadsInt32Input); datFromDir.AddFeature(_threadsInt32Input);
@@ -2787,6 +2817,36 @@ The stats that are outputted are as follows:
verify.AddFeature(_datDeviceNonMergedFlag); verify.AddFeature(_datDeviceNonMergedFlag);
verify.AddFeature(_datNonMergedFlag); verify.AddFeature(_datNonMergedFlag);
verify.AddFeature(_datFullNonMergedFlag); verify.AddFeature(_datFullNonMergedFlag);
verify.AddFeature(_gameNameListInput);
verify.AddFeature(_notGameNameListInput);
verify.AddFeature(_gameDescriptionListInput);
verify.AddFeature(_notGameDescriptionListInput);
verify.AddFeature(_matchOfTagsFlag);
verify.AddFeature(_itemNameListInput);
verify.AddFeature(_notItemNameListInput);
verify.AddFeature(_itemTypeListInput);
verify.AddFeature(_notItemTypeListInput);
verify.AddFeature(_greaterStringInput);
verify.AddFeature(_lessStringInput);
verify.AddFeature(_equalStringInput);
verify.AddFeature(_crcListInput);
verify.AddFeature(_notCrcListInput);
verify.AddFeature(_md5ListInput);
verify.AddFeature(_notMd5ListInput);
verify.AddFeature(_sha1ListInput);
verify.AddFeature(_notSha1ListInput);
verify.AddFeature(_sha256ListInput);
verify.AddFeature(_notSha256ListInput);
verify.AddFeature(_sha384ListInput);
verify.AddFeature(_notSha384ListInput);
verify.AddFeature(_sha512ListInput);
verify.AddFeature(_notSha512ListInput);
verify.AddFeature(_statusListInput);
verify.AddFeature(_notStatusListInput);
verify.AddFeature(_gameTypeListInput);
verify.AddFeature(_notGameTypeListInput);
verify.AddFeature(_runnableFlag);
verify.AddFeature(_notRunnableFlag);
#endregion #endregion

View File

@@ -1,6 +1,5 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using SabreTools.Library.Data; using SabreTools.Library.Data;
using SabreTools.Library.DatFiles; using SabreTools.Library.DatFiles;
using SabreTools.Library.Tools; using SabreTools.Library.Tools;
@@ -33,10 +32,13 @@ namespace SabreTools
/// <param name="skipFileType">Type of files that should be skipped on scan</param> /// <param name="skipFileType">Type of files that should be skipped on scan</param>
/// <param name="addBlankFilesForEmptyFolder">True if blank items should be created for empty folders, false otherwise</param> /// <param name="addBlankFilesForEmptyFolder">True if blank items should be created for empty folders, false otherwise</param>
/// <param name="addFileDates">True if dates should be archived for all files, false otherwise</param> /// <param name="addFileDates">True if dates should be archived for all files, false otherwise</param>
/// <param name="filter">Filter object to be passed to the DatItem level</param>
/// /* Output DAT info */ /// /* Output DAT info */
/// <param name="tempDir">Name of the directory to create a temp folder in (blank is default temp directory)</param> /// <param name="tempDir">Name of the directory to create a temp folder in (blank is default temp directory)</param>
/// <param name="outDir">Name of the directory to output the DAT to (blank is the current directory)</param> /// <param name="outDir">Name of the directory to output the DAT to (blank is the current directory)</param>
/// <param name="copyFiles">True if files should be copied to the temp directory before hashing, false otherwise</param> /// <param name="copyFiles">True if files should be copied to the temp directory before hashing, false otherwise</param>
/// /* Filtering info */
/// <param name="filter">Filter object to be passed to the DatItem level</param>
private static void InitDatFromDir(List<string> inputs, private static void InitDatFromDir(List<string> inputs,
/* Normal DAT header info */ /* Normal DAT header info */
DatHeader datHeader, DatHeader datHeader,
@@ -53,7 +55,10 @@ namespace SabreTools
/* Output DAT info */ /* Output DAT info */
string tempDir, string tempDir,
string outDir, string outDir,
bool copyFiles) bool copyFiles,
/* Filtering info */
Filter filter)
{ {
// Create a new DATFromDir object and process the inputs // Create a new DATFromDir object and process the inputs
DatFile basedat = new DatFile(datHeader) DatFile basedat = new DatFile(datHeader)
@@ -71,7 +76,7 @@ namespace SabreTools
string basePath = Path.GetFullPath(path); string basePath = Path.GetFullPath(path);
bool success = datdata.PopulateFromDir(basePath, omitFromScan, removeDateFromAutomaticName, archivesAsFiles, bool success = datdata.PopulateFromDir(basePath, omitFromScan, removeDateFromAutomaticName, archivesAsFiles,
skipFileType, addBlankFilesForEmptyFolder, addFileDates, tempDir, copyFiles, datHeader.Header, chdsAsFiles); skipFileType, addBlankFilesForEmptyFolder, addFileDates, tempDir, copyFiles, datHeader.Header, chdsAsFiles, filter);
// If it was a success, write the DAT out // If it was a success, write the DAT out
if (success) if (success)
@@ -391,6 +396,7 @@ namespace SabreTools
/// <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="chdsAsFiles">True if CHDs should be treated like regular files, false otherwise</param> /// <param name="chdsAsFiles">True if CHDs should be treated like regular files, false otherwise</param>
/// <param name="individual">True if DATs should be verified individually, false if they should be done in bulk</param> /// <param name="individual">True if DATs should be verified individually, false if they should be done in bulk</param>
/// <param name="filter">Filter object to be passed to the DatItem level</param>
private static void InitVerify( private static void InitVerify(
List<string> datfiles, List<string> datfiles,
List<string> inputs, List<string> inputs,
@@ -400,7 +406,8 @@ namespace SabreTools
string headerToCheckAgainst, string headerToCheckAgainst,
SplitType splitType, SplitType splitType,
bool chdsAsFiles, bool chdsAsFiles,
bool individual) bool individual,
Filter filter)
{ {
// Get the archive scanning level // Get the archive scanning level
ArchiveScanLevel asl = Utilities.GetArchiveScanLevelFromNumbers(1, 1, 1, 1); ArchiveScanLevel asl = Utilities.GetArchiveScanLevelFromNumbers(1, 1, 1, 1);
@@ -423,7 +430,7 @@ namespace SabreTools
} }
else else
{ {
datdata.VerifyGeneric(inputs, hashOnly, quickScan, headerToCheckAgainst, chdsAsFiles); datdata.VerifyGeneric(inputs, hashOnly, quickScan, headerToCheckAgainst, chdsAsFiles, filter);
} }
} }
} }
@@ -448,7 +455,7 @@ namespace SabreTools
} }
else else
{ {
datdata.VerifyGeneric(inputs, hashOnly, quickScan, headerToCheckAgainst, chdsAsFiles); datdata.VerifyGeneric(inputs, hashOnly, quickScan, headerToCheckAgainst, chdsAsFiles, filter);
} }
} }
} }

View File

@@ -862,7 +862,7 @@ namespace SabreTools
case "DATFromDir": case "DATFromDir":
VerifyInputs(inputs, feature); VerifyInputs(inputs, feature);
InitDatFromDir(inputs, datHeader, omitFromScan, noAutomaticDate, archivesAsFiles, chdsAsFiles, InitDatFromDir(inputs, datHeader, omitFromScan, noAutomaticDate, archivesAsFiles, chdsAsFiles,
skipFileType, addBlankFiles, addFileDates, tempDir, outDir, copyFiles); skipFileType, addBlankFiles, addFileDates, tempDir, outDir, copyFiles, filter);
break; break;
// If we're in header extract and remove mode // If we're in header extract and remove mode
case "Extract": case "Extract":
@@ -902,7 +902,7 @@ namespace SabreTools
// If we're using the verifier // If we're using the verifier
case "Verify": case "Verify":
VerifyInputs(inputs, feature); VerifyInputs(inputs, feature);
InitVerify(datfiles, inputs, depot, hashOnly, quickScan, datHeader.Header, splitType, chdsAsFiles, individual); InitVerify(datfiles, inputs, depot, hashOnly, quickScan, datHeader.Header, splitType, chdsAsFiles, individual, filter);
break; break;
// If nothing is set, show the help // If nothing is set, show the help
default: default: