Wire up new flag

This commit is contained in:
Matt Nadareski
2020-08-21 10:38:42 -07:00
parent 2ffa22ebaa
commit ebb6529440
10 changed files with 204 additions and 20 deletions

View File

@@ -67,8 +67,8 @@ in -old DAT file. Ignores those entries in -old that are not in -new.";
List<string> basedats = new List<string> { olddat }; List<string> basedats = new List<string> { olddat };
// Now run the diff on the inputs // Now run the diff on the inputs
datfile.PopulateUserData(basedats, new Filter()); datfile.PopulateUserData(basedats, new ExtraIni(), new Filter());
datfile.DiffAgainst(dats, outdat, false, new Filter(), false); datfile.DiffAgainst(dats, outdat, false, new ExtraIni(), new Filter(), false);
} }
} }
} }

View File

@@ -60,8 +60,8 @@ namespace RombaSharp.Features
List<string> basedats = new List<string> { olddat }; List<string> basedats = new List<string> { olddat };
// Now run the diff on the inputs // Now run the diff on the inputs
datfile.PopulateUserData(basedats, new Filter()); datfile.PopulateUserData(basedats, new ExtraIni(), new Filter());
datfile.DiffAgainst(dats, outdat, false, new Filter(), false); datfile.DiffAgainst(dats, outdat, false, new ExtraIni(), new Filter(), false);
} }
} }
} }

View File

@@ -200,6 +200,7 @@ namespace SabreTools.Library.DatFiles
/// <param name="inputs">Names of the input files</param> /// <param name="inputs">Names of the input files</param>
/// <param name="outDir">Optional param for output directory</param> /// <param name="outDir">Optional param for output directory</param>
/// <param name="inplace">True if the output 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="extras">ExtraIni object to apply to the DatFile</param>
/// <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</param> /// <param name="onlySame">True if descriptions should only be replaced if the game name is the same, false otherwise</param>
@@ -207,12 +208,13 @@ namespace SabreTools.Library.DatFiles
List<string> inputs, List<string> inputs,
string outDir, string outDir,
bool inplace, bool inplace,
ExtraIni extras,
Filter filter, Filter filter,
List<Field> updateFields, List<Field> updateFields,
bool onlySame) bool onlySame)
{ {
List<ParentablePath> paths = inputs.Select(i => new ParentablePath(i)).ToList(); List<ParentablePath> paths = inputs.Select(i => new ParentablePath(i)).ToList();
BaseReplace(paths, outDir, inplace, filter, updateFields, onlySame); BaseReplace(paths, outDir, inplace, extras, filter, updateFields, onlySame);
} }
/// <summary> /// <summary>
@@ -221,6 +223,7 @@ namespace SabreTools.Library.DatFiles
/// <param name="inputs">Names of the input files</param> /// <param name="inputs">Names of the input files</param>
/// <param name="outDir">Optional param for output directory</param> /// <param name="outDir">Optional param for output directory</param>
/// <param name="inplace">True if the output 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="extras">ExtraIni object to apply to the DatFile</param>
/// <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</param> /// <param name="onlySame">True if descriptions should only be replaced if the game name is the same, false otherwise</param>
@@ -228,6 +231,7 @@ namespace SabreTools.Library.DatFiles
List<ParentablePath> inputs, List<ParentablePath> inputs,
string outDir, string outDir,
bool inplace, bool inplace,
ExtraIni extras,
Filter filter, Filter filter,
List<Field> updateFields, List<Field> updateFields,
bool onlySame) bool onlySame)
@@ -240,6 +244,7 @@ namespace SabreTools.Library.DatFiles
// First we parse in the DAT internally // First we parse in the DAT internally
DatFile intDat = Create(Header.CloneFiltering()); DatFile intDat = Create(Header.CloneFiltering());
intDat.Parse(path, 1, keep: true); intDat.Parse(path, 1, keep: true);
intDat.ApplyExtras(extras);
intDat.ApplyFilter(filter, false /* useTags */); intDat.ApplyFilter(filter, false /* useTags */);
// If we are matching based on DatItem fields of any sort // If we are matching based on DatItem fields of any sort
@@ -316,12 +321,19 @@ namespace SabreTools.Library.DatFiles
/// <param name="inputs">Names of the input files</param> /// <param name="inputs">Names of the input files</param>
/// <param name="outDir">Optional param for output directory</param> /// <param name="outDir">Optional param for output directory</param>
/// <param name="inplace">True if the output 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="extras">ExtraIni object to apply to the DatFile</param>
/// <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="useGames">True to diff using games, false to use hashes</param> /// <param name="useGames">True to diff using games, false to use hashes</param>
public void DiffAgainst(List<string> inputs, string outDir, bool inplace, Filter filter, bool useGames) public void DiffAgainst(
List<string> inputs,
string outDir,
bool inplace,
ExtraIni extras,
Filter filter,
bool useGames)
{ {
List<ParentablePath> paths = inputs.Select(i => new ParentablePath(i)).ToList(); List<ParentablePath> paths = inputs.Select(i => new ParentablePath(i)).ToList();
DiffAgainst(paths, outDir, inplace, filter, useGames); DiffAgainst(paths, outDir, inplace, extras, filter, useGames);
} }
/// <summary> /// <summary>
@@ -330,9 +342,16 @@ namespace SabreTools.Library.DatFiles
/// <param name="inputs">Names of the input files</param> /// <param name="inputs">Names of the input files</param>
/// <param name="outDir">Optional param for output directory</param> /// <param name="outDir">Optional param for output directory</param>
/// <param name="inplace">True if the output 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="extras">ExtraIni object to apply to the DatFile</param>
/// <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="useGames">True to diff using games, false to use hashes</param> /// <param name="useGames">True to diff using games, false to use hashes</param>
public void DiffAgainst(List<ParentablePath> inputs, string outDir, bool inplace, Filter filter, bool useGames) public void DiffAgainst(
List<ParentablePath> inputs,
string outDir,
bool inplace,
ExtraIni extras,
Filter filter,
bool useGames)
{ {
// For comparison's sake, we want to use a base ordering // For comparison's sake, we want to use a base ordering
if (useGames) if (useGames)
@@ -348,6 +367,7 @@ namespace SabreTools.Library.DatFiles
// First we parse in the DAT internally // First we parse in the DAT internally
DatFile intDat = Create(Header.CloneFiltering()); DatFile intDat = Create(Header.CloneFiltering());
intDat.Parse(path, 1, keep: true); intDat.Parse(path, 1, keep: true);
intDat.ApplyExtras(extras);
intDat.ApplyFilter(filter, false /* useTags */); intDat.ApplyFilter(filter, false /* useTags */);
// For comparison's sake, we want to a the base bucketing // For comparison's sake, we want to a the base bucketing
@@ -803,21 +823,23 @@ namespace SabreTools.Library.DatFiles
/// Populate the user DatData object from the input files /// Populate the user DatData object from the input files
/// </summary> /// </summary>
/// <param name="inputs">Paths to DATs to parse</param> /// <param name="inputs">Paths to DATs to parse</param>
/// <param name="extras">ExtraIni object to apply to the DatFile</param>
/// <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>
/// <returns>List of DatData objects representing headers</returns> /// <returns>List of DatData objects representing headers</returns>
public List<DatHeader> PopulateUserData(List<string> inputs, Filter filter) public List<DatHeader> PopulateUserData(List<string> inputs, ExtraIni extras, Filter filter)
{ {
List<ParentablePath> paths = inputs.Select(i => new ParentablePath(i)).ToList(); List<ParentablePath> paths = inputs.Select(i => new ParentablePath(i)).ToList();
return PopulateUserData(paths, filter); return PopulateUserData(paths, extras, filter);
} }
/// <summary> /// <summary>
/// Populate the user DatData object from the input files /// Populate the user DatData object from the input files
/// </summary> /// </summary>
/// <param name="inputs">Paths to DATs to parse</param> /// <param name="inputs">Paths to DATs to parse</param>
/// <param name="extras">ExtraIni object to apply to the DatFile</param>
/// <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>
/// <returns>List of DatData objects representing headers</returns> /// <returns>List of DatData objects representing headers</returns>
public List<DatHeader> PopulateUserData(List<ParentablePath> inputs, Filter filter) public List<DatHeader> PopulateUserData(List<ParentablePath> inputs, ExtraIni extras, Filter filter)
{ {
DatFile[] datFiles = new DatFile[inputs.Count]; DatFile[] datFiles = new DatFile[inputs.Count];
InternalStopwatch watch = new InternalStopwatch("Processing individual DATs"); InternalStopwatch watch = new InternalStopwatch("Processing individual DATs");
@@ -839,7 +861,8 @@ namespace SabreTools.Library.DatFiles
AddFromExisting(datFiles[i], true); AddFromExisting(datFiles[i], true);
} }
// Now that we have a merged DAT, filter it // Now that we have a merged DAT, apply extras and filter it
ApplyExtras(extras);
ApplyFilter(filter, false /* useTags */); ApplyFilter(filter, false /* useTags */);
watch.Stop(); watch.Stop();
@@ -853,11 +876,17 @@ namespace SabreTools.Library.DatFiles
/// <param name="inputs">Names of the input files and/or folders</param> /// <param name="inputs">Names of the input files and/or folders</param>
/// <param name="outDir">Optional param for output directory</param> /// <param name="outDir">Optional param for output directory</param>
/// <param name="inplace">True if the output 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="extras">ExtraIni object to apply to the DatFile</param>
/// <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>
public void Update(List<string> inputs, string outDir, bool inplace, Filter filter) public void Update(
List<string> inputs,
string outDir,
bool inplace,
ExtraIni extras,
Filter filter)
{ {
List<ParentablePath> paths = inputs.Select(i => new ParentablePath(i)).ToList(); List<ParentablePath> paths = inputs.Select(i => new ParentablePath(i)).ToList();
Update(paths, outDir, inplace, filter); Update(paths, outDir, inplace, extras, filter);
} }
/// <summary> /// <summary>
@@ -866,8 +895,14 @@ namespace SabreTools.Library.DatFiles
/// <param name="inputs">Names of the input files and/or folders</param> /// <param name="inputs">Names of the input files and/or folders</param>
/// <param name="outDir">Optional param for output directory</param> /// <param name="outDir">Optional param for output directory</param>
/// <param name="inplace">True if the output 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="extras">ExtraIni object to apply to the DatFile</param>
/// <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>
public void Update(List<ParentablePath> inputs, string outDir, bool inplace, Filter filter) public void Update(
List<ParentablePath> inputs,
string outDir,
bool inplace,
ExtraIni extras,
Filter filter)
{ {
// Iterate over the files // Iterate over the files
foreach (ParentablePath file in inputs) foreach (ParentablePath file in inputs)
@@ -878,6 +913,7 @@ namespace SabreTools.Library.DatFiles
keepext: innerDatdata.Header.DatFormat.HasFlag(DatFormat.TSV) keepext: innerDatdata.Header.DatFormat.HasFlag(DatFormat.TSV)
|| innerDatdata.Header.DatFormat.HasFlag(DatFormat.CSV) || innerDatdata.Header.DatFormat.HasFlag(DatFormat.CSV)
|| innerDatdata.Header.DatFormat.HasFlag(DatFormat.SSV)); || innerDatdata.Header.DatFormat.HasFlag(DatFormat.SSV));
innerDatdata.ApplyExtras(extras);
innerDatdata.ApplyFilter(filter, false /* useTags */); innerDatdata.ApplyFilter(filter, false /* useTags */);
// Get the correct output path // Get the correct output path
@@ -892,6 +928,69 @@ namespace SabreTools.Library.DatFiles
#region Filtering #region Filtering
/// <summary>
/// Apply a set of Extra INIs on the DatFile
/// </summary>
/// <param name="extras">ExtrasIni to use</param>
/// <returns>True if the extras were applied, false on error</returns>
public bool ApplyExtras(ExtraIni extras)
{
try
{
// Bucket by game first
Items.BucketBy(BucketedBy.Game, DedupeType.None);
// Create a new set of mappings based on the items
var map = new Dictionary<string, Dictionary<Field, string>>();
// Loop through each of the extras
foreach (ExtraIniItem item in extras.Items)
{
foreach (var mapping in item.Mappings)
{
string key = mapping.Key;
List<string> machineNames = mapping.Value;
// If we have the root folder, assume boolean
if (string.Equals(key, "ROOT_FOLDER"))
key = "true";
// Loop through the machines and add the new mappings
foreach (string machine in machineNames)
{
if (!map.ContainsKey(machine))
map[machine] = new Dictionary<Field, string>();
map[machine][item.Field] = key;
}
}
}
// Now apply the new set of mappings
foreach (string key in map.Keys)
{
// If the key doesn't exist, continue
if (!Items.ContainsKey(key))
continue;
List<DatItem> datItems = Items[key];
var mappings = map[key];
foreach (var datItem in datItems)
{
datItem.SetFields(mappings);
}
}
}
catch (Exception ex)
{
Globals.Logger.Error(ex.ToString());
return false;
}
return true;
}
/// <summary> /// <summary>
/// Apply a Filter on the DatFile /// Apply a Filter on the DatFile
/// </summary> /// </summary>
@@ -2005,6 +2104,7 @@ namespace SabreTools.Library.DatFiles
/// <param name="addDate">True if dates should be archived for all files, false otherwise</param> /// <param name="addDate">True if dates should be archived for all files, false otherwise</param>
/// <param name="outDir">Output directory to </param> /// <param name="outDir">Output directory to </param>
/// <param name="copyFiles">True if files should be copied to the temp directory before hashing, false otherwise</param> /// <param name="copyFiles">True if files should be copied to the temp directory before hashing, false otherwise</param>
/// <param name="extras">ExtraIni object to apply to the DatFile</param>
/// <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="useTags">True if DatFile tags override splitting, false otherwise</param> /// <param name="useTags">True if DatFile tags override splitting, false otherwise</param>
/// TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually /// TODO: All instances of Hash.DeepHashes should be made into 0x0 eventually
@@ -2017,6 +2117,7 @@ namespace SabreTools.Library.DatFiles
bool addBlanks = false, bool addBlanks = false,
bool addDate = false, bool addDate = false,
bool copyFiles = false, bool copyFiles = false,
ExtraIni extras = null,
Filter filter = null, Filter filter = null,
bool useTags = false) bool useTags = false)
{ {
@@ -2102,6 +2203,10 @@ namespace SabreTools.Library.DatFiles
if (Globals.TempDir != Path.GetTempPath()) if (Globals.TempDir != Path.GetTempPath())
DirectoryExtensions.TryDelete(Globals.TempDir); DirectoryExtensions.TryDelete(Globals.TempDir);
// If we have valid extras, perform the application now
if (extras != null && extras != default(ExtraIni))
ApplyExtras(extras);
// If we have a valid filter, perform the filtering now // If we have a valid filter, perform the filtering now
if (filter != null && filter != default(Filter)) if (filter != null && filter != default(Filter))
ApplyFilter(filter, useTags); ApplyFilter(filter, useTags);
@@ -3092,6 +3197,7 @@ namespace SabreTools.Library.DatFiles
/// <param name="hashOnly">True if only hashes should be checked, false for full file information</param> /// <param name="hashOnly">True if only hashes should be checked, false for full file information</param>
/// <param name="quickScan">True to enable external scanning of archives, false otherwise</param> /// <param name="quickScan">True to enable external scanning of archives, false otherwise</param>
/// <param name="asFiles">TreatAsFiles representing CHD and Archive scanning</param> /// <param name="asFiles">TreatAsFiles representing CHD and Archive scanning</param>
/// <param name="extras">ExtraIni object to apply to the DatFile</param>
/// <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>
/// <returns>True if verification was a success, false otherwise</returns> /// <returns>True if verification was a success, false otherwise</returns>
public bool VerifyGeneric( public bool VerifyGeneric(
@@ -3100,6 +3206,7 @@ namespace SabreTools.Library.DatFiles
bool hashOnly = false, bool hashOnly = false,
bool quickScan = false, bool quickScan = false,
TreatAsFiles asFiles = 0x00, TreatAsFiles asFiles = 0x00,
ExtraIni extras = null,
Filter filter = null) Filter filter = null)
{ {
// TODO: We want the cross section of what's the folder and what's in the DAT. Right now, it just has what's in the DAT that's not in the folder // TODO: We want the cross section of what's the folder and what's in the DAT. Right now, it just has what's in the DAT that's not in the folder
@@ -3115,6 +3222,7 @@ namespace SabreTools.Library.DatFiles
quickScan ? Hash.SecureHashes : Hash.DeepHashes, quickScan ? Hash.SecureHashes : Hash.DeepHashes,
bare: true, bare: true,
asFiles: asFiles, asFiles: asFiles,
extras: extras,
filter: filter); filter: filter);
} }

View File

@@ -44,7 +44,7 @@ namespace SabreTools.Library.DatFiles
if (ir == null) if (ir == null)
return; return;
// Otherwise, read teh file to the end // Otherwise, read the file to the end
try try
{ {
ir.ReadNextLine(); ir.ReadNextLine();

View File

@@ -4,9 +4,31 @@ namespace SabreTools.Library.Filtering
{ {
public class ExtraIni public class ExtraIni
{ {
#region Fields
/// <summary> /// <summary>
/// List of extras to apply /// List of extras to apply
/// </summary> /// </summary>
public List<ExtraIniItem> Items { get; set; } = new List<ExtraIniItem>(); public List<ExtraIniItem> Items { get; set; } = new List<ExtraIniItem>();
#endregion
#region Extras Population
/// <summary>
/// Populate item using field:file inputs
/// </summary>
/// <param name="inputs">Field and file combinations</param>
public void PopulateFromList(List<string> inputs)
{
foreach (string input in inputs)
{
ExtraIniItem item = new ExtraIniItem();
item.PopulateFromInput(input);
Items.Add(item);
}
}
#endregion
} }
} }

View File

@@ -360,6 +360,11 @@ Options:
compare against the input DATs. This flag forces all CHDs to be compare against the input DATs. This flag forces all CHDs to be
treated like regular files. treated like regular files.
-ini=, --extra-ini= Apply a MAME INI for given field(s)
Apply any valid MAME INI for any valid field in the DatFile. Inputs are
of the form 'Field:path\to\ini'. Multiple instances of this flag are
allowed.
-fi=, --filter= Filter a game/rom field with the given value(s) -fi=, --filter= Filter a game/rom field with the given value(s)
Filter any valid item or machine field from inputs. Filters are input Filter any valid item or machine field from inputs. Filters are input
in the form 'key:value' or '!key:value', where the '!' signifies 'not' in the form 'key:value' or '!key:value', where the '!' signifies 'not'
@@ -1312,6 +1317,11 @@ Options:
second time, this will skip writing it. This can often speed up second time, this will skip writing it. This can often speed up
the output process. [Both diff-cascade and diff-reverse-cascade] the output process. [Both diff-cascade and diff-reverse-cascade]
-ini=, --extra-ini= Apply a MAME INI for given field(s)
Apply any valid MAME INI for any valid field in the DatFile. Inputs are
of the form 'Field:path\to\ini'. Multiple instances of this flag are
allowed.
-fi=, --filter= Filter a game/rom field with the given value(s) -fi=, --filter= Filter a game/rom field with the given value(s)
Filter any valid item or machine field from inputs. Filters are input Filter any valid item or machine field from inputs. Filters are input
in the form 'key:value' or '!key:value', where the '!' signifies 'not' in the form 'key:value' or '!key:value', where the '!' signifies 'not'
@@ -1597,6 +1607,11 @@ Options:
parent sets based on the cloneof and romof tags as well as device parent sets based on the cloneof and romof tags as well as device
references. This is incompatible with the other --dat-X flags. references. This is incompatible with the other --dat-X flags.
-ini=, --extra-ini= Apply a MAME INI for given field(s)
Apply any valid MAME INI for any valid field in the DatFile. Inputs are
of the form 'Field:path\to\ini'. Multiple instances of this flag are
allowed.
-fi=, --filter= Filter a game/rom field with the given value(s) -fi=, --filter= Filter a game/rom field with the given value(s)
Filter any valid item or machine field from inputs. Filters are input Filter any valid item or machine field from inputs. Filters are input
in the form 'key:value' or '!key:value', where the '!' signifies 'not' in the form 'key:value' or '!key:value', where the '!' signifies 'not'

View File

@@ -1382,6 +1382,20 @@ namespace SabreTools.Features
} }
} }
internal const string ExtraIniListValue = "extra-ini";
internal static Feature ExtraIniListInput
{
get
{
return new Feature(
ExtraIniListValue,
new List<string>() { "-ini", "--extra-ini" },
"Apply a MAME INI for given field(s)",
FeatureType.List,
longDescription: "Apply any valid MAME INI for any valid field in the DatFile. Inputs are of the form 'Field:path\\to\\ini'. Multiple instances of this flag are allowed.");
}
}
internal const string FilterListValue = "filter"; internal const string FilterListValue = "filter";
internal static Feature FilterListInput internal static Feature FilterListInput
{ {
@@ -2274,6 +2288,11 @@ Some special strings that can be used:
#region Fields #region Fields
/// <summary>
/// Preconfigured ExtraIni set
/// </summary>
protected ExtraIni Extras { get; set; }
/// <summary> /// <summary>
/// Pre-configured Filter /// Pre-configured Filter
/// </summary> /// </summary>
@@ -2386,6 +2405,7 @@ Some special strings that can be used:
public override void ProcessFeatures(Dictionary<string, Feature> features) public override void ProcessFeatures(Dictionary<string, Feature> features)
{ {
// Generic feature flags // Generic feature flags
Extras = GetExtras(features);
Filter = GetFilter(features); Filter = GetFilter(features);
Header = GetDatHeader(features); Header = GetDatHeader(features);
OutputDir = GetString(features, OutputDirStringValue); OutputDir = GetString(features, OutputDirStringValue);
@@ -2709,6 +2729,16 @@ Some special strings that can be used:
return DedupeType.None; return DedupeType.None;
} }
/// <summary>
/// Get ExtraIni from feature list
/// </summary>
private ExtraIni GetExtras(Dictionary<string, Feature> features)
{
ExtraIni extraIni = new ExtraIni();
extraIni.PopulateFromList(GetList(features, ExtraIniListValue));
return extraIni;
}
/// <summary> /// <summary>
/// Get Filter from feature list /// Get Filter from feature list
/// </summary> /// </summary>

View File

@@ -44,6 +44,7 @@ namespace SabreTools.Features
AddFeature(CopyFilesFlag); AddFeature(CopyFilesFlag);
AddFeature(HeaderStringInput); AddFeature(HeaderStringInput);
AddFeature(ChdsAsFilesFlag); AddFeature(ChdsAsFilesFlag);
AddFeature(ExtraIniListInput);
AddFilteringFeatures(); AddFilteringFeatures();
AddFeature(TempStringInput); AddFeature(TempStringInput);
AddFeature(OutputDirStringInput); AddFeature(OutputDirStringInput);
@@ -85,6 +86,7 @@ namespace SabreTools.Features
addBlankFiles, addBlankFiles,
addFileDates, addFileDates,
copyFiles, copyFiles,
Extras,
Filter); Filter);
if (success) if (success)

View File

@@ -87,6 +87,7 @@ namespace SabreTools.Features
this[DiffCascadeFlag].AddFeature(SkipFirstOutputFlag); this[DiffCascadeFlag].AddFeature(SkipFirstOutputFlag);
AddFeature(DiffReverseCascadeFlag); AddFeature(DiffReverseCascadeFlag);
this[DiffReverseCascadeFlag].AddFeature(SkipFirstOutputFlag); this[DiffReverseCascadeFlag].AddFeature(SkipFirstOutputFlag);
AddFeature(ExtraIniListInput);
AddFilteringFeatures(); AddFilteringFeatures();
AddFeature(OutputDirStringInput); AddFeature(OutputDirStringInput);
AddFeature(InplaceFlag); AddFeature(InplaceFlag);
@@ -156,6 +157,7 @@ namespace SabreTools.Features
inputFileNames, inputFileNames,
OutputDir, OutputDir,
GetBoolean(features, InplaceValue), GetBoolean(features, InplaceValue),
Extras,
Filter); Filter);
return; return;
} }
@@ -178,9 +180,9 @@ namespace SabreTools.Features
// Populate using the correct set // Populate using the correct set
List<DatHeader> datHeaders; List<DatHeader> datHeaders;
if (updateMode.HasFlag(UpdateMode.DiffAgainst) || updateMode.HasFlag(UpdateMode.BaseReplace)) if (updateMode.HasFlag(UpdateMode.DiffAgainst) || updateMode.HasFlag(UpdateMode.BaseReplace))
datHeaders = userInputDat.PopulateUserData(baseFileNames, Filter); datHeaders = userInputDat.PopulateUserData(baseFileNames, Extras, Filter);
else else
datHeaders = userInputDat.PopulateUserData(inputFileNames, Filter); datHeaders = userInputDat.PopulateUserData(inputFileNames, Extras, Filter);
// Output only DatItems that are duplicated across inputs // Output only DatItems that are duplicated across inputs
if (updateMode.HasFlag(UpdateMode.DiffDupesOnly)) if (updateMode.HasFlag(UpdateMode.DiffDupesOnly))
@@ -212,6 +214,7 @@ namespace SabreTools.Features
inputFileNames, inputFileNames,
OutputDir, OutputDir,
GetBoolean(features, InplaceValue), GetBoolean(features, InplaceValue),
Extras,
Filter, Filter,
GetBoolean(Features, ByGameValue)); GetBoolean(Features, ByGameValue));
} }
@@ -223,6 +226,7 @@ namespace SabreTools.Features
inputFileNames, inputFileNames,
OutputDir, OutputDir,
GetBoolean(features, InplaceValue), GetBoolean(features, InplaceValue),
Extras,
Filter, Filter,
updateFields, updateFields,
GetBoolean(features, OnlySameValue)); GetBoolean(features, OnlySameValue));

View File

@@ -31,6 +31,7 @@ namespace SabreTools.Features
AddFeature(ChdsAsFilesFlag); AddFeature(ChdsAsFilesFlag);
AddFeature(IndividualFlag); AddFeature(IndividualFlag);
AddInternalSplitFeatures(); AddInternalSplitFeatures();
AddFeature(ExtraIniListInput);
AddFilteringFeatures(); AddFilteringFeatures();
} }
@@ -54,6 +55,7 @@ namespace SabreTools.Features
{ {
DatFile datdata = DatFile.Create(); DatFile datdata = DatFile.Create();
datdata.Parse(datfile, 99, keep: true); datdata.Parse(datfile, 99, keep: true);
datdata.ApplyExtras(Extras);
datdata.ApplyFilter(Filter, true); datdata.ApplyFilter(Filter, true);
// Set depot information // Set depot information
@@ -67,7 +69,7 @@ namespace SabreTools.Features
if (Header.InputDepot.IsActive) if (Header.InputDepot.IsActive)
datdata.VerifyDepot(Inputs, OutputDir); datdata.VerifyDepot(Inputs, OutputDir);
else else
datdata.VerifyGeneric(Inputs, OutputDir, hashOnly, quickScan, asFiles, Filter); datdata.VerifyGeneric(Inputs, OutputDir, hashOnly, quickScan, asFiles, Extras, Filter);
} }
} }
// Otherwise, process all DATs into the same output // Otherwise, process all DATs into the same output
@@ -80,6 +82,7 @@ namespace SabreTools.Features
foreach (ParentablePath datfile in datfilePaths) foreach (ParentablePath datfile in datfilePaths)
{ {
datdata.Parse(datfile, 99, keep: true); datdata.Parse(datfile, 99, keep: true);
datdata.ApplyExtras(Extras);
datdata.ApplyFilter(Filter, true); datdata.ApplyFilter(Filter, true);
} }
@@ -96,7 +99,7 @@ namespace SabreTools.Features
if (Header.InputDepot.IsActive) if (Header.InputDepot.IsActive)
datdata.VerifyDepot(Inputs, OutputDir); datdata.VerifyDepot(Inputs, OutputDir);
else else
datdata.VerifyGeneric(Inputs, OutputDir, hashOnly, quickScan, asFiles, Filter); datdata.VerifyGeneric(Inputs, OutputDir, hashOnly, quickScan, asFiles, Extras, Filter);
} }
} }
} }