From 36dff7a19aea9261b35d1cce7e7d0347cb5eb05d Mon Sep 17 00:00:00 2001
From: skwasjer <11424653+skwasjer@users.noreply.github.com>
Date: Sun, 21 May 2023 00:36:49 +0200
Subject: [PATCH] fix: undo the removal of Other as this would mean a breaking
API change. Instead mark obsolete.
See also 73008ecf01fab6f771d5be56a3fa1cd934bb467c
---
src/IbanNet/Registry/Patterns/AsciiCategory.cs | 9 +++++++++
src/IbanNet/Registry/Patterns/PatternToken.cs | 5 +++--
2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/src/IbanNet/Registry/Patterns/AsciiCategory.cs b/src/IbanNet/Registry/Patterns/AsciiCategory.cs
index 4e4d64e1..719a5186 100644
--- a/src/IbanNet/Registry/Patterns/AsciiCategory.cs
+++ b/src/IbanNet/Registry/Patterns/AsciiCategory.cs
@@ -15,6 +15,15 @@ public enum AsciiCategory
///
None = 0,
+ ///
+ /// No ASCII category.
+ ///
+ [Obsolete("Use None instead.", true)]
+#pragma warning disable CA1069
+ // ReSharper disable once UnusedMember.Global
+ Other = 0,
+#pragma warning restore CA1069
+
///
/// The space character.
///
diff --git a/src/IbanNet/Registry/Patterns/PatternToken.cs b/src/IbanNet/Registry/Patterns/PatternToken.cs
index 20700b1c..ed7e5f1f 100644
--- a/src/IbanNet/Registry/Patterns/PatternToken.cs
+++ b/src/IbanNet/Registry/Patterns/PatternToken.cs
@@ -121,9 +121,10 @@ private PatternToken(AsciiCategory category, int minLength, int maxLength, strin
///
public override string ToString()
{
+ string category = Enum.GetName(typeof(AsciiCategory), Category)!;
return IsFixedLength
- ? $"{Category}[{MaxLength}]"
- : $"{Category}[{MinLength}-{MaxLength}]";
+ ? $"{category}[{MaxLength}]"
+ : $"{category}[{MinLength}-{MaxLength}]";
}
private static Func GetCharacterTest(AsciiCategory category)