[SabreTools, DatFile] Add set flag, add better logging

This commit is contained in:
Matt Nadareski
2017-01-18 11:11:57 -08:00
parent 2bb7283d64
commit ce168a961b
5 changed files with 22 additions and 6 deletions

View File

@@ -217,6 +217,7 @@ namespace SabreTools.Helper.Data
helptext.Add(" -dat= Input DAT to rebuild against"); helptext.Add(" -dat= Input DAT to rebuild against");
helptext.Add(" -out= Output directory"); helptext.Add(" -out= Output directory");
helptext.Add(" -t=, --temp= Set the temporary directory to use"); helptext.Add(" -t=, --temp= Set the temporary directory to use");
helptext.Add(" -set Enable set-creation mode (lower I/O, slower)");
helptext.Add(" -del, --delete Delete input files [DO NOT USE]"); helptext.Add(" -del, --delete Delete input files [DO NOT USE]");
helptext.Add(" -in, --inverse Rebuild only files not in DAT"); helptext.Add(" -in, --inverse Rebuild only files not in DAT");
helptext.Add(" -qs, --quick Enable quick scanning of archives"); helptext.Add(" -qs, --quick Enable quick scanning of archives");

View File

@@ -158,6 +158,7 @@ namespace SabreTools.Helper.Dats
// If the input is a file // If the input is a file
if (File.Exists(input)) if (File.Exists(input))
{ {
logger.User("Checking file: '" + input + "'");
RebuildToOutputWithoutSetsHelper(input, outDir, tempDir, quickScan, date, delete, inverse, RebuildToOutputWithoutSetsHelper(input, outDir, tempDir, quickScan, date, delete, inverse,
outputFormat, romba, archiveScanLevel, updateDat, headerToCheckAgainst, maxDegreeOfParallelism, logger); outputFormat, romba, archiveScanLevel, updateDat, headerToCheckAgainst, maxDegreeOfParallelism, logger);
} }
@@ -165,9 +166,10 @@ namespace SabreTools.Helper.Dats
// If the input is a directory // If the input is a directory
else if (Directory.Exists(input)) else if (Directory.Exists(input))
{ {
List<string> files = Directory.EnumerateFiles(input, "*", SearchOption.AllDirectories).ToList(); logger.User("Checking directory: '" + input + "'");
foreach (string file in files) foreach (string file in Directory.EnumerateFiles(input, "*", SearchOption.AllDirectories))
{ {
logger.User("Checking file: '" + file + "'");
RebuildToOutputWithoutSetsHelper(file, outDir, tempDir, quickScan, date, delete, inverse, RebuildToOutputWithoutSetsHelper(file, outDir, tempDir, quickScan, date, delete, inverse,
outputFormat, romba, archiveScanLevel, updateDat, headerToCheckAgainst, maxDegreeOfParallelism, logger); outputFormat, romba, archiveScanLevel, updateDat, headerToCheckAgainst, maxDegreeOfParallelism, logger);
} }

View File

@@ -377,7 +377,7 @@ Options:
The user-supplied DAT used to check which files need to be rebuilt. Multiple The user-supplied DAT used to check which files need to be rebuilt. Multiple
occurrences of this flag are allowed. occurrences of this flag are allowed.
-out= Set the name of the output directory -out= Set the name of the output directory
This sets an output folder to be used when the files are created. If a path This sets an output folder to be used when the files are created. If a path
is not defined, the application directory is used instead. is not defined, the application directory is used instead.
@@ -386,6 +386,13 @@ Options:
(inside the running folder) is not preferred. This is used for any operations that (inside the running folder) is not preferred. This is used for any operations that
require an archive to be extracted. require an archive to be extracted.
-set Enable set-creation mode (lower I/O, slower)
Optionally for slower computers, set-creation mode can be enabled. This mode parses
through all inputs and creates the logical sets first, reducing the amount of I/O
that is required to rebuild all sets by opening each output folder or archive only
once. This is much slower than the standard mode, however, because of the preprocessing
that it requires.
-d, --delete Enable deletion of the input files [DO NOT USE] -d, --delete Enable deletion of the input files [DO NOT USE]
Optionally, the input files, once processed, can be deleted. This can be useful Optionally, the input files, once processed, can be deleted. This can be useful
when the original file structure is no longer needed or if there is limited space when the original file structure is no longer needed or if there is limited space

View File

@@ -301,6 +301,7 @@ namespace SabreTools
/// <param name="inputs">List of input files/folders to check</param> /// <param name="inputs">List of input files/folders to check</param>
/// <param name="outDir">Output directory to use to build to</param> /// <param name="outDir">Output directory to use to build to</param>
/// <param name="tempDir">Temporary directory for archive extraction</param> /// <param name="tempDir">Temporary directory for archive extraction</param>
/// <param name="set">True if set-building mode should be enabled, false otherwise</param>
/// <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="date">True if the date from the DAT should be used if available, false otherwise</param> /// <param name="date">True if the date from the DAT should be used if available, false otherwise</param>
/// <param name="delete">True if input files should be deleted, false otherwise</param> /// <param name="delete">True if input files should be deleted, false otherwise</param>
@@ -314,7 +315,7 @@ namespace SabreTools
/// <param name="updateDat">True if the updated DAT should be output, false otherwise</param> /// <param name="updateDat">True if the updated DAT should be output, 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="maxDegreeOfParallelism">Integer representing the maximum amount of parallelization to be used</param> /// <param name="maxDegreeOfParallelism">Integer representing the maximum amount of parallelization to be used</param>
private static void InitSort(List<string> datfiles, List<string> inputs, string outDir, string tempDir, bool quickScan, bool date, bool delete, private static void InitSort(List<string> datfiles, List<string> inputs, string outDir, string tempDir, bool set, bool quickScan, bool date, bool delete,
bool inverse, OutputFormat outputFormat, bool romba, int sevenzip, int gz, int rar, int zip, bool updateDat, string headerToCheckAgainst, bool inverse, OutputFormat outputFormat, bool romba, int sevenzip, int gz, int rar, int zip, bool updateDat, string headerToCheckAgainst,
int maxDegreeOfParallelism) int maxDegreeOfParallelism)
{ {
@@ -332,7 +333,7 @@ namespace SabreTools
} }
_logger.User("Populating complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff")); _logger.User("Populating complete in " + DateTime.Now.Subtract(start).ToString(@"hh\:mm\:ss\.fffff"));
datdata.RebuildToOutput(inputs, outDir, tempDir, true /*set*/, quickScan, date, delete, inverse, outputFormat, romba, asl, datdata.RebuildToOutput(inputs, outDir, tempDir, set, quickScan, date, delete, inverse, outputFormat, romba, asl,
updateDat, headerToCheckAgainst, maxDegreeOfParallelism, _logger); updateDat, headerToCheckAgainst, maxDegreeOfParallelism, _logger);
} }

View File

@@ -88,6 +88,7 @@ namespace SabreTools
remext = false, remext = false,
removeDateFromAutomaticName = false, removeDateFromAutomaticName = false,
romba = false, romba = false,
set = false,
showBaddumpColumn = false, showBaddumpColumn = false,
showNodumpColumn = false, showNodumpColumn = false,
shortname = false, shortname = false,
@@ -430,6 +431,10 @@ namespace SabreTools
case "--superdat": case "--superdat":
superdat = true; superdat = true;
break; break;
case "-set":
case "--set":
set = true;
break;
case "-sf": case "-sf":
case "--skip": case "--skip":
skip = true; skip = true;
@@ -1052,7 +1057,7 @@ namespace SabreTools
// If we're using the sorter // If we're using the sorter
else if (sort) else if (sort)
{ {
InitSort(datfiles, inputs, outDir, tempDir, quickScan, addFileDates, delete, inverse, InitSort(datfiles, inputs, outDir, tempDir, set, quickScan, addFileDates, delete, inverse,
outputFormat, romba, sevenzip, gz, rar, zip, updateDat, header, maxParallelism); outputFormat, romba, sevenzip, gz, rar, zip, updateDat, header, maxParallelism);
} }