mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[SabreTools, DatFile] Add set flag, add better logging
This commit is contained in:
@@ -217,6 +217,7 @@ namespace SabreTools.Helper.Data
|
||||
helptext.Add(" -dat= Input DAT to rebuild against");
|
||||
helptext.Add(" -out= Output directory");
|
||||
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(" -in, --inverse Rebuild only files not in DAT");
|
||||
helptext.Add(" -qs, --quick Enable quick scanning of archives");
|
||||
|
||||
@@ -158,6 +158,7 @@ namespace SabreTools.Helper.Dats
|
||||
// If the input is a file
|
||||
if (File.Exists(input))
|
||||
{
|
||||
logger.User("Checking file: '" + input + "'");
|
||||
RebuildToOutputWithoutSetsHelper(input, outDir, tempDir, quickScan, date, delete, inverse,
|
||||
outputFormat, romba, archiveScanLevel, updateDat, headerToCheckAgainst, maxDegreeOfParallelism, logger);
|
||||
}
|
||||
@@ -165,9 +166,10 @@ namespace SabreTools.Helper.Dats
|
||||
// If the input is a directory
|
||||
else if (Directory.Exists(input))
|
||||
{
|
||||
List<string> files = Directory.EnumerateFiles(input, "*", SearchOption.AllDirectories).ToList();
|
||||
foreach (string file in files)
|
||||
logger.User("Checking directory: '" + input + "'");
|
||||
foreach (string file in Directory.EnumerateFiles(input, "*", SearchOption.AllDirectories))
|
||||
{
|
||||
logger.User("Checking file: '" + file + "'");
|
||||
RebuildToOutputWithoutSetsHelper(file, outDir, tempDir, quickScan, date, delete, inverse,
|
||||
outputFormat, romba, archiveScanLevel, updateDat, headerToCheckAgainst, maxDegreeOfParallelism, logger);
|
||||
}
|
||||
|
||||
@@ -386,6 +386,13 @@ Options:
|
||||
(inside the running folder) is not preferred. This is used for any operations that
|
||||
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]
|
||||
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
|
||||
|
||||
@@ -301,6 +301,7 @@ namespace SabreTools
|
||||
/// <param name="inputs">List of input files/folders to check</param>
|
||||
/// <param name="outDir">Output directory to use to build to</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="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>
|
||||
@@ -314,7 +315,7 @@ namespace SabreTools
|
||||
/// <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="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,
|
||||
int maxDegreeOfParallelism)
|
||||
{
|
||||
@@ -332,7 +333,7 @@ namespace SabreTools
|
||||
}
|
||||
_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);
|
||||
}
|
||||
|
||||
|
||||
@@ -88,6 +88,7 @@ namespace SabreTools
|
||||
remext = false,
|
||||
removeDateFromAutomaticName = false,
|
||||
romba = false,
|
||||
set = false,
|
||||
showBaddumpColumn = false,
|
||||
showNodumpColumn = false,
|
||||
shortname = false,
|
||||
@@ -430,6 +431,10 @@ namespace SabreTools
|
||||
case "--superdat":
|
||||
superdat = true;
|
||||
break;
|
||||
case "-set":
|
||||
case "--set":
|
||||
set = true;
|
||||
break;
|
||||
case "-sf":
|
||||
case "--skip":
|
||||
skip = true;
|
||||
@@ -1052,7 +1057,7 @@ namespace SabreTools
|
||||
// If we're using the sorter
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user