From d78c1eb9eda271d7fa45bc2df9407c5fe7b37763 Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Sun, 5 Apr 2026 11:24:47 -0400 Subject: [PATCH] GetProperties is only used by filters --- SabreTools.Metadata.Filter/FilterKey.cs | 23 ++++++++++++++++++++--- SabreTools.Metadata/TypeHelper.cs | 16 ---------------- 2 files changed, 20 insertions(+), 19 deletions(-) diff --git a/SabreTools.Metadata.Filter/FilterKey.cs b/SabreTools.Metadata.Filter/FilterKey.cs index 8d0160b1..6ecda77e 100644 --- a/SabreTools.Metadata.Filter/FilterKey.cs +++ b/SabreTools.Metadata.Filter/FilterKey.cs @@ -1,4 +1,5 @@ using System; +using System.Reflection; using SabreTools.Data.Models.Metadata; namespace SabreTools.Metadata.Filter @@ -111,7 +112,7 @@ namespace SabreTools.Metadata.Filter private static bool ParseHeaderFilterId(ref string itemName, ref string fieldName) { // Get the set of properties - var properties = TypeHelper.GetProperties(typeof(Header)); + var properties = GetProperties(typeof(Header)); if (properties is null) return false; @@ -133,7 +134,7 @@ namespace SabreTools.Metadata.Filter private static bool ParseMachineFilterId(ref string itemName, ref string fieldName) { // Get the set of properties - var properties = TypeHelper.GetProperties(typeof(Machine)); + var properties = GetProperties(typeof(Machine)); if (properties is null) return false; @@ -206,7 +207,7 @@ namespace SabreTools.Metadata.Filter return null; // Get the set of properties - var properties = TypeHelper.GetProperties(itemType); + var properties = GetProperties(itemType); if (properties is null) return null; @@ -214,5 +215,21 @@ namespace SabreTools.Metadata.Filter string? propertyMatch = Array.Find(properties, c => string.Equals(c, fieldName, StringComparison.OrdinalIgnoreCase)); return propertyMatch?.ToLowerInvariant(); } + + /// + /// Get property names for the given type, if possible + /// + private static string[]? GetProperties(Type? type) + { + if (type is null) + return null; + + var properties = type.GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public); + if (properties is null) + return null; + + string[] propertyNames = Array.ConvertAll(properties, f => f.Name); + return Array.FindAll(propertyNames, s => s.Length > 0); + } } } diff --git a/SabreTools.Metadata/TypeHelper.cs b/SabreTools.Metadata/TypeHelper.cs index 4a42a98d..1f6b3475 100644 --- a/SabreTools.Metadata/TypeHelper.cs +++ b/SabreTools.Metadata/TypeHelper.cs @@ -55,22 +55,6 @@ namespace SabreTools.Metadata return null; } - /// - /// Get property names for the given type, if possible - /// - public static string[]? GetProperties(Type? type) - { - if (type is null) - return null; - - var properties = type.GetProperties(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public); - if (properties is null) - return null; - - string[] propertyNames = Array.ConvertAll(properties, f => f.Name); - return Array.FindAll(propertyNames, s => s.Length > 0); - } - /// /// Attempt to get the XmlRootAttribute.ElementName value from a type ///