diff --git a/SabreTools.Metadata.Filter/FilterKey.cs b/SabreTools.Metadata.Filter/FilterKey.cs index 9a207be5..491b9255 100644 --- a/SabreTools.Metadata.Filter/FilterKey.cs +++ b/SabreTools.Metadata.Filter/FilterKey.cs @@ -101,22 +101,6 @@ namespace SabreTools.Metadata.Filter /// private static bool ParseHeaderFilterId(ref string itemName, ref string fieldName) { - // Get the set of constants - var constants = TypeHelper.GetConstants(typeof(Header)); - if (constants is not null) - { - // Get if there's a match to a constant - string localFieldName = fieldName; - string? constantMatch = Array.Find(constants, c => string.Equals(c, localFieldName, StringComparison.OrdinalIgnoreCase)); - if (constantMatch is not null) - { - // Return the sanitized ID - itemName = "header"; - fieldName = constantMatch; - return true; - } - } - // Get the set of properties var properties = TypeHelper.GetProperties(typeof(Header)); if (properties is not null) @@ -141,22 +125,6 @@ namespace SabreTools.Metadata.Filter /// private static bool ParseMachineFilterId(ref string itemName, ref string fieldName) { - // Get the set of constants - var constants = TypeHelper.GetConstants(typeof(Machine)); - if (constants is not null) - { - // Get if there's a match to a constant - string localFieldName = fieldName; - string? constantMatch = Array.Find(constants, c => string.Equals(c, localFieldName, StringComparison.OrdinalIgnoreCase)); - if (constantMatch is not null) - { - // Return the sanitized ID - itemName = "machine"; - fieldName = constantMatch; - return true; - } - } - // Get the set of properties var properties = TypeHelper.GetProperties(typeof(Machine)); if (properties is not null) @@ -235,16 +203,6 @@ namespace SabreTools.Metadata.Filter if (itemType is null) return null; - // Get the set of constants - var constants = TypeHelper.GetConstants(itemType); - if (constants is not null) - { - // Get if there's a match to a constant - string? constantMatch = Array.Find(constants, c => string.Equals(c, fieldName, StringComparison.OrdinalIgnoreCase)); - if (constantMatch is not null) - return constantMatch; - } - // Get the set of properties var properties = TypeHelper.GetProperties(itemType); if (properties is not null) diff --git a/SabreTools.Metadata/TypeHelper.cs b/SabreTools.Metadata/TypeHelper.cs index 10c85ed5..7e732e67 100644 --- a/SabreTools.Metadata/TypeHelper.cs +++ b/SabreTools.Metadata/TypeHelper.cs @@ -2,7 +2,6 @@ using System; using System.Collections.Generic; using System.Reflection; using System.Xml.Serialization; -using SabreTools.Data.Models; using SabreTools.Data.Models.Metadata; namespace SabreTools.Metadata @@ -10,30 +9,6 @@ namespace SabreTools.Metadata // TODO: Investigate ways of either caching or speeding up these methods public static class TypeHelper { - /// - /// Get constant values for the given type, if possible - /// - /// Does not return any values marked with the - public static string[]? GetConstants(Type? type) - { - if (type is null) - return null; - - var fields = type.GetFields(BindingFlags.Static | BindingFlags.Public | BindingFlags.FlattenHierarchy); - if (fields is null) - return null; - - FieldInfo[] noFilterFields = Array.FindAll(fields, - f => f.IsLiteral - && !f.IsInitOnly - && Attribute.GetCustomAttributes(f, typeof(NoFilterAttribute)).Length == 0); - - string[] constantValues = Array.ConvertAll(noFilterFields, - f => (f.GetRawConstantValue() as string) ?? string.Empty); - - return Array.FindAll(constantValues, s => s.Length > 0); - } - /// /// Attempt to get all DatItem types ///