mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[DatFile] Add quickscan to verify
This commit is contained in:
@@ -380,6 +380,7 @@ namespace SabreTools.Helper.Data
|
||||
helptext.Add(" -dat= Input DAT to verify against");
|
||||
helptext.Add(" -t=, --temp= Set the temporary directory to use");
|
||||
helptext.Add(" -ho, --hash-only Check files by hash only");
|
||||
helptext.Add(" -qs, --quick Enable quick scanning of archives");
|
||||
helptext.Add(" -h=, --header= Set a header skipper to use, blank means all");
|
||||
|
||||
// Additional Notes
|
||||
|
||||
@@ -469,10 +469,11 @@ namespace SabreTools.Helper.Dats
|
||||
/// <param name="inputs">List of input directories to compare against</param>
|
||||
/// <param name="tempDir">Temporary directory for archive extraction</param>
|
||||
/// <param name="hashOnly">True if only hashes should be checked, false for full file information</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="logger">Logger object for file and console output</param>
|
||||
/// <returns>True if verification was a success, false otherwise</returns>
|
||||
public bool VerifyDirectory(List<string> inputs, string tempDir, bool hashOnly, string headerToCheckAgainst, Logger logger)
|
||||
public bool VerifyDirectory(List<string> inputs, string tempDir, bool hashOnly, bool quickScan, string headerToCheckAgainst, Logger logger)
|
||||
{
|
||||
// Check the temp directory exists
|
||||
if (String.IsNullOrEmpty(tempDir))
|
||||
@@ -500,7 +501,7 @@ namespace SabreTools.Helper.Dats
|
||||
logger.User("Processing files:\n");
|
||||
foreach (string input in inputs)
|
||||
{
|
||||
PopulateFromDir(input, false /* noMD5 */, false /* noSHA1 */, true /* bare */, false /* archivesAsFiles */,
|
||||
PopulateFromDir(input, quickScan /* noMD5 */, quickScan /* noSHA1 */, true /* bare */, false /* archivesAsFiles */,
|
||||
true /* enableGzip */, false /* addBlanks */, false /* addDate */, tempDir /* tempDir */, false /* copyFiles */,
|
||||
headerToCheckAgainst, 4 /* maxDegreeOfParallelism */, logger);
|
||||
}
|
||||
|
||||
@@ -906,6 +906,12 @@ Options:
|
||||
This allows verification of (possibly) incorrectly named folders and sets to be
|
||||
verified without worrying about the proper set structure to be there.
|
||||
|
||||
-qs, --quick Enable quick scanning of archives
|
||||
For all archives, if this flag is enabled, it will only use the header information
|
||||
to get the archive entries' file information. The upside to this is that it is much
|
||||
quicker than extracting all files to the temp folder. On the downside, it can only
|
||||
get the CRC and size from most archive formats, leading to possible issues.
|
||||
|
||||
-h=, --header= Remove headers from hash calculations
|
||||
If this is set, then all files that have copier headers that are detected will
|
||||
have them removed from the hash calculation. This will allow for a headered collection
|
||||
|
||||
@@ -790,8 +790,9 @@ namespace SabreTools
|
||||
/// <param name="inputs">Input directories to compare against</param>
|
||||
/// <param name="tempDir">Temporary directory for archive extraction</param>
|
||||
/// <param name="hashOnly">True if only hashes should be checked, false for full file information</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>
|
||||
private static void InitVerify(List<string> datfiles, List<string> inputs, string tempDir, bool hashOnly, string headerToCheckAgainst)
|
||||
private static void InitVerify(List<string> datfiles, List<string> inputs, string tempDir, bool hashOnly, bool quickScan, string headerToCheckAgainst)
|
||||
{
|
||||
// Get the archive scanning level
|
||||
ArchiveScanLevel asl = ArchiveTools.GetArchiveScanLevelFromNumbers(1, 1, 1, 1);
|
||||
@@ -807,7 +808,7 @@ namespace SabreTools
|
||||
}
|
||||
_logger.User("Populating complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
|
||||
|
||||
datdata.VerifyDirectory(inputs, tempDir, hashOnly, headerToCheckAgainst, _logger);
|
||||
datdata.VerifyDirectory(inputs, tempDir, hashOnly, quickScan, headerToCheckAgainst, _logger);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1109,7 +1109,7 @@ namespace SabreTools
|
||||
// If we're using the verifier
|
||||
else if (verify)
|
||||
{
|
||||
InitVerify(datfiles, inputs, tempDir, hashOnly, header);
|
||||
InitVerify(datfiles, inputs, tempDir, hashOnly, quickScan, header);
|
||||
}
|
||||
|
||||
// If nothing is set, show the help
|
||||
|
||||
Reference in New Issue
Block a user