diff --git a/SabreTools.Library/DatFiles/Filter.cs b/SabreTools.Library/DatFiles/Filter.cs index 260bf346..a7b0f991 100644 --- a/SabreTools.Library/DatFiles/Filter.cs +++ b/SabreTools.Library/DatFiles/Filter.cs @@ -23,6 +23,7 @@ namespace SabreTools.Library.DatFiles #region Positive private List _gameNames; + private List _gameDescriptions; private List _romNames; private List _romTypes; private List _crcs; @@ -39,6 +40,7 @@ namespace SabreTools.Library.DatFiles #region Negative private List _notGameNames; + private List _notGameDescriptions; private List _notRomNames; private List _notRomTypes; private List _notCrcs; @@ -76,6 +78,11 @@ namespace SabreTools.Library.DatFiles get { return _gameNames; } set { _gameNames = value; } } + public List MachineDescriptions + { + get { return _gameDescriptions; } + set { _gameDescriptions = value; } + } public List ItemNames { get { return _romNames; } @@ -136,6 +143,11 @@ namespace SabreTools.Library.DatFiles get { return _notGameNames; } set { _notGameNames = value; } } + public List NotMachineDescriptions + { + get { return _notGameDescriptions; } + set { _notGameDescriptions = value; } + } public List NotItemNames { get { return _notRomNames; } @@ -655,6 +667,28 @@ namespace SabreTools.Library.DatFiles } } + // Filter on game description + if (_gameDescriptions.Count > 0) + { + bool found = FindValueInList(_gameDescriptions, item.MachineDescription); + + // If the game description was not found in the list, return false + if (!found) + { + return false; + } + } + if (_notGameDescriptions.Count > 0) + { + bool found = FindValueInList(_notGameDescriptions, item.MachineDescription); + + // If the game description was found in the list, return false + if (found) + { + return false; + } + } + // Filter on rom name if (_romNames.Count > 0) { diff --git a/SabreTools/SabreTools.Help.cs b/SabreTools/SabreTools.Help.cs index f8602438..f23cf773 100644 --- a/SabreTools/SabreTools.Help.cs +++ b/SabreTools/SabreTools.Help.cs @@ -1406,6 +1406,17 @@ namespace SabreTools null); } } + private static Feature gameDescriptionListInput + { + get + { + return new Feature( + new List() { "-gd", "--game-description" }, + "Filter by game description", + FeatureType.List, + null); + } + } private static Feature gameNameListInput { get @@ -1476,6 +1487,17 @@ namespace SabreTools null); } } + private static Feature notGameDescriptionListInput + { + get + { + return new Feature( + new List() { "-ngd", "--not-game-description" }, + "Filter by not game description", + FeatureType.List, + null); + } + } private static Feature notGameNameListInput { get @@ -2330,6 +2352,8 @@ namespace SabreTools update["reverse-base-replace"].AddFeature("update-manufacturer", updateManufacturerFlag); update.AddFeature("game-name", gameNameListInput); update.AddFeature("not-game-name", notGameNameListInput); + update.AddFeature("game-description", gameDescriptionListInput); + update.AddFeature("not-game-description", notGameDescriptionListInput); update.AddFeature("match-of-tags", matchOfTagsFlag); update.AddFeature("item-name", itemNameListInput); update.AddFeature("not-item-name", notItemNameListInput); diff --git a/SabreTools/SabreTools.cs b/SabreTools/SabreTools.cs index f6d38ce5..916ba9c0 100644 --- a/SabreTools/SabreTools.cs +++ b/SabreTools/SabreTools.cs @@ -589,6 +589,9 @@ namespace SabreTools case "extb": extb.AddRange((List)feat.Value.GetValue()); break; + case "game-description": + filter.MachineDescriptions.AddRange((List)feat.Value.GetValue()); + break; case "game-name": filter.MachineNames.AddRange((List)feat.Value.GetValue()); break; @@ -610,6 +613,9 @@ namespace SabreTools case "not-crc": filter.NotCRCs.AddRange((List)feat.Value.GetValue()); break; + case "not-game-description": + filter.NotMachineDescriptions.AddRange((List)feat.Value.GetValue()); + break; case "not-game-name": filter.NotMachineNames.AddRange((List)feat.Value.GetValue()); break;