[DatFile] Add inplace to regular updates

This commit is contained in:
Matt Nadareski
2017-04-01 13:13:07 -07:00
parent 595ece5006
commit 4016a66b1c
2 changed files with 15 additions and 8 deletions

View File

@@ -28,7 +28,7 @@ namespace SabreTools.Helper.Dats
/// <param name="outDir">Optional param for output directory</param>
/// <param name="merge">True if input files should be merged into a single file, false otherwise</param>
/// <param name="diff">Non-zero flag for diffing mode, zero otherwise</param>
/// <param name="inplace">True if the cascade-diffed files should overwrite their inputs, false otherwise</param>
/// <param name="inplace">True if the output files should overwrite their inputs, 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="clean">True to clean the game names to WoD standard, false otherwise (default)</param>
@@ -77,7 +77,7 @@ namespace SabreTools.Helper.Dats
// Otherwise, loop through all of the inputs individually
else
{
Update(inputPaths, outDir, clean, remUnicode, descAsName, filter, splitType, trim, single, root);
Update(inputPaths, outDir, inplace, clean, remUnicode, descAsName, filter, splitType, trim, single, root);
}
return;
}
@@ -461,7 +461,7 @@ namespace SabreTools.Helper.Dats
/// <param name="outDir">Optional param for output directory</param>
/// <param name="merge">True if input files should be merged into a single file, false otherwise</param>
/// <param name="diff">Non-zero flag for diffing mode, zero otherwise</param>
/// <param name="inplace">True if the cascade-diffed files should overwrite their inputs, false otherwise</param>
/// <param name="inplace">True if the output files should overwrite their inputs, 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="clean">True to clean the game names to WoD standard, false otherwise (default)</param>
@@ -472,7 +472,7 @@ namespace SabreTools.Helper.Dats
/// <param name="trim">True if we are supposed to trim names to NTFS length, false otherwise</param>
/// <param name="single">True if all games should be replaced by '!', false otherwise</param>
/// <param name="root">String representing root directory to compare against for length calculation</param>
public void Update(List<string> inputFileNames, string outDir, bool clean, bool remUnicode, bool descAsName,
public void Update(List<string> inputFileNames, string outDir, bool inplace, bool clean, bool remUnicode, bool descAsName,
Filter filter, SplitType splitType, bool trim, bool single, string root)
{
Parallel.ForEach(inputFileNames, Globals.ParallelOptions, inputFileName =>
@@ -483,6 +483,12 @@ namespace SabreTools.Helper.Dats
inputFileName = Path.GetFullPath(inputFileName);
}
// If inplace is set, override the output dir
if (inplace)
{
outDir = Path.GetDirectoryName(inputFileName);
}
if (File.Exists(inputFileName))
{
DatFile innerDatdata = new DatFile(this);

View File

@@ -1024,10 +1024,6 @@ Options:
the creation of rollback sets or even just reduce the amount of duplicates
across multiple sets
-ip, --inplace Enable inplace, cascaded diff
This will overwrite the source files instead of writing them out to the
program folder by default (or the output folder if overridden)
-sf, --skip Skip output of first DAT
In times where the first DAT does not need to be written out a second time,
this will skip writing it. This can often speed up the output process.
@@ -1102,6 +1098,11 @@ Options:
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.
-ip, --inplace Enable overwriting in the source file
This will overwrite the source files instead of writing them out to the runtime folder
by default (or the output folder if overridden). Note that this only works for
regular updates and cascaded diffs due to how file are expected to be written.
-mt={4} Amount of threads to use
Optionally, set the number of threads to use for the multithreaded operations.
The default is 4 threads; -1 means unlimited threads created. If the user specifies