mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[DatFile] Add inplace to regular updates
This commit is contained in:
@@ -28,7 +28,7 @@ namespace SabreTools.Helper.Dats
|
|||||||
/// <param name="outDir">Optional param for output directory</param>
|
/// <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="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="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="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="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>
|
/// <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
|
// Otherwise, loop through all of the inputs individually
|
||||||
else
|
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;
|
return;
|
||||||
}
|
}
|
||||||
@@ -461,7 +461,7 @@ namespace SabreTools.Helper.Dats
|
|||||||
/// <param name="outDir">Optional param for output directory</param>
|
/// <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="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="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="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="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>
|
/// <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="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="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>
|
/// <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)
|
Filter filter, SplitType splitType, bool trim, bool single, string root)
|
||||||
{
|
{
|
||||||
Parallel.ForEach(inputFileNames, Globals.ParallelOptions, inputFileName =>
|
Parallel.ForEach(inputFileNames, Globals.ParallelOptions, inputFileName =>
|
||||||
@@ -483,6 +483,12 @@ namespace SabreTools.Helper.Dats
|
|||||||
inputFileName = Path.GetFullPath(inputFileName);
|
inputFileName = Path.GetFullPath(inputFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If inplace is set, override the output dir
|
||||||
|
if (inplace)
|
||||||
|
{
|
||||||
|
outDir = Path.GetDirectoryName(inputFileName);
|
||||||
|
}
|
||||||
|
|
||||||
if (File.Exists(inputFileName))
|
if (File.Exists(inputFileName))
|
||||||
{
|
{
|
||||||
DatFile innerDatdata = new DatFile(this);
|
DatFile innerDatdata = new DatFile(this);
|
||||||
|
|||||||
@@ -1023,10 +1023,6 @@ Options:
|
|||||||
leaves the files that are not in one of the previous DATs. This can allow for
|
leaves the files that are not in one of the previous DATs. This can allow for
|
||||||
the creation of rollback sets or even just reduce the amount of duplicates
|
the creation of rollback sets or even just reduce the amount of duplicates
|
||||||
across multiple sets
|
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
|
-sf, --skip Skip output of first DAT
|
||||||
In times where the first DAT does not need to be written out a second time,
|
In times where the first DAT does not need to be written out a second time,
|
||||||
@@ -1102,6 +1098,11 @@ Options:
|
|||||||
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.
|
||||||
|
|
||||||
|
-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
|
-mt={4} Amount of threads to use
|
||||||
Optionally, set the number of threads to use for the multithreaded operations.
|
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
|
The default is 4 threads; -1 means unlimited threads created. If the user specifies
|
||||||
|
|||||||
Reference in New Issue
Block a user