Files
SabreTools/SabreTools.Library/Filtering/Filter.cs

1256 lines
52 KiB
C#
Raw Normal View History

using System;
using System.Collections.Generic;
2020-08-20 14:36:36 -07:00
2019-01-08 17:40:28 -08:00
using SabreTools.Library.Data;
2020-07-30 22:51:33 -07:00
using SabreTools.Library.DatFiles;
2019-01-08 17:40:28 -08:00
using SabreTools.Library.DatItems;
using SabreTools.Library.Tools;
2020-07-30 22:51:33 -07:00
namespace SabreTools.Library.Filtering
{
2019-01-08 17:40:28 -08:00
/// <summary>
/// Represents the filtering operations that need to be performed on a set of items, usually a DAT
/// </summary>
/// TODO: Can clever use of Filtering allow for easier external splitting methods?
2020-08-24 22:25:47 -07:00
/// TODO: Field name for filter population needs to be overhauled
2019-01-11 13:44:29 -08:00
public class Filter
2019-01-08 17:40:28 -08:00
{
2020-08-20 14:36:36 -07:00
#region Fields
2019-01-08 17:40:28 -08:00
#region Machine Filters
2020-08-20 14:36:36 -07:00
#region Common
2020-08-25 14:11:00 -07:00
public FilterItem<string> Machine_Name { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Comment { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Description { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Year { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Manufacturer { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Publisher { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Category { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_RomOf { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_CloneOf { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_SampleOf { get; private set; } = new FilterItem<string>();
public FilterItem<MachineType> Machine_Type { get; private set; } = new FilterItem<MachineType>() { Positive = MachineType.NULL, Negative = MachineType.NULL };
2020-08-20 14:36:36 -07:00
#endregion
#region AttractMode
2020-08-25 14:11:00 -07:00
public FilterItem<string> Machine_Players { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Rotation { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Control { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Status { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_DisplayCount { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_DisplayType { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Buttons { get; private set; } = new FilterItem<string>();
2020-08-20 14:36:36 -07:00
#endregion
#region ListXML
2020-08-25 14:11:00 -07:00
public FilterItem<string> Machine_SourceFile { get; private set; } = new FilterItem<string>();
public FilterItem<Runnable> Machine_Runnable { get; private set; } = new FilterItem<Runnable>() { Positive = Runnable.NULL, Negative = Runnable.NULL };
// DeviceReferences
public FilterItem<bool?> Machine_DeviceReferences { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> Machine_DeviceReference_Name { get; private set; } = new FilterItem<string>();
// Chips
public FilterItem<bool?> Machine_Chips { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> Machine_Chip_Name { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Chip_Tag { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Chip_Type { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Chip_Clock { get; private set; } = new FilterItem<string>();
// Displays
public FilterItem<bool?> Machine_Displays { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> Machine_Display_Tag { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Display_Type { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Display_Rotate { get; private set; } = new FilterItem<string>();
public FilterItem<bool?> Machine_Display_FlipX { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> Machine_Display_Width { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Display_Height { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Display_Refresh { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Display_PixClock { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Display_HTotal { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Display_HBEnd { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Display_HBStart { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Display_VTotal { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Display_VBEnd { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Display_VBStart { get; private set; } = new FilterItem<string>();
// Sounds
public FilterItem<bool?> Machine_Sounds { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> Machine_Sound_Channels { get; private set; } = new FilterItem<string>();
// Conditions
public FilterItem<bool?> Machine_Conditions { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> Machine_Condition_Tag { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Condition_Mask { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Condition_Relation { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Condition_Value { get; private set; } = new FilterItem<string>();
// Inputs
public FilterItem<bool?> Machine_Inputs { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<bool?> Machine_Input_Service { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<bool?> Machine_Input_Tilt { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> Machine_Input_Players { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Input_Coins { get; private set; } = new FilterItem<string>();
// Inputs.Controls
public FilterItem<bool?> Machine_Input_Controls { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> Machine_Input_Control_Type { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Input_Control_Player { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Input_Control_Buttons { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Input_Control_RegButtons { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Input_Control_Minimum { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Input_Control_Maximum { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Input_Control_Sensitivity { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Input_Control_KeyDelta { get; private set; } = new FilterItem<string>();
public FilterItem<bool?> Machine_Input_Control_Reverse { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> Machine_Input_Control_Ways { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Input_Control_Ways2 { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Input_Control_Ways3 { get; private set; } = new FilterItem<string>();
// DipSwitches
public FilterItem<bool?> Machine_DipSwitches { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> Machine_DipSwitch_Name { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_DipSwitch_Tag { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_DipSwitch_Mask { get; private set; } = new FilterItem<string>();
// DipSwitches.Locations
public FilterItem<bool?> Machine_DipSwitch_Locations { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> Machine_DipSwitch_Location_Name { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_DipSwitch_Location_Number { get; private set; } = new FilterItem<string>();
public FilterItem<bool?> Machine_DipSwitch_Location_Inverted { get; private set; } = new FilterItem<bool?>() { Neutral = null };
// DipSwitches.Values
public FilterItem<bool?> Machine_DipSwitch_Values { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> Machine_DipSwitch_Value_Name { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_DipSwitch_Value_Value { get; private set; } = new FilterItem<string>();
public FilterItem<bool?> Machine_DipSwitch_Value_Default { get; private set; } = new FilterItem<bool?>() { Neutral = null };
// Configurations
public FilterItem<bool?> Machine_Configurations { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> Machine_Configuration_Name { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Configuration_Tag { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Configuration_Mask { get; private set; } = new FilterItem<string>();
// Configurations.Locations
public FilterItem<bool?> Machine_Configuration_Locations { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> Machine_Configuration_Location_Name { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Configuration_Location_Number { get; private set; } = new FilterItem<string>();
public FilterItem<bool?> Machine_Configuration_Location_Inverted { get; private set; } = new FilterItem<bool?>() { Neutral = null };
// Configurations.Settings
public FilterItem<bool?> Machine_Configuration_Settings { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> Machine_Configuration_Setting_Name { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Configuration_Setting_Value { get; private set; } = new FilterItem<string>();
public FilterItem<bool?> Machine_Configuration_Setting_Default { get; private set; } = new FilterItem<bool?>() { Neutral = null };
// Ports
public FilterItem<bool?> Machine_Ports { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> Machine_Port_Tag { get; private set; } = new FilterItem<string>();
// Ports.Analogs
public FilterItem<bool?> Machine_Port_Analogs { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> Machine_Port_Analog_Mask { get; private set; } = new FilterItem<string>();
// Adjusters
public FilterItem<bool?> Machine_Adjusters { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> Machine_Adjuster_Name { get; private set; } = new FilterItem<string>();
public FilterItem<bool?> Machine_Adjuster_Default { get; private set; } = new FilterItem<bool?>() { Neutral = null };
// Adjusters.Conditions
public FilterItem<bool?> Machine_Adjuster_Conditions { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> Machine_Adjuster_Condition_Tag { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Adjuster_Condition_Mask { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Adjuster_Condition_Relation { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Adjuster_Condition_Value { get; private set; } = new FilterItem<string>();
// Drivers
public FilterItem<bool?> Machine_Drivers { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> Machine_Driver_Status { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Driver_Emulation { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Driver_Cocktail { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Driver_SaveState { get; private set; } = new FilterItem<string>();
// Features
public FilterItem<bool?> Machine_Features { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> Machine_Feature_Type { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Feature_Status { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Feature_Overall { get; private set; } = new FilterItem<string>();
// Devices
public FilterItem<bool?> Machine_Devices { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> Machine_Device_Type { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Device_Tag { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Device_FixedImage { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Device_Mandatory { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Device_Interface { get; private set; } = new FilterItem<string>();
// Devices.Instances
public FilterItem<bool?> Machine_Device_Instances { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> Machine_Device_Instance_Name { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Device_Instance_BriefName { get; private set; } = new FilterItem<string>();
// Devices.Extensions
public FilterItem<bool?> Machine_Device_Extensions { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> Machine_Device_Extension_Name { get; private set; } = new FilterItem<string>();
// Slots
public FilterItem<bool?> Machine_Slots { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> Machine_Slot_Name { get; private set; } = new FilterItem<string>();
// Slots.SlotOptions
public FilterItem<bool?> Machine_Slot_SlotOptions { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> Machine_Slot_SlotOption_Name { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Slot_SlotOption_DeviceName { get; private set; } = new FilterItem<string>();
public FilterItem<bool?> Machine_Slot_SlotOption_Default { get; private set; } = new FilterItem<bool?>() { Neutral = null };
// SoftwareLists
public FilterItem<bool?> Machine_SoftwareLists { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> Machine_SoftwareList_Name { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_SoftwareList_Status { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_SoftwareList_Filter { get; private set; } = new FilterItem<string>();
// RamOptions
public FilterItem<bool?> Machine_RamOptions { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<bool?> Machine_RamOption_Default { get; private set; } = new FilterItem<bool?>() { Neutral = null };
#endregion
2020-08-20 14:36:36 -07:00
#region Logiqx
2020-08-25 14:11:00 -07:00
public FilterItem<string> Machine_Board { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_RebuildTo { get; private set; } = new FilterItem<string>();
2020-08-20 14:36:36 -07:00
#endregion
2020-08-20 22:42:04 -07:00
#region Logiqx EmuArc
2020-08-25 14:11:00 -07:00
public FilterItem<string> Machine_TitleID { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Developer { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Genre { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Subgenre { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Ratings { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Score { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Enabled { get; private set; } = new FilterItem<string>();
public FilterItem<bool?> Machine_CRC { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> Machine_RelatedTo { get; private set; } = new FilterItem<string>();
2020-08-20 22:42:04 -07:00
#endregion
#region OpenMSX
2020-08-25 14:11:00 -07:00
public FilterItem<string> Machine_GenMSXID { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_System { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Country { get; private set; } = new FilterItem<string>();
#endregion
2020-08-20 14:36:36 -07:00
#region SoftwareList
2020-08-25 14:11:00 -07:00
public FilterItem<Supported> Machine_Supported { get; private set; } = new FilterItem<Supported>() { Positive = Supported.NULL, Negative = Supported.NULL };
// Infos
public FilterItem<bool?> Machine_Infos { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> Machine_Info_Name { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_Info_Value { get; private set; } = new FilterItem<string>();
2020-08-20 14:36:36 -07:00
2020-08-25 14:11:00 -07:00
// SharedFeatures
public FilterItem<bool?> Machine_SharedFeatures { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> Machine_SharedFeature_Name { get; private set; } = new FilterItem<string>();
public FilterItem<string> Machine_SharedFeature_Value { get; private set; } = new FilterItem<string>();
2020-08-21 13:03:38 -07:00
2020-08-20 14:36:36 -07:00
#endregion
#endregion // Machine Filters
#region DatItem Filters
2020-08-20 21:15:37 -07:00
#region Common
/// <summary>
/// Include or exclude item names
/// </summary>
public FilterItem<string> ItemName { get; private set; } = new FilterItem<string>();
/// <summary>
/// Include or exclude item types
/// </summary>
public FilterItem<string> ItemTypes { get; private set; } = new FilterItem<string>();
2020-08-20 21:15:37 -07:00
#endregion
#region AttractMode
/// <summary>
2020-08-20 21:15:37 -07:00
/// Include or exclude alt names
/// </summary>
2020-08-20 21:15:37 -07:00
public FilterItem<string> AltName { get; private set; } = new FilterItem<string>();
2020-08-20 21:15:37 -07:00
/// <summary>
/// Include or exclude alt titles
/// </summary>
public FilterItem<string> AltTitle { get; private set; } = new FilterItem<string>();
#endregion
#region OpenMSX
/// <summary>
/// Include or exclude original value
/// </summary>
public FilterItem<string> Original { get; private set; } = new FilterItem<string>();
/// <summary>
/// Include or exclude items of a certain OpenMSX subtype
/// </summary>
public FilterItem<OpenMSXSubType> SubType { get; private set; } = new FilterItem<OpenMSXSubType>() { Positive = OpenMSXSubType.NULL, Negative = OpenMSXSubType.NULL };
/// <summary>
/// Include or exclude OpenMSX type
/// </summary>
public FilterItem<string> OpenMSXType { get; private set; } = new FilterItem<string>();
/// <summary>
/// Include or exclude remarks
/// </summary>
public FilterItem<string> Remark { get; private set; } = new FilterItem<string>();
/// <summary>
/// Include or exclude boots
/// </summary>
public FilterItem<string> Boot { get; private set; } = new FilterItem<string>();
#endregion
2020-08-20 21:15:37 -07:00
#region SoftwareList
/// <summary>
/// Include or exclude part names
/// </summary>
public FilterItem<string> PartName { get; private set; } = new FilterItem<string>();
2019-01-08 17:40:28 -08:00
/// <summary>
/// Include or exclude part interfaces
/// </summary>
public FilterItem<string> PartInterface { get; private set; } = new FilterItem<string>();
2020-08-21 15:31:19 -07:00
// TODO: DatItem.Features - List<SoftwareListFeature>
2020-08-20 21:15:37 -07:00
/// <summary>
/// Include or exclude area names
/// </summary>
public FilterItem<string> AreaName { get; private set; } = new FilterItem<string>();
/// <summary>
/// Include or exclude area sizes
/// </summary>
/// <remarks>Positive means "Greater than or equal", Negative means "Less than or equal", Neutral means "Equal"</remarks>
public FilterItem<long?> AreaSize { get; private set; } = new FilterItem<long?>() { Positive = null, Negative = null, Neutral = null };
2020-08-21 13:31:22 -07:00
/// <summary>
/// Include or exclude area byte widths
/// </summary>
public FilterItem<string> AreaWidth { get; private set; } = new FilterItem<string>();
/// <summary>
/// Include or exclude area endianness
/// </summary>
public FilterItem<string> AreaEndianness { get; private set; } = new FilterItem<string>();
2020-08-21 14:20:17 -07:00
/// <summary>
/// Include or exclude softwarelist value
/// </summary>
public FilterItem<string> Value { get; private set; } = new FilterItem<string>();
/// <summary>
/// Include or exclude load flag
/// </summary>
public FilterItem<string> LoadFlag { get; private set; } = new FilterItem<string>();
2020-08-20 21:15:37 -07:00
#endregion
/// <summary>
/// Include or exclude items with the "Default" tag
/// </summary>
public FilterItem<bool?> Default { get; private set; } = new FilterItem<bool?>() { Neutral = null };
/// <summary>
/// Include or exclude descriptions
/// </summary>
public FilterItem<string> Description { get; private set; } = new FilterItem<string>();
2019-01-08 17:40:28 -08:00
/// <summary>
/// Include or exclude item sizes
/// </summary>
/// <remarks>Positive means "Greater than or equal", Negative means "Less than or equal", Neutral means "Equal"</remarks>
public FilterItem<long> Size { get; private set; } = new FilterItem<long>() { Positive = -1, Negative = -1, Neutral = -1 };
/// <summary>
/// Include or exclude CRC32 hashes
/// </summary>
public FilterItem<string> CRC { get; private set; } = new FilterItem<string>();
2019-01-08 17:40:28 -08:00
/// <summary>
/// Include or exclude MD5 hashes
/// </summary>
public FilterItem<string> MD5 { get; private set; } = new FilterItem<string>();
2019-01-08 17:40:28 -08:00
#if NET_FRAMEWORK
2020-06-05 22:26:44 -07:00
/// <summary>
/// Include or exclude RIPEMD160 hashes
/// </summary>
public FilterItem<string> RIPEMD160 { get; private set; } = new FilterItem<string>();
#endif
2020-06-05 22:26:44 -07:00
/// <summary>
/// Include or exclude SHA-1 hashes
/// </summary>
public FilterItem<string> SHA1 { get; private set; } = new FilterItem<string>();
/// <summary>
/// Include or exclude SHA-256 hashes
/// </summary>
public FilterItem<string> SHA256 { get; private set; } = new FilterItem<string>();
/// <summary>
/// Include or exclude SHA-384 hashes
/// </summary>
public FilterItem<string> SHA384 { get; private set; } = new FilterItem<string>();
/// <summary>
/// Include or exclude SHA-512 hashes
/// </summary>
public FilterItem<string> SHA512 { get; private set; } = new FilterItem<string>();
/// <summary>
/// Include or exclude merge tags
/// </summary>
public FilterItem<string> MergeTag { get; private set; } = new FilterItem<string>();
/// <summary>
/// Include or exclude regions
/// </summary>
public FilterItem<string> Region { get; private set; } = new FilterItem<string>();
/// <summary>
/// Include or exclude indexes
/// </summary>
public FilterItem<string> Index { get; private set; } = new FilterItem<string>();
/// <summary>
/// Include or exclude items with the "Writable" tag
/// </summary>
public FilterItem<bool?> Writable { get; private set; } = new FilterItem<bool?>() { Neutral = null };
/// <summary>
/// Include or exclude items with the "Writable" tag
/// </summary>
public FilterItem<bool?> Optional { get; private set; } = new FilterItem<bool?>() { Neutral = null };
/// <summary>
/// Include or exclude item statuses
/// </summary>
public FilterItem<ItemStatus> Status { get; private set; } = new FilterItem<ItemStatus>() { Positive = ItemStatus.NULL, Negative = ItemStatus.NULL };
/// <summary>
/// Include or exclude languages
/// </summary>
public FilterItem<string> Language { get; private set; } = new FilterItem<string>();
/// <summary>
/// Include or exclude dates
/// </summary>
public FilterItem<string> Date { get; private set; } = new FilterItem<string>();
/// <summary>
/// Include or exclude bioses
/// </summary>
public FilterItem<string> Bios { get; private set; } = new FilterItem<string>();
/// <summary>
/// Include or exclude offsets
/// </summary>
public FilterItem<string> Offset { get; private set; } = new FilterItem<string>();
2020-07-28 17:00:19 -07:00
/// <summary>
/// Include or exclude offsets
/// </summary>
public FilterItem<bool?> Inverted { get; private set; } = new FilterItem<bool?>();
2020-07-28 17:00:19 -07:00
2020-08-20 21:15:37 -07:00
#endregion // DatItem Filters
#region Manipulation Flags
/// <summary>
/// Clean all names to WoD standards
/// </summary>
public bool Clean { get; set; }
/// <summary>
/// Set Machine Description from Machine Name
/// </summary>
public bool DescriptionAsName { get; set; }
/// <summary>
/// Include romof and cloneof when filtering machine names
/// </summary>
public bool IncludeOfInGame { get; set; }
/// <summary>
/// Internally split a DatFile
/// </summary>
2020-08-24 13:21:59 -07:00
public MergingFlag InternalSplit { get; set; }
/// <summary>
/// Remove all unicode characters
/// </summary>
public bool RemoveUnicode { get; set; }
/// <summary>
/// Include root directory when determing trim sizes
/// </summary>
public string Root { get; set; }
/// <summary>
/// Change all machine names to "!"
/// </summary>
public bool Single { get; set; }
/// <summary>
/// Trim total machine and item name to not exceed NTFS limits
/// </summary>
public bool Trim { get; set; }
2019-01-08 17:40:28 -08:00
#endregion
2020-08-20 14:36:36 -07:00
#endregion // Fields
2019-01-08 17:40:28 -08:00
#region Instance methods
#region Filter Population
/// <summary>
/// Populate the filters object using a set of key:value filters
/// </summary>
/// <param name="filters">List of key:value where ~key/!key is negated</param>
public void PopulateFromList(List<string> filters)
{
foreach (string filterPair in filters)
{
// If we don't even have a possible filter pair
if (!filterPair.Contains(":"))
{
Globals.Logger.Warning($"'{filterPair}` is not a valid filter string. Valid filter strings are of the form 'key:value'. Please refer to README.1ST or the help feature for more details.");
continue;
}
string filterPairTrimmed = filterPair.Trim('"', ' ', '\t');
bool negate = filterPairTrimmed.StartsWith("!")
|| filterPairTrimmed.StartsWith("~")
|| filterPairTrimmed.StartsWith("not-");
filterPairTrimmed = filterPairTrimmed.TrimStart('!', '~');
filterPairTrimmed = filterPairTrimmed.StartsWith("not-") ? filterPairTrimmed.Substring(4) : filterPairTrimmed;
string filterFieldString = filterPairTrimmed.Split(':')[0].ToLowerInvariant().Trim('"', ' ', '\t');
string filterValue = filterPairTrimmed.Substring(filterFieldString.Length + 1).Trim('"', ' ', '\t');
Field filterField = filterFieldString.AsField();
SetFilter(filterField, filterValue, negate);
}
}
/// <summary>
/// Set multiple filters from key
/// </summary>
/// <param name="key">Key for the filter to be set</param>
/// <param name="values">List of values for the filter</param>
/// <param name="negate">True if negative filter, false otherwise</param>
public void SetFilter(Field key, List<string> values, bool negate)
{
foreach (string value in values)
{
SetFilter(key, value, negate);
}
}
/// <summary>
/// Set a single filter from key
/// </summary>
/// <param name="key">Key for the filter to be set</param>
/// <param name="value">Value of the filter</param>
/// <param name="negate">True if negative filter, false otherwise</param>
public void SetFilter(Field key, string value, bool negate)
{
switch (key)
{
#region Machine Filters
2020-08-20 14:36:36 -07:00
#region Common
2020-08-24 22:25:47 -07:00
case Field.Machine_Name:
if (negate)
2020-08-25 14:11:00 -07:00
Machine_Name.NegativeSet.Add(value);
else
2020-08-25 14:11:00 -07:00
Machine_Name.PositiveSet.Add(value);
break;
2020-08-24 22:25:47 -07:00
case Field.Machine_Comment:
if (negate)
2020-08-25 14:11:00 -07:00
Machine_Comment.NegativeSet.Add(value);
else
2020-08-25 14:11:00 -07:00
Machine_Comment.PositiveSet.Add(value);
break;
2020-08-24 22:25:47 -07:00
case Field.Machine_Description:
if (negate)
2020-08-25 14:11:00 -07:00
Machine_Description.NegativeSet.Add(value);
else
2020-08-25 14:11:00 -07:00
Machine_Description.PositiveSet.Add(value);
break;
2020-08-24 22:25:47 -07:00
case Field.Machine_Year:
if (negate)
2020-08-25 14:11:00 -07:00
Machine_Year.NegativeSet.Add(value);
else
2020-08-25 14:11:00 -07:00
Machine_Year.PositiveSet.Add(value);
break;
2020-08-24 22:25:47 -07:00
case Field.Machine_Manufacturer:
if (negate)
2020-08-25 14:11:00 -07:00
Machine_Manufacturer.NegativeSet.Add(value);
else
2020-08-25 14:11:00 -07:00
Machine_Manufacturer.PositiveSet.Add(value);
break;
2020-08-24 22:25:47 -07:00
case Field.Machine_Publisher:
if (negate)
2020-08-25 14:11:00 -07:00
Machine_Publisher.NegativeSet.Add(value);
else
2020-08-25 14:11:00 -07:00
Machine_Publisher.PositiveSet.Add(value);
break;
2020-08-24 22:25:47 -07:00
case Field.Machine_Category:
if (negate)
2020-08-25 14:11:00 -07:00
Machine_Category.NegativeSet.Add(value);
else
2020-08-25 14:11:00 -07:00
Machine_Category.PositiveSet.Add(value);
break;
2020-08-24 22:25:47 -07:00
case Field.Machine_RomOf:
if (negate)
2020-08-25 14:11:00 -07:00
Machine_RomOf.NegativeSet.Add(value);
else
2020-08-25 14:11:00 -07:00
Machine_RomOf.PositiveSet.Add(value);
break;
2020-08-24 22:25:47 -07:00
case Field.Machine_CloneOf:
if (negate)
2020-08-25 14:11:00 -07:00
Machine_CloneOf.NegativeSet.Add(value);
else
2020-08-25 14:11:00 -07:00
Machine_CloneOf.PositiveSet.Add(value);
break;
2020-08-24 22:25:47 -07:00
case Field.Machine_SampleOf:
if (negate)
2020-08-25 14:11:00 -07:00
Machine_SampleOf.NegativeSet.Add(value);
else
2020-08-25 14:11:00 -07:00
Machine_SampleOf.PositiveSet.Add(value);
break;
2020-08-24 22:25:47 -07:00
case Field.Machine_Type:
if (negate)
2020-08-25 14:11:00 -07:00
Machine_Type.Negative |= value.AsMachineType();
else
2020-08-25 14:11:00 -07:00
Machine_Type.Positive |= value.AsMachineType();
break;
2020-08-20 14:36:36 -07:00
#endregion
#region AttractMode
2020-08-24 22:25:47 -07:00
case Field.Machine_Players:
2020-08-20 14:36:36 -07:00
if (negate)
2020-08-25 14:11:00 -07:00
Machine_Players.NegativeSet.Add(value);
else
2020-08-25 14:11:00 -07:00
Machine_Players.PositiveSet.Add(value);
break;
2020-08-24 22:25:47 -07:00
case Field.Machine_Rotation:
if (negate)
2020-08-25 14:11:00 -07:00
Machine_Rotation.NegativeSet.Add(value);
else
2020-08-25 14:11:00 -07:00
Machine_Rotation.PositiveSet.Add(value);
break;
2020-08-24 22:25:47 -07:00
case Field.Machine_Control:
2020-08-20 14:36:36 -07:00
if (negate)
2020-08-25 14:11:00 -07:00
Machine_Control.NegativeSet.Add(value);
else
2020-08-25 14:11:00 -07:00
Machine_Control.PositiveSet.Add(value);
break;
2020-08-25 11:20:50 -07:00
case Field.Machine_Status:
if (negate)
2020-08-25 14:11:00 -07:00
Machine_Status.NegativeSet.Add(value);
else
2020-08-25 14:11:00 -07:00
Machine_Status.PositiveSet.Add(value);
break;
2020-08-24 22:25:47 -07:00
case Field.Machine_DisplayCount:
if (negate)
2020-08-25 14:11:00 -07:00
Machine_DisplayCount.NegativeSet.Add(value);
else
2020-08-25 14:11:00 -07:00
Machine_DisplayCount.PositiveSet.Add(value);
2020-08-20 14:36:36 -07:00
break;
2020-08-24 22:25:47 -07:00
case Field.Machine_DisplayType:
2020-08-20 14:36:36 -07:00
if (negate)
2020-08-25 14:11:00 -07:00
Machine_DisplayType.NegativeSet.Add(value);
2020-08-20 14:36:36 -07:00
else
2020-08-25 14:11:00 -07:00
Machine_DisplayType.PositiveSet.Add(value);
2020-08-20 14:36:36 -07:00
break;
2020-08-24 22:25:47 -07:00
case Field.Machine_Buttons:
2020-08-20 14:36:36 -07:00
if (negate)
2020-08-25 14:11:00 -07:00
Machine_Buttons.NegativeSet.Add(value);
2020-08-20 14:36:36 -07:00
else
2020-08-25 14:11:00 -07:00
Machine_Buttons.PositiveSet.Add(value);
2020-08-20 14:36:36 -07:00
break;
#endregion
#region ListXML
2020-08-24 22:25:47 -07:00
case Field.Machine_SourceFile:
2020-08-20 14:36:36 -07:00
if (negate)
2020-08-25 14:11:00 -07:00
Machine_SourceFile.NegativeSet.Add(value);
2020-08-20 14:36:36 -07:00
else
2020-08-25 14:11:00 -07:00
Machine_SourceFile.PositiveSet.Add(value);
2020-08-20 14:36:36 -07:00
break;
2020-08-24 22:25:47 -07:00
case Field.Machine_Runnable:
if (negate)
2020-08-25 14:11:00 -07:00
Machine_Runnable.Negative |= value.AsRunnable();
2020-07-26 23:39:33 -07:00
else
2020-08-25 14:11:00 -07:00
Machine_Runnable.Positive |= value.AsRunnable();
2020-07-26 23:39:33 -07:00
break;
#endregion
2020-08-20 14:36:36 -07:00
#region Logiqx
2020-08-24 22:25:47 -07:00
case Field.Machine_Board:
2020-08-20 14:36:36 -07:00
if (negate)
2020-08-25 14:11:00 -07:00
Machine_Board.NegativeSet.Add(value);
2020-08-20 14:36:36 -07:00
else
2020-08-25 14:11:00 -07:00
Machine_Board.PositiveSet.Add(value);
2020-08-20 14:36:36 -07:00
break;
2020-08-24 22:25:47 -07:00
case Field.Machine_RebuildTo:
2020-08-20 14:36:36 -07:00
if (negate)
2020-08-25 14:11:00 -07:00
Machine_RebuildTo.NegativeSet.Add(value);
2020-08-20 14:36:36 -07:00
else
2020-08-25 14:11:00 -07:00
Machine_RebuildTo.PositiveSet.Add(value);
2020-08-20 14:36:36 -07:00
break;
#endregion
2020-08-20 22:42:04 -07:00
#region Logiqx EmuArc
2020-08-24 22:25:47 -07:00
case Field.Machine_TitleID:
2020-08-20 22:42:04 -07:00
if (negate)
2020-08-25 14:11:00 -07:00
Machine_TitleID.NegativeSet.Add(value);
2020-08-20 22:42:04 -07:00
else
2020-08-25 14:11:00 -07:00
Machine_TitleID.PositiveSet.Add(value);
2020-08-20 22:42:04 -07:00
break;
2020-08-24 22:25:47 -07:00
case Field.Machine_Developer:
2020-08-20 22:42:04 -07:00
if (negate)
2020-08-25 14:11:00 -07:00
Machine_Developer.NegativeSet.Add(value);
2020-08-20 22:42:04 -07:00
else
2020-08-25 14:11:00 -07:00
Machine_Developer.PositiveSet.Add(value);
2020-08-20 22:42:04 -07:00
break;
2020-08-24 22:25:47 -07:00
case Field.Machine_Genre:
2020-08-20 22:42:04 -07:00
if (negate)
2020-08-25 14:11:00 -07:00
Machine_Genre.NegativeSet.Add(value);
2020-08-20 22:42:04 -07:00
else
2020-08-25 14:11:00 -07:00
Machine_Genre.PositiveSet.Add(value);
2020-08-20 22:42:04 -07:00
break;
2020-08-24 22:25:47 -07:00
case Field.Machine_Subgenre:
2020-08-20 22:42:04 -07:00
if (negate)
2020-08-25 14:11:00 -07:00
Machine_Subgenre.NegativeSet.Add(value);
2020-08-20 22:42:04 -07:00
else
2020-08-25 14:11:00 -07:00
Machine_Subgenre.PositiveSet.Add(value);
2020-08-20 22:42:04 -07:00
break;
2020-08-24 22:25:47 -07:00
case Field.Machine_Ratings:
2020-08-20 22:42:04 -07:00
if (negate)
2020-08-25 14:11:00 -07:00
Machine_Ratings.NegativeSet.Add(value);
2020-08-20 22:42:04 -07:00
else
2020-08-25 14:11:00 -07:00
Machine_Ratings.PositiveSet.Add(value);
2020-08-20 22:42:04 -07:00
break;
2020-08-24 22:25:47 -07:00
case Field.Machine_Score:
2020-08-20 22:42:04 -07:00
if (negate)
2020-08-25 14:11:00 -07:00
Machine_Score.NegativeSet.Add(value);
2020-08-20 22:42:04 -07:00
else
2020-08-25 14:11:00 -07:00
Machine_Score.PositiveSet.Add(value);
2020-08-20 22:42:04 -07:00
break;
2020-08-24 22:25:47 -07:00
case Field.Machine_Enabled:
2020-08-20 22:42:04 -07:00
if (negate)
2020-08-25 14:11:00 -07:00
Machine_Enabled.NegativeSet.Add(value);
2020-08-20 22:42:04 -07:00
else
2020-08-25 14:11:00 -07:00
Machine_Enabled.PositiveSet.Add(value);
2020-08-20 22:42:04 -07:00
break;
2020-08-25 12:15:28 -07:00
case Field.Machine_CRC:
2020-08-20 22:42:04 -07:00
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
2020-08-25 14:11:00 -07:00
Machine_CRC.Neutral = false;
2020-08-20 22:42:04 -07:00
else
2020-08-25 14:11:00 -07:00
Machine_CRC.Neutral = true;
2020-08-20 22:42:04 -07:00
break;
2020-08-24 22:25:47 -07:00
case Field.Machine_RelatedTo:
2020-08-20 22:42:04 -07:00
if (negate)
2020-08-25 14:11:00 -07:00
Machine_RelatedTo.NegativeSet.Add(value);
2020-08-20 22:42:04 -07:00
else
2020-08-25 14:11:00 -07:00
Machine_RelatedTo.PositiveSet.Add(value);
2020-08-20 22:42:04 -07:00
break;
#endregion
#region OpenMSX
2020-08-24 22:25:47 -07:00
case Field.Machine_GenMSXID:
if (negate)
2020-08-25 14:11:00 -07:00
Machine_GenMSXID.NegativeSet.Add(value);
else
2020-08-25 14:11:00 -07:00
Machine_GenMSXID.PositiveSet.Add(value);
break;
2020-08-24 22:25:47 -07:00
case Field.Machine_System:
if (negate)
2020-08-25 14:11:00 -07:00
Machine_System.NegativeSet.Add(value);
else
2020-08-25 14:11:00 -07:00
Machine_System.PositiveSet.Add(value);
break;
2020-08-24 22:25:47 -07:00
case Field.Machine_Country:
if (negate)
2020-08-25 14:11:00 -07:00
Machine_Country.NegativeSet.Add(value);
else
2020-08-25 14:11:00 -07:00
Machine_Country.PositiveSet.Add(value);
break;
#endregion
2020-08-20 14:36:36 -07:00
#region SoftwareList
2020-08-24 22:25:47 -07:00
case Field.Machine_Supported:
2020-08-22 13:31:13 -07:00
if (negate)
2020-08-25 14:11:00 -07:00
Machine_Supported.Negative |= value.AsSupported();
2020-08-20 14:36:36 -07:00
else
2020-08-25 14:11:00 -07:00
Machine_Supported.Positive |= value.AsSupported();
2020-08-20 14:36:36 -07:00
break;
#endregion
#endregion // Machine Filters
#region DatItem Filters
2020-08-20 21:15:37 -07:00
#region Common
2020-08-24 22:25:47 -07:00
case Field.DatItem_Name:
2020-08-20 21:15:37 -07:00
if (negate)
ItemName.NegativeSet.Add(value);
else
ItemName.PositiveSet.Add(value);
break;
2020-08-24 22:25:47 -07:00
case Field.DatItem_Type:
if (value.AsItemType() == null)
return;
if (negate)
ItemTypes.NegativeSet.Add(value);
else
ItemTypes.PositiveSet.Add(value);
break;
2020-08-20 21:15:37 -07:00
#endregion
#region AttractMode
2020-08-24 22:25:47 -07:00
case Field.DatItem_AltName:
if (negate)
2020-08-20 21:15:37 -07:00
AltName.NegativeSet.Add(value);
else
2020-08-20 21:15:37 -07:00
AltName.PositiveSet.Add(value);
break;
2020-08-24 22:25:47 -07:00
case Field.DatItem_AltTitle:
2020-08-20 21:15:37 -07:00
if (negate)
AltTitle.NegativeSet.Add(value);
else
AltTitle.PositiveSet.Add(value);
break;
2020-08-20 21:15:37 -07:00
#endregion
#region OpenMSX
2020-08-24 22:25:47 -07:00
case Field.DatItem_Original:
if (negate)
Original.NegativeSet.Add(value);
else
Original.PositiveSet.Add(value);
break;
2020-08-24 22:25:47 -07:00
case Field.DatItem_OpenMSXSubType:
if (negate)
SubType.Negative |= value.AsOpenMSXSubType();
else
SubType.Positive |= value.AsOpenMSXSubType();
break;
2020-08-24 22:25:47 -07:00
case Field.DatItem_OpenMSXType:
if (negate)
OpenMSXType.NegativeSet.Add(value);
else
OpenMSXType.PositiveSet.Add(value);
break;
2020-08-24 22:25:47 -07:00
case Field.DatItem_Remark:
if (negate)
Remark.NegativeSet.Add(value);
else
Remark.PositiveSet.Add(value);
break;
2020-08-24 22:25:47 -07:00
case Field.DatItem_Boot:
if (negate)
Boot.NegativeSet.Add(value);
else
Boot.PositiveSet.Add(value);
break;
#endregion
2020-08-20 21:15:37 -07:00
#region SoftwareList
2020-08-25 11:20:50 -07:00
case Field.DatItem_Part_Name:
if (negate)
PartName.NegativeSet.Add(value);
else
PartName.PositiveSet.Add(value);
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_Part_Interface:
if (negate)
PartInterface.NegativeSet.Add(value);
else
PartInterface.PositiveSet.Add(value);
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_AreaName:
if (negate)
AreaName.NegativeSet.Add(value);
else
AreaName.PositiveSet.Add(value);
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_AreaSize:
bool? asOperation = null;
if (value.StartsWith(">"))
asOperation = true;
else if (value.StartsWith("<"))
asOperation = false;
else if (value.StartsWith("="))
asOperation = null;
string areasizeString = value.TrimStart('>', '<', '=');
if (!Int64.TryParse(areasizeString, out long areasize))
return;
// Equal
if (asOperation == null && !negate)
{
AreaSize.Neutral = areasize;
}
// Not Equal
else if (asOperation == null && negate)
{
AreaSize.Negative = areasize - 1;
AreaSize.Positive = areasize + 1;
}
// Greater Than or Equal
else if (asOperation == true && !negate)
{
AreaSize.Positive = areasize;
}
// Strictly Less Than
else if (asOperation == true && negate)
{
AreaSize.Negative = areasize - 1;
}
// Less Than or Equal
else if (asOperation == false && !negate)
{
AreaSize.Negative = areasize;
}
// Strictly Greater Than
else if (asOperation == false && negate)
{
AreaSize.Positive = areasize + 1;
}
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_AreaWidth:
2020-08-21 13:31:22 -07:00
if (negate)
AreaWidth.NegativeSet.Add(value);
else
AreaWidth.PositiveSet.Add(value);
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_AreaEndianness:
2020-08-21 13:31:22 -07:00
if (negate)
AreaEndianness.NegativeSet.Add(value);
else
AreaEndianness.PositiveSet.Add(value);
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_Value:
2020-08-21 14:20:17 -07:00
if (negate)
Value.NegativeSet.Add(value);
else
Value.PositiveSet.Add(value);
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_LoadFlag:
2020-08-21 14:20:17 -07:00
if (negate)
LoadFlag.NegativeSet.Add(value);
else
LoadFlag.PositiveSet.Add(value);
break;
2020-08-20 21:15:37 -07:00
#endregion
2020-08-25 11:20:50 -07:00
case Field.DatItem_Default:
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
Default.Neutral = false;
else
Default.Neutral = true;
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_Description:
if (negate)
Description.NegativeSet.Add(value);
else
Description.PositiveSet.Add(value);
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_Size:
bool? sOperation = null;
if (value.StartsWith(">"))
sOperation = true;
else if (value.StartsWith("<"))
sOperation = false;
else if (value.StartsWith("="))
sOperation = null;
string sizeString = value.TrimStart('>', '<', '=');
if (!Int64.TryParse(sizeString, out long size))
return;
// Equal
if (sOperation == null && !negate)
{
Size.Neutral = size;
}
// Not Equal
else if (sOperation == null && negate)
{
Size.Negative = size - 1;
Size.Positive = size + 1;
}
// Greater Than or Equal
else if (sOperation == true && !negate)
{
Size.Positive = size;
}
// Strictly Less Than
else if (sOperation == true && negate)
{
Size.Negative = size - 1;
}
// Less Than or Equal
else if (sOperation == false && !negate)
{
Size.Negative = size;
}
// Strictly Greater Than
else if (sOperation == false && negate)
{
Size.Positive = size + 1;
}
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_CRC:
if (negate)
CRC.NegativeSet.Add(value);
else
CRC.PositiveSet.Add(value);
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_MD5:
if (negate)
MD5.NegativeSet.Add(value);
else
MD5.PositiveSet.Add(value);
break;
#if NET_FRAMEWORK
2020-08-25 11:20:50 -07:00
case Field.DatItem_RIPEMD160:
if (negate)
RIPEMD160.NegativeSet.Add(value);
else
RIPEMD160.PositiveSet.Add(value);
break;
#endif
2020-08-25 11:20:50 -07:00
case Field.DatItem_SHA1:
if (negate)
SHA1.NegativeSet.Add(value);
else
SHA1.PositiveSet.Add(value);
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_SHA256:
if (negate)
SHA256.NegativeSet.Add(value);
else
SHA256.PositiveSet.Add(value);
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_SHA384:
if (negate)
SHA384.NegativeSet.Add(value);
else
SHA384.PositiveSet.Add(value);
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_SHA512:
if (negate)
SHA512.NegativeSet.Add(value);
else
SHA512.PositiveSet.Add(value);
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_Merge:
if (negate)
MergeTag.NegativeSet.Add(value);
else
MergeTag.PositiveSet.Add(value);
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_Region:
if (negate)
Region.NegativeSet.Add(value);
else
Region.PositiveSet.Add(value);
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_Index:
if (negate)
Index.NegativeSet.Add(value);
else
Index.PositiveSet.Add(value);
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_Writable:
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
Writable.Neutral = false;
else
Writable.Neutral = true;
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_Optional:
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
Optional.Neutral = false;
else
Optional.Neutral = true;
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_Status:
if (negate)
Status.Negative |= value.AsItemStatus();
else
Status.Positive |= value.AsItemStatus();
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_Language:
if (negate)
Language.NegativeSet.Add(value);
else
Language.PositiveSet.Add(value);
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_Date:
if (negate)
Date.NegativeSet.Add(value);
else
Date.PositiveSet.Add(value);
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_Bios:
if (negate)
Bios.NegativeSet.Add(value);
else
Bios.PositiveSet.Add(value);
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_Offset:
if (negate)
Offset.NegativeSet.Add(value);
else
Offset.PositiveSet.Add(value);
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_Inverted:
2020-07-28 17:00:19 -07:00
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
Inverted.Neutral = false;
else
Inverted.Neutral = true;
break;
2020-08-20 21:15:37 -07:00
#endregion // DatItem Filters
}
}
#endregion
#endregion // Instance Methods
2019-01-08 17:40:28 -08:00
}
}