mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Provide a possible short-circuit for filtering
This commit is contained in:
@@ -56,6 +56,11 @@ namespace SabreTools.Filtering
|
|||||||
/// Filter for Machine fields
|
/// Filter for Machine fields
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public MachineFilter MachineFilter { get; set; }
|
public MachineFilter MachineFilter { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Determines if any filters have been set
|
||||||
|
/// </summary>
|
||||||
|
public bool HasFilters { get; private set; } = false;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -111,6 +116,7 @@ namespace SabreTools.Filtering
|
|||||||
if (machineField != MachineField.NULL)
|
if (machineField != MachineField.NULL)
|
||||||
{
|
{
|
||||||
MachineFilter.SetFilter(machineField, value, negate);
|
MachineFilter.SetFilter(machineField, value, negate);
|
||||||
|
HasFilters = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -119,6 +125,7 @@ namespace SabreTools.Filtering
|
|||||||
if (datItemField != DatItemField.NULL)
|
if (datItemField != DatItemField.NULL)
|
||||||
{
|
{
|
||||||
DatItemFilter.SetFilter(datItemField, value, negate);
|
DatItemFilter.SetFilter(datItemField, value, negate);
|
||||||
|
HasFilters = true;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -376,6 +383,10 @@ namespace SabreTools.Filtering
|
|||||||
if (MachineFilter == null || DatItemFilter == null)
|
if (MachineFilter == null || DatItemFilter == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
// If no filters were set, return true
|
||||||
|
if (HasFilters)
|
||||||
|
return true;
|
||||||
|
|
||||||
InternalStopwatch watch = new InternalStopwatch("Applying filters to DAT");
|
InternalStopwatch watch = new InternalStopwatch("Applying filters to DAT");
|
||||||
|
|
||||||
// If we're filtering per machine, bucket by machine first
|
// If we're filtering per machine, bucket by machine first
|
||||||
|
|||||||
Reference in New Issue
Block a user