Make it an against flag instead

This commit is contained in:
Matt Nadareski
2020-08-01 15:10:41 -07:00
parent 7f150a3536
commit 002e55e86e
5 changed files with 29 additions and 37 deletions

View File

@@ -263,6 +263,7 @@ namespace SabreTools.Library.DatFiles
/// <param name="filter">Filter object to be passed to the DatItem level</param>
/// <param name="updateFields">List of Fields representing what should be updated [only for base replacement]</param>
/// <param name="onlySame">True if descriptions should only be replaced if the game name is the same, false otherwise [only for base replacement]</param>
/// <param name="byGame">True if diffing is by Game, false if diffing is by hash [only for against]</param>
public void DetermineUpdateType(
List<string> inputPaths,
List<string> basePaths,
@@ -272,7 +273,8 @@ namespace SabreTools.Library.DatFiles
bool skip,
Filter filter,
List<Field> updateFields,
bool onlySame)
bool onlySame,
bool byGame)
{
// Ensure we only have files in the inputs
List<ParentablePath> inputFileNames = DirectoryExtensions.GetFilesOnly(inputPaths, appendparent: true);
@@ -319,12 +321,11 @@ namespace SabreTools.Library.DatFiles
}
// If we have a diff against mode
else if (updateMode.HasFlag(UpdateMode.DiffAgainst)
|| updateMode.HasFlag(UpdateMode.DiffGame))
else if (updateMode.HasFlag(UpdateMode.DiffAgainst))
{
// Populate the combined data
PopulateUserData(baseFileNames, filter);
DiffAgainst(inputFileNames, outDir, inplace, filter, updateMode.HasFlag(UpdateMode.DiffGame));
DiffAgainst(inputFileNames, outDir, inplace, filter, byGame);
}
// If we have one of the base replacement modes

View File

@@ -257,12 +257,11 @@ namespace SabreTools.Library.Data
// Base diffs
DiffAgainst = 1 << 5,
DiffGame = 1 << 6,
// Special update modes
Merge = 1 << 7,
BaseReplace = 1 << 8,
ReverseBaseReplace = 1 << 9,
Merge = 1 << 6,
BaseReplace = 1 << 7,
ReverseBaseReplace = 1 << 8,
// Combinations
AllDiffs = DiffDupesOnly | DiffNoDupesOnly | DiffIndividualsOnly,

View File

@@ -1205,15 +1205,10 @@ Options:
Add a DAT or folder of DATs to the base set to be used for all
operations. Multiple instances of this flag are allowed.
-dga, --diff-game Diff all inputs by game against a set of base DATs
This flag will enable a special type of diffing in which a set of base
DATs are used as a comparison point for each of the input DATs by game.
This allows users to get a slightly different output to cascaded
diffing, which may be more useful in some cases.
-bd=, --base-dat= Add a base DAT for processing
Add a DAT or folder of DATs to the base set to be used for all
operations. Multiple instances of this flag are allowed.
-bg, --by-game Diff against by game instead of hashes
By default, diffing against uses hashes to determine similar files.
This flag enables using using each game as a comparision point
instead.
-br, --base-replace Replace from base DATs in order
By default, no item names are changed except when there is a merge

View File

@@ -98,6 +98,20 @@ namespace SabreTools.Features
}
}
internal const string ByGameValue = "by-game";
internal static Feature ByGameFlag
{
get
{
return new Feature(
BaseReplaceValue,
new List<string>() { "-bg", "--by-game" },
"Diff against by game instead of hashes",
FeatureType.Flag,
longDescription: "By default, diffing against uses hashes to determine similar files. This flag enables using using each game as a comparision point instead.");
}
}
internal const string ChdsAsFilesValue = "chds-as-files";
internal static Feature ChdsAsFilesFlag
{
@@ -336,20 +350,6 @@ namespace SabreTools.Features
}
}
internal const string DiffGameValue = "diff-game";
internal static Feature DiffGameFlag
{
get
{
return new Feature(
DiffAgainstValue,
new List<string>() { "-dga", "--diff-game" },
"Diff all inputs by game against a set of base DATs",
FeatureType.Flag,
"This flag will enable a special type of diffing in which a set of base DATs are used as a comparison point for each of the input DATs by game. This allows users to get a slightly different output to cascaded diffing, which may be more useful in some cases.");
}
}
internal const string DiffIndividualsValue = "diff-individuals";
internal static Feature DiffIndividualsFlag
{
@@ -2503,9 +2503,6 @@ Some special strings that can be used:
if (GetBoolean(features, DiffDuplicatesValue))
updateMode |= UpdateMode.DiffDupesOnly;
if (GetBoolean(features, DiffGameValue))
updateMode |= UpdateMode.DiffGame;
if (GetBoolean(features, DiffIndividualsValue))
updateMode |= UpdateMode.DiffIndividualsOnly;

View File

@@ -56,8 +56,7 @@ namespace SabreTools.Features
this[DiffNoDuplicatesFlag].AddFeature(NoAutomaticDateFlag);
AddFeature(DiffAgainstFlag);
this[DiffAgainstFlag].AddFeature(BaseDatListInput);
AddFeature(DiffGameFlag);
this[DiffGameFlag].AddFeature(BaseDatListInput);
this[DiffAgainstFlag].AddFeature(ByGameFlag);
AddFeature(BaseReplaceFlag);
this[BaseReplaceFlag].AddFeature(BaseDatListInput);
this[BaseReplaceFlag].AddFeature(UpdateFieldListInput);
@@ -155,7 +154,8 @@ namespace SabreTools.Features
GetBoolean(features, SkipFirstOutputValue),
Filter,
updateFields,
GetBoolean(features, OnlySameValue));
GetBoolean(features, OnlySameValue),
GetBoolean(Features, ByGameValue));
}
}
}