mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Implement simple filters
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Xml.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
using SabreTools.Core;
|
||||
|
||||
@@ -7,6 +7,7 @@ using SabreTools.Core;
|
||||
using SabreTools.Core.Tools;
|
||||
using SabreTools.DatItems.Formats;
|
||||
using SabreTools.FileTypes;
|
||||
using SabreTools.Filter;
|
||||
using SabreTools.Logging;
|
||||
using SabreTools.Matching;
|
||||
|
||||
@@ -375,6 +376,19 @@ namespace SabreTools.DatItems
|
||||
// TODO: These should be item-specific for better filtering
|
||||
#region Manipulation
|
||||
|
||||
/// <summary>
|
||||
/// Runs a filter and determines if it passes or not
|
||||
/// </summary>
|
||||
/// <param name="filterRunner">Filter runner to use for checking</param>
|
||||
/// <returns>True if the item passes the filter, false otherwise</returns>
|
||||
public bool PassesFilter(FilterRunner filterRunner)
|
||||
{
|
||||
if (!Machine.PassesFilter(filterRunner))
|
||||
return false;
|
||||
|
||||
return filterRunner.Run(_internal);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove a field from the DatItem
|
||||
/// </summary>
|
||||
|
||||
@@ -542,6 +542,13 @@ namespace SabreTools.DatItems
|
||||
|
||||
#region Manipulation
|
||||
|
||||
/// <summary>
|
||||
/// Runs a filter and determines if it passes or not
|
||||
/// </summary>
|
||||
/// <param name="filterRunner">Filter runner to use for checking</param>
|
||||
/// <returns>True if the Machine passes the filter, false otherwise</returns>
|
||||
public bool PassesFilter(FilterRunner filterRunner) => filterRunner.Run(_machine);
|
||||
|
||||
/// <summary>
|
||||
/// Remove a field from the Machine
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user