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

1124 lines
50 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
2020-08-25 14:24:34 -07:00
public FilterItem<string> DatItem_Name { get; private set; } = new FilterItem<string>();
public FilterItem<string> DatItem_Type { get; private set; } = new FilterItem<string>();
2020-08-20 21:15:37 -07:00
#endregion
#region AttractMode
2020-08-25 14:24:34 -07:00
public FilterItem<string> DatItem_AltName { get; private set; } = new FilterItem<string>();
public FilterItem<string> DatItem_AltTitle { get; private set; } = new FilterItem<string>();
2020-08-20 21:15:37 -07:00
#endregion
#region OpenMSX
2020-08-25 14:24:34 -07:00
public FilterItem<string> DatItem_Original { get; private set; } = new FilterItem<string>();
public FilterItem<OpenMSXSubType> DatItem_OpenMSXSubType { get; private set; } = new FilterItem<OpenMSXSubType>() { Positive = OpenMSXSubType.NULL, Negative = OpenMSXSubType.NULL };
public FilterItem<string> DatItem_OpenMSXType { get; private set; } = new FilterItem<string>();
public FilterItem<string> DatItem_Remark { get; private set; } = new FilterItem<string>();
public FilterItem<string> DatItem_Boot { get; private set; } = new FilterItem<string>();
#endregion
2020-08-20 21:15:37 -07:00
#region SoftwareList
2020-08-25 14:24:34 -07:00
// Part
public FilterItem<bool?> DatItem_Part { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> DatItem_Part_Name { get; private set; } = new FilterItem<string>();
public FilterItem<string> DatItem_Part_Interface { get; private set; } = new FilterItem<string>();
2019-01-08 17:40:28 -08:00
2020-08-25 14:24:34 -07:00
// Feature
public FilterItem<bool?> DatItem_Features { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> DatItem_Feature_Name { get; private set; } = new FilterItem<string>();
public FilterItem<string> DatItem_Feature_Value { get; private set; } = new FilterItem<string>();
2020-08-21 13:31:22 -07:00
2020-08-25 14:24:34 -07:00
public FilterItem<string> DatItem_AreaName { get; private set; } = new FilterItem<string>();
public FilterItem<long?> DatItem_AreaSize { get; private set; } = new FilterItem<long?>() { Positive = null, Negative = null, Neutral = null };
public FilterItem<string> DatItem_AreaWidth { get; private set; } = new FilterItem<string>();
public FilterItem<string> DatItem_AreaEndianness { get; private set; } = new FilterItem<string>();
public FilterItem<string> DatItem_Value { get; private set; } = new FilterItem<string>();
public FilterItem<string> DatItem_LoadFlag { get; private set; } = new FilterItem<string>();
2020-08-21 14:20:17 -07:00
2020-08-20 21:15:37 -07:00
#endregion
2020-08-25 14:24:34 -07:00
#region Item-Specific
2019-01-08 17:40:28 -08:00
2020-08-25 14:24:34 -07:00
// BiosSet
public FilterItem<bool?> DatItem_Default { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<string> DatItem_Description { get; private set; } = new FilterItem<string>();
2019-01-08 17:40:28 -08:00
2020-08-25 14:24:34 -07:00
// Disk
public FilterItem<string> DatItem_MD5 { get; private set; } = new FilterItem<string>();
#if NET_FRAMEWORK
2020-08-25 14:24:34 -07:00
public FilterItem<string> DatItem_RIPEMD160 { get; private set; } = new FilterItem<string>();
#endif
2020-08-25 14:24:34 -07:00
public FilterItem<string> DatItem_SHA1 { get; private set; } = new FilterItem<string>();
public FilterItem<string> DatItem_SHA256 { get; private set; } = new FilterItem<string>();
public FilterItem<string> DatItem_SHA384 { get; private set; } = new FilterItem<string>();
public FilterItem<string> DatItem_SHA512 { get; private set; } = new FilterItem<string>();
public FilterItem<string> DatItem_Merge { get; private set; } = new FilterItem<string>();
public FilterItem<string> DatItem_Region { get; private set; } = new FilterItem<string>();
public FilterItem<string> DatItem_Index { get; private set; } = new FilterItem<string>();
public FilterItem<bool?> DatItem_Writable { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<bool?> DatItem_Optional { get; private set; } = new FilterItem<bool?>() { Neutral = null };
public FilterItem<ItemStatus> DatItem_Status { get; private set; } = new FilterItem<ItemStatus>() { Positive = ItemStatus.NULL, Negative = ItemStatus.NULL };
// Release
public FilterItem<string> DatItem_Language { get; private set; } = new FilterItem<string>();
public FilterItem<string> DatItem_Date { get; private set; } = new FilterItem<string>();
// Rom
public FilterItem<string> DatItem_Bios { get; private set; } = new FilterItem<string>();
public FilterItem<long> DatItem_Size { get; private set; } = new FilterItem<long>() { Positive = -1, Negative = -1, Neutral = -1 };
public FilterItem<string> DatItem_CRC { get; private set; } = new FilterItem<string>();
public FilterItem<string> DatItem_Offset { get; private set; } = new FilterItem<string>();
public FilterItem<bool?> DatItem_Inverted { get; private set; } = new FilterItem<bool?>();
2020-06-05 22:26:44 -07:00
2020-08-25 14:24:34 -07:00
#endregion
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)
2020-08-25 14:24:34 -07:00
DatItem_Name.NegativeSet.Add(value);
2020-08-20 21:15:37 -07:00
else
2020-08-25 14:24:34 -07:00
DatItem_Name.PositiveSet.Add(value);
2020-08-20 21:15:37 -07:00
break;
2020-08-24 22:25:47 -07:00
case Field.DatItem_Type:
if (value.AsItemType() == null)
return;
if (negate)
2020-08-25 14:24:34 -07:00
DatItem_Type.NegativeSet.Add(value);
else
2020-08-25 14:24:34 -07:00
DatItem_Type.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-25 14:24:34 -07:00
DatItem_AltName.NegativeSet.Add(value);
else
2020-08-25 14:24:34 -07:00
DatItem_AltName.PositiveSet.Add(value);
2020-08-20 21:15:37 -07:00
break;
2020-08-24 22:25:47 -07:00
case Field.DatItem_AltTitle:
2020-08-20 21:15:37 -07:00
if (negate)
2020-08-25 14:24:34 -07:00
DatItem_AltTitle.NegativeSet.Add(value);
2020-08-20 21:15:37 -07:00
else
2020-08-25 14:24:34 -07:00
DatItem_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)
2020-08-25 14:24:34 -07:00
DatItem_Original.NegativeSet.Add(value);
else
2020-08-25 14:24:34 -07:00
DatItem_Original.PositiveSet.Add(value);
break;
2020-08-24 22:25:47 -07:00
case Field.DatItem_OpenMSXSubType:
if (negate)
2020-08-25 14:24:34 -07:00
DatItem_OpenMSXSubType.Negative |= value.AsOpenMSXSubType();
else
2020-08-25 14:24:34 -07:00
DatItem_OpenMSXSubType.Positive |= value.AsOpenMSXSubType();
break;
2020-08-24 22:25:47 -07:00
case Field.DatItem_OpenMSXType:
if (negate)
2020-08-25 14:24:34 -07:00
DatItem_OpenMSXType.NegativeSet.Add(value);
else
2020-08-25 14:24:34 -07:00
DatItem_OpenMSXType.PositiveSet.Add(value);
break;
2020-08-24 22:25:47 -07:00
case Field.DatItem_Remark:
if (negate)
2020-08-25 14:24:34 -07:00
DatItem_Remark.NegativeSet.Add(value);
else
2020-08-25 14:24:34 -07:00
DatItem_Remark.PositiveSet.Add(value);
break;
2020-08-24 22:25:47 -07:00
case Field.DatItem_Boot:
if (negate)
2020-08-25 14:24:34 -07:00
DatItem_Boot.NegativeSet.Add(value);
else
2020-08-25 14:24:34 -07:00
DatItem_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)
2020-08-25 14:24:34 -07:00
DatItem_Part_Name.NegativeSet.Add(value);
else
2020-08-25 14:24:34 -07:00
DatItem_Part_Name.PositiveSet.Add(value);
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_Part_Interface:
if (negate)
2020-08-25 14:24:34 -07:00
DatItem_Part_Interface.NegativeSet.Add(value);
else
2020-08-25 14:24:34 -07:00
DatItem_Part_Interface.PositiveSet.Add(value);
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_AreaName:
if (negate)
2020-08-25 14:24:34 -07:00
DatItem_AreaName.NegativeSet.Add(value);
else
2020-08-25 14:24:34 -07:00
DatItem_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)
{
2020-08-25 14:24:34 -07:00
DatItem_AreaSize.Neutral = areasize;
}
// Not Equal
else if (asOperation == null && negate)
{
2020-08-25 14:24:34 -07:00
DatItem_AreaSize.Negative = areasize - 1;
DatItem_AreaSize.Positive = areasize + 1;
}
// Greater Than or Equal
else if (asOperation == true && !negate)
{
2020-08-25 14:24:34 -07:00
DatItem_AreaSize.Positive = areasize;
}
// Strictly Less Than
else if (asOperation == true && negate)
{
2020-08-25 14:24:34 -07:00
DatItem_AreaSize.Negative = areasize - 1;
}
// Less Than or Equal
else if (asOperation == false && !negate)
{
2020-08-25 14:24:34 -07:00
DatItem_AreaSize.Negative = areasize;
}
// Strictly Greater Than
else if (asOperation == false && negate)
{
2020-08-25 14:24:34 -07:00
DatItem_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)
2020-08-25 14:24:34 -07:00
DatItem_AreaWidth.NegativeSet.Add(value);
2020-08-21 13:31:22 -07:00
else
2020-08-25 14:24:34 -07:00
DatItem_AreaWidth.PositiveSet.Add(value);
2020-08-21 13:31:22 -07:00
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_AreaEndianness:
2020-08-21 13:31:22 -07:00
if (negate)
2020-08-25 14:24:34 -07:00
DatItem_AreaEndianness.NegativeSet.Add(value);
2020-08-21 13:31:22 -07:00
else
2020-08-25 14:24:34 -07:00
DatItem_AreaEndianness.PositiveSet.Add(value);
2020-08-21 13:31:22 -07:00
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_Value:
2020-08-21 14:20:17 -07:00
if (negate)
2020-08-25 14:24:34 -07:00
DatItem_Value.NegativeSet.Add(value);
2020-08-21 14:20:17 -07:00
else
2020-08-25 14:24:34 -07:00
DatItem_Value.PositiveSet.Add(value);
2020-08-21 14:20:17 -07:00
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_LoadFlag:
2020-08-21 14:20:17 -07:00
if (negate)
2020-08-25 14:24:34 -07:00
DatItem_LoadFlag.NegativeSet.Add(value);
2020-08-21 14:20:17 -07:00
else
2020-08-25 14:24:34 -07:00
DatItem_LoadFlag.PositiveSet.Add(value);
2020-08-21 14:20:17 -07:00
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))
2020-08-25 14:24:34 -07:00
DatItem_Default.Neutral = false;
else
2020-08-25 14:24:34 -07:00
DatItem_Default.Neutral = true;
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_Description:
if (negate)
2020-08-25 14:24:34 -07:00
DatItem_Description.NegativeSet.Add(value);
else
2020-08-25 14:24:34 -07:00
DatItem_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)
{
2020-08-25 14:24:34 -07:00
DatItem_Size.Neutral = size;
}
// Not Equal
else if (sOperation == null && negate)
{
2020-08-25 14:24:34 -07:00
DatItem_Size.Negative = size - 1;
DatItem_Size.Positive = size + 1;
}
// Greater Than or Equal
else if (sOperation == true && !negate)
{
2020-08-25 14:24:34 -07:00
DatItem_Size.Positive = size;
}
// Strictly Less Than
else if (sOperation == true && negate)
{
2020-08-25 14:24:34 -07:00
DatItem_Size.Negative = size - 1;
}
// Less Than or Equal
else if (sOperation == false && !negate)
{
2020-08-25 14:24:34 -07:00
DatItem_Size.Negative = size;
}
// Strictly Greater Than
else if (sOperation == false && negate)
{
2020-08-25 14:24:34 -07:00
DatItem_Size.Positive = size + 1;
}
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_CRC:
if (negate)
2020-08-25 14:24:34 -07:00
DatItem_CRC.NegativeSet.Add(value);
else
2020-08-25 14:24:34 -07:00
DatItem_CRC.PositiveSet.Add(value);
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_MD5:
if (negate)
2020-08-25 14:24:34 -07:00
DatItem_MD5.NegativeSet.Add(value);
else
2020-08-25 14:24:34 -07:00
DatItem_MD5.PositiveSet.Add(value);
break;
#if NET_FRAMEWORK
2020-08-25 11:20:50 -07:00
case Field.DatItem_RIPEMD160:
if (negate)
2020-08-25 14:24:34 -07:00
DatItem_RIPEMD160.NegativeSet.Add(value);
else
2020-08-25 14:24:34 -07:00
DatItem_RIPEMD160.PositiveSet.Add(value);
break;
#endif
2020-08-25 11:20:50 -07:00
case Field.DatItem_SHA1:
if (negate)
2020-08-25 14:24:34 -07:00
DatItem_SHA1.NegativeSet.Add(value);
else
2020-08-25 14:24:34 -07:00
DatItem_SHA1.PositiveSet.Add(value);
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_SHA256:
if (negate)
2020-08-25 14:24:34 -07:00
DatItem_SHA256.NegativeSet.Add(value);
else
2020-08-25 14:24:34 -07:00
DatItem_SHA256.PositiveSet.Add(value);
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_SHA384:
if (negate)
2020-08-25 14:24:34 -07:00
DatItem_SHA384.NegativeSet.Add(value);
else
2020-08-25 14:24:34 -07:00
DatItem_SHA384.PositiveSet.Add(value);
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_SHA512:
if (negate)
2020-08-25 14:24:34 -07:00
DatItem_SHA512.NegativeSet.Add(value);
else
2020-08-25 14:24:34 -07:00
DatItem_SHA512.PositiveSet.Add(value);
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_Merge:
if (negate)
2020-08-25 14:24:34 -07:00
DatItem_Merge.NegativeSet.Add(value);
else
2020-08-25 14:24:34 -07:00
DatItem_Merge.PositiveSet.Add(value);
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_Region:
if (negate)
2020-08-25 14:24:34 -07:00
DatItem_Region.NegativeSet.Add(value);
else
2020-08-25 14:24:34 -07:00
DatItem_Region.PositiveSet.Add(value);
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_Index:
if (negate)
2020-08-25 14:24:34 -07:00
DatItem_Index.NegativeSet.Add(value);
else
2020-08-25 14:24:34 -07:00
DatItem_Index.PositiveSet.Add(value);
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_Writable:
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
2020-08-25 14:24:34 -07:00
DatItem_Writable.Neutral = false;
else
2020-08-25 14:24:34 -07:00
DatItem_Writable.Neutral = true;
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_Optional:
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
2020-08-25 14:24:34 -07:00
DatItem_Optional.Neutral = false;
else
2020-08-25 14:24:34 -07:00
DatItem_Optional.Neutral = true;
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_Status:
if (negate)
2020-08-25 14:24:34 -07:00
DatItem_Status.Negative |= value.AsItemStatus();
else
2020-08-25 14:24:34 -07:00
DatItem_Status.Positive |= value.AsItemStatus();
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_Language:
if (negate)
2020-08-25 14:24:34 -07:00
DatItem_Language.NegativeSet.Add(value);
else
2020-08-25 14:24:34 -07:00
DatItem_Language.PositiveSet.Add(value);
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_Date:
if (negate)
2020-08-25 14:24:34 -07:00
DatItem_Date.NegativeSet.Add(value);
else
2020-08-25 14:24:34 -07:00
DatItem_Date.PositiveSet.Add(value);
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_Bios:
if (negate)
2020-08-25 14:24:34 -07:00
DatItem_Bios.NegativeSet.Add(value);
else
2020-08-25 14:24:34 -07:00
DatItem_Bios.PositiveSet.Add(value);
break;
2020-08-25 11:20:50 -07:00
case Field.DatItem_Offset:
if (negate)
2020-08-25 14:24:34 -07:00
DatItem_Offset.NegativeSet.Add(value);
else
2020-08-25 14:24:34 -07:00
DatItem_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))
2020-08-25 14:24:34 -07:00
DatItem_Inverted.Neutral = false;
2020-07-28 17:00:19 -07:00
else
2020-08-25 14:24:34 -07:00
DatItem_Inverted.Neutral = true;
2020-07-28 17:00:19 -07:00
break;
2020-08-20 21:15:37 -07:00
#endregion // DatItem Filters
}
}
#endregion
#endregion // Instance Methods
2019-01-08 17:40:28 -08:00
}
}