[SabreTools, Filter] Implement new filter, add warnings for invalid inputs

This commit is contained in:
Matt Nadareski
2017-01-11 16:53:22 -08:00
parent 50df38026a
commit 7d1bb820a8
3 changed files with 31 additions and 9 deletions

View File

@@ -118,11 +118,11 @@ namespace SabreTools.Helper.Dats
public bool ItemPasses(DatItem item, Logger logger)
{
// Filter on machine type
if (_machineType != MachineType.NULL && item.Machine.MachineType != _machineType)
if (_machineType != MachineType.NULL && (item.Machine.MachineType & _machineType) == 0)
{
return false;
}
if (_machineNotType != MachineType.NULL && item.Machine.MachineType == _machineNotType)
if (_machineNotType != MachineType.NULL && (item.Machine.MachineType & _machineNotType) != 0)
{
return false;
}
@@ -139,11 +139,11 @@ namespace SabreTools.Helper.Dats
Rom rom = (Rom)item;
// Filter on status
if (_itemStatus != ItemStatus.NULL && rom.ItemStatus != _itemStatus)
if (_itemStatus != ItemStatus.NULL && (rom.ItemStatus & _itemStatus) == 0)
{
return false;
}
if (_itemNotStatus != ItemStatus.NULL && rom.ItemStatus == _itemNotStatus)
if (_itemNotStatus != ItemStatus.NULL && (rom.ItemStatus & _itemNotStatus) != 0)
{
return false;
}
@@ -362,11 +362,11 @@ namespace SabreTools.Helper.Dats
Disk rom = (Disk)item;
// Filter on status
if (_itemStatus != ItemStatus.NULL && rom.ItemStatus != _itemStatus)
if (_itemStatus != ItemStatus.NULL && (rom.ItemStatus & _itemStatus) == 0)
{
return false;
}
if (_itemNotStatus != ItemStatus.NULL && rom.ItemStatus == _itemNotStatus)
if (_itemNotStatus != ItemStatus.NULL && (rom.ItemStatus & _itemNotStatus) != 0)
{
return false;
}

View File

@@ -840,18 +840,22 @@ Options:
-is=, --status= Include only items with a given status
Include items with one of the supported values:
None, Good, BadDump, Nodump, Verified
Multiples of this input are allowed.
-nis=, --not-status= Exclude only items with a given status
Exclude items with one of the supported values:
None, Good, BadDump, Nodump, Verified
Multiples of this input are allowed.
-gt=, --game-type= Include only items with the given game type
Include items with one of the supported values:
None, Bios, Device, Mechanical
Multiples of this input are allowed.
-ngt=, --not-gtype= Exclude only items with a given game type
Exclude items with one of the supported values:
None, Bios, Device, Mechanical
Multiples of this input are allowed.
-run, --runnable Include only items that are marked runnable
This allows users to include only verified runnable games