mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Add filter tests, fix issues found
This commit is contained in:
@@ -48,7 +48,7 @@ namespace SabreTools.Filter
|
||||
if (itemName == null || fieldName == null)
|
||||
throw new ArgumentOutOfRangeException(nameof(filterString));
|
||||
|
||||
this.Key = new string[] { itemName, fieldName };
|
||||
this.Key = [itemName, fieldName];
|
||||
this.Value = value;
|
||||
this.Operation = operation;
|
||||
}
|
||||
@@ -59,7 +59,7 @@ namespace SabreTools.Filter
|
||||
if (itemName == null || fieldName == null)
|
||||
throw new ArgumentOutOfRangeException(nameof(value));
|
||||
|
||||
this.Key = new string[] { itemName, fieldName };
|
||||
this.Key = [itemName, fieldName];
|
||||
this.Value = value;
|
||||
this.Operation = GetOperation(operation);
|
||||
}
|
||||
@@ -70,7 +70,7 @@ namespace SabreTools.Filter
|
||||
if (itemName == null || fieldName == null)
|
||||
throw new ArgumentOutOfRangeException(nameof(value));
|
||||
|
||||
this.Key = new string[] { itemName, fieldName };
|
||||
this.Key = [itemName, fieldName];
|
||||
this.Value = value;
|
||||
this.Operation = operation;
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ namespace SabreTools.Filter
|
||||
#else
|
||||
return fields
|
||||
.Where(f => f.IsLiteral && !f.IsInitOnly)
|
||||
.Where(f => f.CustomAttributes.Any(a => a.AttributeType == typeof(NoFilterAttribute)))
|
||||
.Where(f => !f.CustomAttributes.Any(a => a.AttributeType == typeof(NoFilterAttribute)))
|
||||
.Select(f => f.GetRawConstantValue() as string)
|
||||
.Where(v => v != null)
|
||||
.ToArray()!;
|
||||
@@ -47,8 +47,8 @@ namespace SabreTools.Filter
|
||||
|
||||
return AppDomain.CurrentDomain.GetAssemblies()
|
||||
.SelectMany(a => a.GetTypes())
|
||||
.Where(t => t.IsAssignableFrom(typeof(DatItem)) && t.IsClass)
|
||||
.FirstOrDefault(t => GetXmlRootAttributeElementName(t) == itemType);
|
||||
.Where(t => typeof(DatItem).IsAssignableFrom(t) && t.IsClass)
|
||||
.FirstOrDefault(t => string.Equals(GetXmlRootAttributeElementName(t), itemType, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
Reference in New Issue
Block a user