[SabreTools, Filter] Add filter by game description (fixes #5)

This commit is contained in:
Matt Nadareski
2018-01-17 16:00:41 -08:00
parent 3a23afe732
commit 334b564ba7
3 changed files with 64 additions and 0 deletions

View File

@@ -23,6 +23,7 @@ namespace SabreTools.Library.DatFiles
#region Positive
private List<string> _gameNames;
private List<string> _gameDescriptions;
private List<string> _romNames;
private List<string> _romTypes;
private List<string> _crcs;
@@ -39,6 +40,7 @@ namespace SabreTools.Library.DatFiles
#region Negative
private List<string> _notGameNames;
private List<string> _notGameDescriptions;
private List<string> _notRomNames;
private List<string> _notRomTypes;
private List<string> _notCrcs;
@@ -76,6 +78,11 @@ namespace SabreTools.Library.DatFiles
get { return _gameNames; }
set { _gameNames = value; }
}
public List<string> MachineDescriptions
{
get { return _gameDescriptions; }
set { _gameDescriptions = value; }
}
public List<string> ItemNames
{
get { return _romNames; }
@@ -136,6 +143,11 @@ namespace SabreTools.Library.DatFiles
get { return _notGameNames; }
set { _notGameNames = value; }
}
public List<string> NotMachineDescriptions
{
get { return _notGameDescriptions; }
set { _notGameDescriptions = value; }
}
public List<string> 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)
{