mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Make it an against flag instead
This commit is contained in:
@@ -263,6 +263,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
/// <param name="filter">Filter object to be passed to the DatItem level</param>
|
/// <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="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="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(
|
public void DetermineUpdateType(
|
||||||
List<string> inputPaths,
|
List<string> inputPaths,
|
||||||
List<string> basePaths,
|
List<string> basePaths,
|
||||||
@@ -272,7 +273,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
bool skip,
|
bool skip,
|
||||||
Filter filter,
|
Filter filter,
|
||||||
List<Field> updateFields,
|
List<Field> updateFields,
|
||||||
bool onlySame)
|
bool onlySame,
|
||||||
|
bool byGame)
|
||||||
{
|
{
|
||||||
// Ensure we only have files in the inputs
|
// Ensure we only have files in the inputs
|
||||||
List<ParentablePath> inputFileNames = DirectoryExtensions.GetFilesOnly(inputPaths, appendparent: true);
|
List<ParentablePath> inputFileNames = DirectoryExtensions.GetFilesOnly(inputPaths, appendparent: true);
|
||||||
@@ -319,12 +321,11 @@ namespace SabreTools.Library.DatFiles
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If we have a diff against mode
|
// If we have a diff against mode
|
||||||
else if (updateMode.HasFlag(UpdateMode.DiffAgainst)
|
else if (updateMode.HasFlag(UpdateMode.DiffAgainst))
|
||||||
|| updateMode.HasFlag(UpdateMode.DiffGame))
|
|
||||||
{
|
{
|
||||||
// Populate the combined data
|
// Populate the combined data
|
||||||
PopulateUserData(baseFileNames, filter);
|
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
|
// If we have one of the base replacement modes
|
||||||
|
|||||||
@@ -257,12 +257,11 @@ namespace SabreTools.Library.Data
|
|||||||
|
|
||||||
// Base diffs
|
// Base diffs
|
||||||
DiffAgainst = 1 << 5,
|
DiffAgainst = 1 << 5,
|
||||||
DiffGame = 1 << 6,
|
|
||||||
|
|
||||||
// Special update modes
|
// Special update modes
|
||||||
Merge = 1 << 7,
|
Merge = 1 << 6,
|
||||||
BaseReplace = 1 << 8,
|
BaseReplace = 1 << 7,
|
||||||
ReverseBaseReplace = 1 << 9,
|
ReverseBaseReplace = 1 << 8,
|
||||||
|
|
||||||
// Combinations
|
// Combinations
|
||||||
AllDiffs = DiffDupesOnly | DiffNoDupesOnly | DiffIndividualsOnly,
|
AllDiffs = DiffDupesOnly | DiffNoDupesOnly | DiffIndividualsOnly,
|
||||||
|
|||||||
@@ -1205,15 +1205,10 @@ Options:
|
|||||||
Add a DAT or folder of DATs to the base set to be used for all
|
Add a DAT or folder of DATs to the base set to be used for all
|
||||||
operations. Multiple instances of this flag are allowed.
|
operations. Multiple instances of this flag are allowed.
|
||||||
|
|
||||||
-dga, --diff-game Diff all inputs by game against a set of base DATs
|
-bg, --by-game Diff against by game instead of hashes
|
||||||
This flag will enable a special type of diffing in which a set of base
|
By default, diffing against uses hashes to determine similar files.
|
||||||
DATs are used as a comparison point for each of the input DATs by game.
|
This flag enables using using each game as a comparision point
|
||||||
This allows users to get a slightly different output to cascaded
|
instead.
|
||||||
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.
|
|
||||||
|
|
||||||
-br, --base-replace Replace from base DATs in order
|
-br, --base-replace Replace from base DATs in order
|
||||||
By default, no item names are changed except when there is a merge
|
By default, no item names are changed except when there is a merge
|
||||||
|
|||||||
@@ -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 const string ChdsAsFilesValue = "chds-as-files";
|
||||||
internal static Feature ChdsAsFilesFlag
|
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 const string DiffIndividualsValue = "diff-individuals";
|
||||||
internal static Feature DiffIndividualsFlag
|
internal static Feature DiffIndividualsFlag
|
||||||
{
|
{
|
||||||
@@ -2503,9 +2503,6 @@ Some special strings that can be used:
|
|||||||
if (GetBoolean(features, DiffDuplicatesValue))
|
if (GetBoolean(features, DiffDuplicatesValue))
|
||||||
updateMode |= UpdateMode.DiffDupesOnly;
|
updateMode |= UpdateMode.DiffDupesOnly;
|
||||||
|
|
||||||
if (GetBoolean(features, DiffGameValue))
|
|
||||||
updateMode |= UpdateMode.DiffGame;
|
|
||||||
|
|
||||||
if (GetBoolean(features, DiffIndividualsValue))
|
if (GetBoolean(features, DiffIndividualsValue))
|
||||||
updateMode |= UpdateMode.DiffIndividualsOnly;
|
updateMode |= UpdateMode.DiffIndividualsOnly;
|
||||||
|
|
||||||
|
|||||||
@@ -56,8 +56,7 @@ namespace SabreTools.Features
|
|||||||
this[DiffNoDuplicatesFlag].AddFeature(NoAutomaticDateFlag);
|
this[DiffNoDuplicatesFlag].AddFeature(NoAutomaticDateFlag);
|
||||||
AddFeature(DiffAgainstFlag);
|
AddFeature(DiffAgainstFlag);
|
||||||
this[DiffAgainstFlag].AddFeature(BaseDatListInput);
|
this[DiffAgainstFlag].AddFeature(BaseDatListInput);
|
||||||
AddFeature(DiffGameFlag);
|
this[DiffAgainstFlag].AddFeature(ByGameFlag);
|
||||||
this[DiffGameFlag].AddFeature(BaseDatListInput);
|
|
||||||
AddFeature(BaseReplaceFlag);
|
AddFeature(BaseReplaceFlag);
|
||||||
this[BaseReplaceFlag].AddFeature(BaseDatListInput);
|
this[BaseReplaceFlag].AddFeature(BaseDatListInput);
|
||||||
this[BaseReplaceFlag].AddFeature(UpdateFieldListInput);
|
this[BaseReplaceFlag].AddFeature(UpdateFieldListInput);
|
||||||
@@ -155,7 +154,8 @@ namespace SabreTools.Features
|
|||||||
GetBoolean(features, SkipFirstOutputValue),
|
GetBoolean(features, SkipFirstOutputValue),
|
||||||
Filter,
|
Filter,
|
||||||
updateFields,
|
updateFields,
|
||||||
GetBoolean(features, OnlySameValue));
|
GetBoolean(features, OnlySameValue),
|
||||||
|
GetBoolean(Features, ByGameValue));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user