mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Remove MachineField enum
This commit is contained in:
@@ -1404,169 +1404,6 @@ namespace SabreTools.Core
|
|||||||
Writable,
|
Writable,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// List of valid field types within a Machine
|
|
||||||
/// </summary>
|
|
||||||
public enum MachineField
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// This is a fake flag that is used for filter only
|
|
||||||
/// </summary>
|
|
||||||
NULL = 0,
|
|
||||||
|
|
||||||
/// <remarks>Used in Logiqx</remarks>
|
|
||||||
[Mapping("board")]
|
|
||||||
Board,
|
|
||||||
|
|
||||||
/// <remarks>Used in AttractMode</remarks>
|
|
||||||
[Mapping("buttons")]
|
|
||||||
Buttons,
|
|
||||||
|
|
||||||
/// <remarks>Used in AttractMode, ClrMamePro, and Logiqx</remarks>
|
|
||||||
[Mapping("category")]
|
|
||||||
Category,
|
|
||||||
|
|
||||||
/// <remarks>Used in AttractMode, ClrMamePro, ListXML, Logiqx, OfflineList, RomCenter, and Software List</remarks>
|
|
||||||
[Mapping("cloneof", "clone_of")]
|
|
||||||
CloneOf,
|
|
||||||
|
|
||||||
/// <remarks>Used in Logiqx</remarks>
|
|
||||||
[Mapping("cloneofid", "nointrocloneofid", "nointro_cloneofid", "no_intro_cloneofid", "no_intro_clone_of_id")]
|
|
||||||
CloneOfID,
|
|
||||||
|
|
||||||
/// <remarks>Used in AttractMode, Logiqx, and OfflineList; "extra" is used with AttractMode</remarks>
|
|
||||||
[Mapping("comment", "extra")]
|
|
||||||
Comment,
|
|
||||||
|
|
||||||
/// <remarks>Used in AttractMode</remarks>
|
|
||||||
[Mapping("control")]
|
|
||||||
Control,
|
|
||||||
|
|
||||||
/// <remarks>Used in OpenMSX</remarks>
|
|
||||||
[Mapping("country")]
|
|
||||||
Country,
|
|
||||||
|
|
||||||
/// <remarks>Used in Logiqx (EmuArc Extension)</remarks>
|
|
||||||
[Mapping("crc", "hascrc", "has_crc")]
|
|
||||||
CRC,
|
|
||||||
|
|
||||||
/// <remarks>Used in ArchiveDotOrg, AttractMode, ClrMamePro, DOSCenter, Everdrive SMDB, ListXML, Logiqx, RomCenter, Separated Value, and Software List</remarks>
|
|
||||||
[Mapping("desc", "description")]
|
|
||||||
Description,
|
|
||||||
|
|
||||||
/// <remarks>Used in Logiqx (EmuArc Extension)</remarks>
|
|
||||||
[Mapping("developer")]
|
|
||||||
Developer,
|
|
||||||
|
|
||||||
/// <remarks>Used in AttractMode</remarks>
|
|
||||||
[Mapping("displaycount", "display_count")]
|
|
||||||
DisplayCount,
|
|
||||||
|
|
||||||
/// <remarks>Used in AttractMode</remarks>
|
|
||||||
[Mapping("displaytype", "display_type")]
|
|
||||||
DisplayType,
|
|
||||||
|
|
||||||
/// <remarks>Used in Logiqx (EmuArc Extension)</remarks>
|
|
||||||
[Mapping("enabled")]
|
|
||||||
Enabled,
|
|
||||||
|
|
||||||
/// <remarks>Used in OpenMSX</remarks>
|
|
||||||
[Mapping("genmsxid", "genmsx_id", "gen_msxid", "gen_msx_id")]
|
|
||||||
GenMSXID,
|
|
||||||
|
|
||||||
/// <remarks>Used in Logiqx (EmuArc Extension)</remarks>
|
|
||||||
[Mapping("genre")]
|
|
||||||
Genre,
|
|
||||||
|
|
||||||
/// <remarks>Used in ListXML</remarks>
|
|
||||||
[Mapping("history")]
|
|
||||||
History,
|
|
||||||
|
|
||||||
/// <remarks>Used in Logiqx</remarks>
|
|
||||||
[Mapping("id", "nointroid", "nointro_id", "no_intro_id")]
|
|
||||||
ID,
|
|
||||||
|
|
||||||
/// <remarks>Used in AttractMode, ClrMamePro, ListXML, Logiqx, and OpenMSX</remarks>
|
|
||||||
[Mapping("manufacturer")]
|
|
||||||
Manufacturer,
|
|
||||||
|
|
||||||
/// <remarks>Used in ArchiveDotOrg, AttractMode, ClrMamePro, DOSCenter, Everdrive SMDB, Hashfile, ListROM, ListXML, Logiqx, Missfile, OfflineList, OpenMSX, RomCenter, Separated Value, and Software List</remarks>
|
|
||||||
[Mapping("name")]
|
|
||||||
Name,
|
|
||||||
|
|
||||||
/// <remarks>Used in AttractMode and Logiqx</remarks>
|
|
||||||
[Mapping("players")]
|
|
||||||
Players,
|
|
||||||
|
|
||||||
/// <remarks>Used in Logiqx, OfflineList, and Software List</remarks>
|
|
||||||
[Mapping("publisher")]
|
|
||||||
Publisher,
|
|
||||||
|
|
||||||
/// <remarks>Used in Logiqx (EmuArc Extension)</remarks>
|
|
||||||
[Mapping("ratings")]
|
|
||||||
Ratings,
|
|
||||||
|
|
||||||
/// <remarks>Used in Logiqx</remarks>
|
|
||||||
[Mapping("rebuildto", "rebuild_to")]
|
|
||||||
RebuildTo,
|
|
||||||
|
|
||||||
/// <remarks>Used in Logiqx (EmuArc Extension)</remarks>
|
|
||||||
[Mapping("relatedto", "related_to")]
|
|
||||||
RelatedTo,
|
|
||||||
|
|
||||||
/// <remarks>Used in ClrMamePro, ListXML, Logiqx, and RomCenter</remarks>
|
|
||||||
[Mapping("romof", "rom_of")]
|
|
||||||
RomOf,
|
|
||||||
|
|
||||||
/// <remarks>Used in AttractMode</remarks>
|
|
||||||
[Mapping("rotation")]
|
|
||||||
Rotation,
|
|
||||||
|
|
||||||
/// <remarks>Used in ListXML and Logiqx</remarks>
|
|
||||||
[Mapping("runnable")]
|
|
||||||
Runnable,
|
|
||||||
|
|
||||||
/// <remarks>Used in ClrMamePro, ListXML, and Logiqx</remarks>
|
|
||||||
[Mapping("sampleof", "sample_of")]
|
|
||||||
SampleOf,
|
|
||||||
|
|
||||||
/// <remarks>Used in Logiqx (EmuArc Extension)</remarks>
|
|
||||||
[Mapping("score")]
|
|
||||||
Score,
|
|
||||||
|
|
||||||
/// <remarks>Used in ListXML and Logiqx</remarks>
|
|
||||||
[Mapping("sourcefile", "source_file")]
|
|
||||||
SourceFile,
|
|
||||||
|
|
||||||
/// <remarks>Used in AttractMode</remarks>
|
|
||||||
[Mapping("amstatus", "am_status", "gamestatus", "supportstatus", "support_status")]
|
|
||||||
Status,
|
|
||||||
|
|
||||||
/// <remarks>Used in Logiqx (EmuArc Extension)</remarks>
|
|
||||||
[Mapping("subgenre", "sub_genre")]
|
|
||||||
Subgenre,
|
|
||||||
|
|
||||||
/// <remarks>Used in Software List</remarks>
|
|
||||||
[Mapping("supported")]
|
|
||||||
Supported,
|
|
||||||
|
|
||||||
/// <remarks>Used in OpenMSX</remarks>
|
|
||||||
[Mapping("system", "msxsystem", "msx_system")]
|
|
||||||
System,
|
|
||||||
|
|
||||||
/// <remarks>Used in Logiqx (EmuArc Extension)</remarks>
|
|
||||||
[Mapping("titleid", "title_id")]
|
|
||||||
TitleID,
|
|
||||||
|
|
||||||
/// <remarks>Used in ClrMamePro, DOSCenter, ListXML, and Logiqx</remarks>
|
|
||||||
[Mapping("type")]
|
|
||||||
Type,
|
|
||||||
|
|
||||||
/// <remarks>Used in AttractMode, ClrMamePro, ListXML, Logiqx, OpenMSX, and Software List</remarks>
|
|
||||||
[Mapping("year")]
|
|
||||||
Year,
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Logging
|
#region Logging
|
||||||
|
|||||||
@@ -69,36 +69,6 @@ namespace SabreTools.Core.Tools
|
|||||||
return AsEnumValue<DatItemField>(itemInput);
|
return AsEnumValue<DatItemField>(itemInput);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Get MachineField value from input string
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="input">String to get value from</param>
|
|
||||||
/// <returns>MachineField value corresponding to the string</returns>
|
|
||||||
public static MachineField AsMachineField(this string? input)
|
|
||||||
{
|
|
||||||
// If the input is empty, we return null
|
|
||||||
if (string.IsNullOrEmpty(input))
|
|
||||||
return MachineField.NULL;
|
|
||||||
|
|
||||||
// Normalize the input
|
|
||||||
input = input!.ToLowerInvariant();
|
|
||||||
|
|
||||||
// Create regex
|
|
||||||
string machineRegex = @"^(game|machine)[.\-_\s]";
|
|
||||||
|
|
||||||
// If we don't have a machine field, skip
|
|
||||||
if (!Regex.IsMatch(input, machineRegex))
|
|
||||||
return MachineField.NULL;
|
|
||||||
|
|
||||||
// Replace the match and re-normalize
|
|
||||||
string machineInput = Regex.Replace(input, machineRegex, string.Empty)
|
|
||||||
.Replace(' ', '_')
|
|
||||||
.Replace('-', '_')
|
|
||||||
.Replace('.', '_');
|
|
||||||
|
|
||||||
return AsEnumValue<MachineField>(machineInput);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Get bool? value from input string
|
/// Get bool? value from input string
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -279,101 +279,6 @@ namespace SabreTools.Test.Core
|
|||||||
Assert.Equal(expected, actual);
|
Assert.Equal(expected, actual);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData(null, MachineField.NULL)]
|
|
||||||
[InlineData("name", MachineField.NULL)]
|
|
||||||
[InlineData("game-name", MachineField.Name)]
|
|
||||||
[InlineData("game.name", MachineField.Name)]
|
|
||||||
[InlineData("game_name", MachineField.Name)]
|
|
||||||
[InlineData("game name", MachineField.Name)]
|
|
||||||
[InlineData("machine-name", MachineField.Name)]
|
|
||||||
[InlineData("machine.name", MachineField.Name)]
|
|
||||||
[InlineData("machine_name", MachineField.Name)]
|
|
||||||
[InlineData("machine name", MachineField.Name)]
|
|
||||||
[InlineData("GAME.NAME", MachineField.Name)]
|
|
||||||
[InlineData("gAmE.namE", MachineField.Name)]
|
|
||||||
public void AsMachineFieldProcessingTest(string? field, MachineField expected)
|
|
||||||
{
|
|
||||||
MachineField actual = field.AsMachineField();
|
|
||||||
Assert.Equal(expected, actual);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
|
||||||
[InlineData(null, MachineField.NULL)]
|
|
||||||
[InlineData("game.board", MachineField.Board)]
|
|
||||||
[InlineData("game.buttons", MachineField.Buttons)]
|
|
||||||
[InlineData("game.category", MachineField.Category)]
|
|
||||||
[InlineData("game.cloneof", MachineField.CloneOf)]
|
|
||||||
[InlineData("game.clone_of", MachineField.CloneOf)]
|
|
||||||
[InlineData("game.cloneofid", MachineField.CloneOfID)]
|
|
||||||
[InlineData("game.nointrocloneofid", MachineField.CloneOfID)]
|
|
||||||
[InlineData("game.nointro_cloneofid", MachineField.CloneOfID)]
|
|
||||||
[InlineData("game.no_intro_cloneofid", MachineField.CloneOfID)]
|
|
||||||
[InlineData("game.no_intro_clone_of_id", MachineField.CloneOfID)]
|
|
||||||
[InlineData("game.comment", MachineField.Comment)]
|
|
||||||
[InlineData("game.extra", MachineField.Comment)]
|
|
||||||
[InlineData("game.control", MachineField.Control)]
|
|
||||||
[InlineData("game.country", MachineField.Country)]
|
|
||||||
[InlineData("game.crc", MachineField.CRC)]
|
|
||||||
[InlineData("game.hascrc", MachineField.CRC)]
|
|
||||||
[InlineData("game.has_crc", MachineField.CRC)]
|
|
||||||
[InlineData("game.desc", MachineField.Description)]
|
|
||||||
[InlineData("game.description", MachineField.Description)]
|
|
||||||
[InlineData("game.developer", MachineField.Developer)]
|
|
||||||
[InlineData("game.displaycount", MachineField.DisplayCount)]
|
|
||||||
[InlineData("game.display_count", MachineField.DisplayCount)]
|
|
||||||
[InlineData("game.displaytype", MachineField.DisplayType)]
|
|
||||||
[InlineData("game.display_type", MachineField.DisplayType)]
|
|
||||||
[InlineData("game.enabled", MachineField.Enabled)]
|
|
||||||
[InlineData("game.genmsxid", MachineField.GenMSXID)]
|
|
||||||
[InlineData("game.genmsx_id", MachineField.GenMSXID)]
|
|
||||||
[InlineData("game.gen_msxid", MachineField.GenMSXID)]
|
|
||||||
[InlineData("game.gen_msx_id", MachineField.GenMSXID)]
|
|
||||||
[InlineData("game.genre", MachineField.Genre)]
|
|
||||||
[InlineData("game.history", MachineField.History)]
|
|
||||||
[InlineData("game.id", MachineField.ID)]
|
|
||||||
[InlineData("game.nointroid", MachineField.ID)]
|
|
||||||
[InlineData("game.nointro_id", MachineField.ID)]
|
|
||||||
[InlineData("game.no_intro_id", MachineField.ID)]
|
|
||||||
[InlineData("game.manufacturer", MachineField.Manufacturer)]
|
|
||||||
[InlineData("game.name", MachineField.Name)]
|
|
||||||
[InlineData("game.players", MachineField.Players)]
|
|
||||||
[InlineData("game.publisher", MachineField.Publisher)]
|
|
||||||
[InlineData("game.ratings", MachineField.Ratings)]
|
|
||||||
[InlineData("game.rebuildto", MachineField.RebuildTo)]
|
|
||||||
[InlineData("game.rebuild_to", MachineField.RebuildTo)]
|
|
||||||
[InlineData("game.relatedto", MachineField.RelatedTo)]
|
|
||||||
[InlineData("game.related_to", MachineField.RelatedTo)]
|
|
||||||
[InlineData("game.romof", MachineField.RomOf)]
|
|
||||||
[InlineData("game.rom_of", MachineField.RomOf)]
|
|
||||||
[InlineData("game.rotation", MachineField.Rotation)]
|
|
||||||
[InlineData("game.runnable", MachineField.Runnable)]
|
|
||||||
[InlineData("game.sampleof", MachineField.SampleOf)]
|
|
||||||
[InlineData("game.sample_of", MachineField.SampleOf)]
|
|
||||||
[InlineData("game.score", MachineField.Score)]
|
|
||||||
[InlineData("game.sourcefile", MachineField.SourceFile)]
|
|
||||||
[InlineData("game.source_file", MachineField.SourceFile)]
|
|
||||||
[InlineData("game.amstatus", MachineField.Status)]
|
|
||||||
[InlineData("game.am_status", MachineField.Status)]
|
|
||||||
[InlineData("game.gamestatus", MachineField.Status)]
|
|
||||||
[InlineData("game.supportstatus", MachineField.Status)]
|
|
||||||
[InlineData("game.support_status", MachineField.Status)]
|
|
||||||
[InlineData("game.subgenre", MachineField.Subgenre)]
|
|
||||||
[InlineData("game.sub_genre", MachineField.Subgenre)]
|
|
||||||
[InlineData("game.supported", MachineField.Supported)]
|
|
||||||
[InlineData("game.system", MachineField.System)]
|
|
||||||
[InlineData("game.msxsystem", MachineField.System)]
|
|
||||||
[InlineData("game.msx_system", MachineField.System)]
|
|
||||||
[InlineData("game.titleid", MachineField.TitleID)]
|
|
||||||
[InlineData("game.title_id", MachineField.TitleID)]
|
|
||||||
[InlineData("game.type", MachineField.Type)]
|
|
||||||
[InlineData("game.year", MachineField.Year)]
|
|
||||||
public void AsMachineFieldTest(string? field, MachineField expected)
|
|
||||||
{
|
|
||||||
MachineField actual = field.AsMachineField();
|
|
||||||
Assert.Equal(expected, actual);
|
|
||||||
}
|
|
||||||
|
|
||||||
[Theory]
|
[Theory]
|
||||||
[InlineData(null, MachineType.None)]
|
[InlineData(null, MachineType.None)]
|
||||||
[InlineData("none", MachineType.None)]
|
[InlineData("none", MachineType.None)]
|
||||||
@@ -878,7 +783,6 @@ namespace SabreTools.Test.Core
|
|||||||
[InlineData(ItemType.NULL, 54)]
|
[InlineData(ItemType.NULL, 54)]
|
||||||
[InlineData(LoadFlag.NULL, 14)]
|
[InlineData(LoadFlag.NULL, 14)]
|
||||||
[InlineData(LogLevel.VERBOSE, 4)]
|
[InlineData(LogLevel.VERBOSE, 4)]
|
||||||
[InlineData(MachineField.NULL, 68)]
|
|
||||||
[InlineData(MachineType.None, 6)]
|
[InlineData(MachineType.None, 6)]
|
||||||
[InlineData(MergingFlag.None, 12)]
|
[InlineData(MergingFlag.None, 12)]
|
||||||
[InlineData(NodumpFlag.None, 4)]
|
[InlineData(NodumpFlag.None, 4)]
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ using SabreTools.Core;
|
|||||||
using SabreTools.Core.Tools;
|
using SabreTools.Core.Tools;
|
||||||
using SabreTools.DatFiles;
|
using SabreTools.DatFiles;
|
||||||
using SabreTools.DatTools;
|
using SabreTools.DatTools;
|
||||||
|
using SabreTools.Filter;
|
||||||
using SabreTools.Filtering;
|
using SabreTools.Filtering;
|
||||||
using SabreTools.Hashing;
|
using SabreTools.Hashing;
|
||||||
using SabreTools.Help;
|
using SabreTools.Help;
|
||||||
@@ -46,13 +47,13 @@ Add new output format(s): format(datformat, ...);
|
|||||||
Set the output directory: output(outdir);
|
Set the output directory: output(outdir);
|
||||||
Write the internal items: write([overwrite = true]);
|
Write the internal items: write([overwrite = true]);
|
||||||
Reset the internal state: reset();";
|
Reset the internal state: reset();";
|
||||||
Features = new Dictionary<string, Help.Feature>();
|
Features = [];
|
||||||
|
|
||||||
// Common Features
|
// Common Features
|
||||||
AddCommonFeatures();
|
AddCommonFeatures();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool ProcessFeatures(Dictionary<string, Help.Feature> features)
|
public override bool ProcessFeatures(Dictionary<string, Feature?> features)
|
||||||
{
|
{
|
||||||
// If the base fails, just fail out
|
// If the base fails, just fail out
|
||||||
if (!base.ProcessFeatures(features))
|
if (!base.ProcessFeatures(features))
|
||||||
@@ -112,10 +113,10 @@ Reset the internal state: reset();";
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Validate that the command has the proper number and type of arguments
|
// Validate that the command has the proper number and type of arguments
|
||||||
(bool valid, string error) = command.ValidateArguments();
|
(bool valid, string? error) = command.ValidateArguments();
|
||||||
if (!valid)
|
if (!valid)
|
||||||
{
|
{
|
||||||
logger.User(error);
|
logger.User(error ?? string.Empty);
|
||||||
logger.User($"Usage: {command.Usage()}");
|
logger.User($"Usage: {command.Usage()}");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -138,7 +139,7 @@ Reset the internal state: reset();";
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
private abstract class BatchCommand
|
private abstract class BatchCommand
|
||||||
{
|
{
|
||||||
public string Name { get; private set; }
|
public string Name { get; set; }
|
||||||
public List<string> Arguments { get; private set; } = [];
|
public List<string> Arguments { get; private set; } = [];
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -231,7 +232,7 @@ Reset the internal state: reset();";
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override (bool, string) ValidateArguments()
|
public override (bool, string?) ValidateArguments()
|
||||||
{
|
{
|
||||||
if (Arguments.Count != 0)
|
if (Arguments.Count != 0)
|
||||||
{
|
{
|
||||||
@@ -265,7 +266,7 @@ Reset the internal state: reset();";
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override (bool, string) ValidateArguments()
|
public override (bool, string?) ValidateArguments()
|
||||||
{
|
{
|
||||||
if (Arguments.Count == 0)
|
if (Arguments.Count == 0)
|
||||||
{
|
{
|
||||||
@@ -308,7 +309,7 @@ Reset the internal state: reset();";
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override (bool, string) ValidateArguments()
|
public override (bool, string?) ValidateArguments()
|
||||||
{
|
{
|
||||||
if (Arguments.Count != 2)
|
if (Arguments.Count != 2)
|
||||||
{
|
{
|
||||||
@@ -317,13 +318,11 @@ Reset the internal state: reset();";
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Read in the individual arguments
|
// Read in the individual arguments
|
||||||
MachineField extraMachineField = Arguments[0].AsMachineField();
|
(string? type, string? key) = FilterParser.ParseFilterId(Arguments[0]);
|
||||||
DatItemField extraDatItemField = Arguments[0].AsDatItemField();
|
|
||||||
string extraFile = Arguments[1];
|
string extraFile = Arguments[1];
|
||||||
|
|
||||||
// If we had an invalid input, log and continue
|
// If we had an invalid input, log and continue
|
||||||
if (extraMachineField == MachineField.NULL
|
if (type == null && key == null)
|
||||||
&& extraDatItemField == DatItemField.NULL)
|
|
||||||
{
|
{
|
||||||
string message = $"{Arguments[0]} was an invalid field name";
|
string message = $"{Arguments[0]} was an invalid field name";
|
||||||
return (false, message);
|
return (false, message);
|
||||||
@@ -341,7 +340,7 @@ Reset the internal state: reset();";
|
|||||||
public override void Process(BatchState batchState)
|
public override void Process(BatchState batchState)
|
||||||
{
|
{
|
||||||
// Read in the individual arguments
|
// Read in the individual arguments
|
||||||
(string?, string?) fieldName = SabreTools.Filter.FilterParser.ParseFilterId(Arguments[0]);
|
(string?, string?) fieldName = FilterParser.ParseFilterId(Arguments[0]);
|
||||||
string extraFile = Arguments[1];
|
string extraFile = Arguments[1];
|
||||||
|
|
||||||
// Create the extra INI
|
// Create the extra INI
|
||||||
@@ -379,9 +378,7 @@ Reset the internal state: reset();";
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Read in the individual arguments
|
// Read in the individual arguments
|
||||||
DatHeaderField filterDatHeaderField = Arguments[0].AsDatHeaderField();
|
(string? type, string? key) = FilterParser.ParseFilterId(Arguments[0]);
|
||||||
MachineField filterMachineField = Arguments[0].AsMachineField();
|
|
||||||
DatItemField filterDatItemField = Arguments[0].AsDatItemField();
|
|
||||||
bool? filterRemove = false;
|
bool? filterRemove = false;
|
||||||
if (Arguments.Count >= 3)
|
if (Arguments.Count >= 3)
|
||||||
filterRemove = Arguments[2].AsYesNo();
|
filterRemove = Arguments[2].AsYesNo();
|
||||||
@@ -390,9 +387,7 @@ Reset the internal state: reset();";
|
|||||||
filterPerMachine = Arguments[3].AsYesNo();
|
filterPerMachine = Arguments[3].AsYesNo();
|
||||||
|
|
||||||
// If we had an invalid input, log and continue
|
// If we had an invalid input, log and continue
|
||||||
if (filterDatHeaderField == DatHeaderField.NULL
|
if (type == null && key == null)
|
||||||
&& filterMachineField == MachineField.NULL
|
|
||||||
&& filterDatItemField == DatItemField.NULL)
|
|
||||||
{
|
{
|
||||||
string message = $"{Arguments[0]} was an invalid field name";
|
string message = $"{Arguments[0]} was an invalid field name";
|
||||||
return (false, message);
|
return (false, message);
|
||||||
@@ -456,7 +451,7 @@ Reset the internal state: reset();";
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override (bool, string) ValidateArguments()
|
public override (bool, string?) ValidateArguments()
|
||||||
{
|
{
|
||||||
if (Arguments.Count == 0)
|
if (Arguments.Count == 0)
|
||||||
{
|
{
|
||||||
@@ -509,7 +504,7 @@ Reset the internal state: reset();";
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override (bool, string) ValidateArguments()
|
public override (bool, string?) ValidateArguments()
|
||||||
{
|
{
|
||||||
if (Arguments.Count == 0)
|
if (Arguments.Count == 0)
|
||||||
{
|
{
|
||||||
@@ -549,7 +544,7 @@ Reset the internal state: reset();";
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override (bool, string) ValidateArguments()
|
public override (bool, string?) ValidateArguments()
|
||||||
{
|
{
|
||||||
if (Arguments.Count != 1)
|
if (Arguments.Count != 1)
|
||||||
{
|
{
|
||||||
@@ -597,7 +592,7 @@ Reset the internal state: reset();";
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override (bool, string) ValidateArguments()
|
public override (bool, string?) ValidateArguments()
|
||||||
{
|
{
|
||||||
if (Arguments.Count == 0)
|
if (Arguments.Count == 0)
|
||||||
{
|
{
|
||||||
@@ -631,7 +626,7 @@ Reset the internal state: reset();";
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override (bool, string) ValidateArguments()
|
public override (bool, string?) ValidateArguments()
|
||||||
{
|
{
|
||||||
if (Arguments.Count == 0)
|
if (Arguments.Count == 0)
|
||||||
{
|
{
|
||||||
@@ -665,7 +660,7 @@ Reset the internal state: reset();";
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override (bool, string) ValidateArguments()
|
public override (bool, string?) ValidateArguments()
|
||||||
{
|
{
|
||||||
if (Arguments.Count != 1)
|
if (Arguments.Count != 1)
|
||||||
{
|
{
|
||||||
@@ -698,7 +693,7 @@ Reset the internal state: reset();";
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override (bool, string) ValidateArguments()
|
public override (bool, string?) ValidateArguments()
|
||||||
{
|
{
|
||||||
if (Arguments.Count == 0)
|
if (Arguments.Count == 0)
|
||||||
{
|
{
|
||||||
@@ -733,7 +728,7 @@ Reset the internal state: reset();";
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override (bool, string) ValidateArguments()
|
public override (bool, string?) ValidateArguments()
|
||||||
{
|
{
|
||||||
if (Arguments.Count != 0)
|
if (Arguments.Count != 0)
|
||||||
{
|
{
|
||||||
@@ -766,7 +761,7 @@ Reset the internal state: reset();";
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override (bool, string) ValidateArguments()
|
public override (bool, string?) ValidateArguments()
|
||||||
{
|
{
|
||||||
if (Arguments.Count != 0)
|
if (Arguments.Count != 0)
|
||||||
{
|
{
|
||||||
@@ -800,7 +795,7 @@ Reset the internal state: reset();";
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override (bool, string) ValidateArguments()
|
public override (bool, string?) ValidateArguments()
|
||||||
{
|
{
|
||||||
if (Arguments.Count != 2)
|
if (Arguments.Count != 2)
|
||||||
{
|
{
|
||||||
@@ -847,7 +842,7 @@ Reset the internal state: reset();";
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
public override (bool, string) ValidateArguments()
|
public override (bool, string?) ValidateArguments()
|
||||||
{
|
{
|
||||||
if (Arguments.Count > 1)
|
if (Arguments.Count > 1)
|
||||||
{
|
{
|
||||||
@@ -894,7 +889,7 @@ Reset the internal state: reset();";
|
|||||||
{
|
{
|
||||||
public DatFile DatFile { get; set; } = DatFile.Create();
|
public DatFile DatFile { get; set; } = DatFile.Create();
|
||||||
public int Index { get; set; } = 0;
|
public int Index { get; set; } = 0;
|
||||||
public string OutputDirectory { get; set; } = null;
|
public string? OutputDirectory { get; set; } = null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Reset the current state
|
/// Reset the current state
|
||||||
|
|||||||
Reference in New Issue
Block a user