diff --git a/SabreTools.Library/DatFiles/DatFile.cs b/SabreTools.Library/DatFiles/DatFile.cs index cc21f4ab..7cd514bf 100644 --- a/SabreTools.Library/DatFiles/DatFile.cs +++ b/SabreTools.Library/DatFiles/DatFile.cs @@ -323,7 +323,7 @@ namespace SabreTools.Library.DatFiles { // Populate the combined data PopulateUserData(baseFileNames, filter); - DiffAgainst(inputFileNames, outDir, inplace); + DiffAgainst(inputFileNames, outDir, inplace, filter); } // If we are in game diffing mode @@ -377,10 +377,11 @@ namespace SabreTools.Library.DatFiles /// Names of the input files /// Optional param for output directory /// True if the output files should overwrite their inputs, false otherwise - public void DiffAgainst(List inputs, string outDir, bool inplace) + /// Filter object to be passed to the DatItem level + public void DiffAgainst(List inputs, string outDir, bool inplace, Filter filter) { List paths = inputs.Select(i => new ParentablePath(i)).ToList(); - DiffAgainst(paths, outDir, inplace); + DiffAgainst(paths, outDir, inplace, filter); } /// @@ -966,7 +967,8 @@ namespace SabreTools.Library.DatFiles /// Names of the input files /// Optional param for output directory /// True if the output files should overwrite their inputs, false otherwise - internal void DiffAgainst(List inputs, string outDir, bool inplace) + /// Filter object to be passed to the DatItem level + internal void DiffAgainst(List inputs, string outDir, bool inplace, Filter filter) { // For comparison's sake, we want to use CRC as the base ordering Items.BucketBy(BucketedBy.CRC, DedupeType.Full); @@ -977,8 +979,9 @@ namespace SabreTools.Library.DatFiles Globals.Logger.User($"Comparing '{path.CurrentPath}' to base DAT"); // First we parse in the DAT internally - DatFile intDat = Create(); + DatFile intDat = Create(Header.CloneFiltering()); intDat.Parse(path, 1, keep: true); + filter.FilterDatFile(intDat, false /* useTags */); // For comparison's sake, we want to use CRC as the base bucketing intDat.Items.BucketBy(BucketedBy.CRC, DedupeType.Full); @@ -1269,6 +1272,8 @@ namespace SabreTools.Library.DatFiles DatFile intDat = Create(Header.CloneFiltering()); intDat.Parse(path, 1, keep: true); filter.FilterDatFile(intDat, false /* useTags */); + + // For comparison's sake, we want to use Game as the base bucketing intDat.Items.BucketBy(BucketedBy.Game, DedupeType.None); // TODO: Do we need to include items in base NOT in compare?