diff --git a/SabreTools.Library/DatFiles/DatFile.cs b/SabreTools.Library/DatFiles/DatFile.cs
index 4c90a072..8c7b4cd4 100644
--- a/SabreTools.Library/DatFiles/DatFile.cs
+++ b/SabreTools.Library/DatFiles/DatFile.cs
@@ -427,19 +427,17 @@ namespace SabreTools.Library.DatFiles
/// Output duplicate item diff
///
/// List of inputs to write out from
- /// Output directory to write the DATs to
- public void DiffDuplicates(List inputs, string outDir)
+ public DatFile DiffDuplicates(List inputs)
{
List paths = inputs.Select(i => new ParentablePath(i)).ToList();
- DiffDuplicates(paths, outDir);
+ return DiffDuplicates(paths);
}
///
/// Output duplicate item diff
///
/// List of inputs to write out from
- /// Output directory to write the DATs to
- public void DiffDuplicates(List inputs, string outDir)
+ public DatFile DiffDuplicates(List inputs)
{
InternalStopwatch watch = new InternalStopwatch("Initializing duplicate DAT");
@@ -488,29 +486,24 @@ namespace SabreTools.Library.DatFiles
watch.Stop();
- // Finally, loop through and output each of the DATs
- watch.Start("Outputting duplicate DAT");
- dupeData.Write(outDir, overwrite: false);
- watch.Stop();
+ return dupeData;
}
///
/// Output non-cascading diffs
///
/// List of inputs to write out from
- /// Output directory to write the DATs to
- public void DiffIndividuals(List inputs, string outDir)
+ public List DiffIndividuals(List inputs)
{
List paths = inputs.Select(i => new ParentablePath(i)).ToList();
- DiffIndividuals(paths, outDir);
+ return DiffIndividuals(paths);
}
///
/// Output non-cascading diffs
///
/// List of inputs to write out from
- /// Output directory to write the DATs to
- public void DiffIndividuals(List inputs, string outDir)
+ public List DiffIndividuals(List inputs)
{
InternalStopwatch watch = new InternalStopwatch("Initializing all individual DATs");
@@ -564,37 +557,24 @@ namespace SabreTools.Library.DatFiles
watch.Stop();
- // Finally, loop through and output each of the DATs
- watch.Start("Outputting all individual DATs");
-
- Parallel.For(0, inputs.Count, Globals.ParallelOptions, j =>
- {
- string path = inputs[j].GetOutputPath(outDir, false /* inplace */);
-
- // Try to output the file
- outDats[j].Write(path, overwrite: false);
- });
-
- watch.Stop();
+ return outDats.ToList();
}
///
/// Output non-duplicate item diff
///
/// List of inputs to write out from
- /// Output directory to write the DATs to
- public void DiffNoDuplicates(List inputs, string outDir)
+ public DatFile DiffNoDuplicates(List inputs)
{
List paths = inputs.Select(i => new ParentablePath(i)).ToList();
- DiffNoDuplicates(paths, outDir);
+ return DiffNoDuplicates(paths);
}
///
/// Output non-duplicate item diff
///
/// List of inputs to write out from
- /// Output directory to write the DATs to
- public void DiffNoDuplicates(List inputs, string outDir)
+ public DatFile DiffNoDuplicates(List inputs)
{
InternalStopwatch watch = new InternalStopwatch("Initializing no duplicate DAT");
@@ -642,10 +622,7 @@ namespace SabreTools.Library.DatFiles
watch.Stop();
- // Finally, loop through and output each of the DATs
- watch.Start("Outputting no duplicate DAT");
- outerDiffData.Write(outDir, overwrite: false);
- watch.Stop();
+ return outerDiffData;
}
///
diff --git a/SabreTools/Features/Update.cs b/SabreTools/Features/Update.cs
index fc0632eb..e828d1ac 100644
--- a/SabreTools/Features/Update.cs
+++ b/SabreTools/Features/Update.cs
@@ -206,15 +206,43 @@ namespace SabreTools.Features
// Output only DatItems that are duplicated across inputs
if (updateMode.HasFlag(UpdateMode.DiffDupesOnly))
- userInputDat.DiffDuplicates(inputPaths, OutputDir);
+ {
+ DatFile dupeData = userInputDat.DiffDuplicates(inputPaths);
+
+ InternalStopwatch watch = new InternalStopwatch("Outputting duplicate DAT");
+ dupeData.Write(OutputDir, overwrite: false);
+ watch.Stop();
+ }
// Output only DatItems that are not duplicated across inputs
if (updateMode.HasFlag(UpdateMode.DiffNoDupesOnly))
- userInputDat.DiffNoDuplicates(inputPaths, OutputDir);
+ {
+ DatFile outerDiffData = userInputDat.DiffNoDuplicates(inputPaths);
+
+ InternalStopwatch watch = new InternalStopwatch("Outputting no duplicate DAT");
+ outerDiffData.Write(OutputDir, overwrite: false);
+ watch.Stop();
+ }
// Output only DatItems that are unique to each input
if (updateMode.HasFlag(UpdateMode.DiffIndividualsOnly))
- userInputDat.DiffIndividuals(inputPaths, OutputDir);
+ {
+ // Get all of the output DatFiles
+ List datFiles = userInputDat.DiffIndividuals(inputPaths);
+
+ // Loop through and output the new DatFiles
+ InternalStopwatch watch = new InternalStopwatch("Outputting all individual DATs");
+
+ Parallel.For(0, inputPaths.Count, Globals.ParallelOptions, j =>
+ {
+ string path = inputPaths[j].GetOutputPath(OutputDir, GetBoolean(features, InplaceValue));
+
+ // Try to output the file
+ datFiles[j].Write(path, overwrite: GetBoolean(features, InplaceValue));
+ });
+
+ watch.Stop();
+ }
// Output cascaded diffs
if (updateMode.HasFlag(UpdateMode.DiffCascade))