diff --git a/src/IbanNet.CodeGen/IbanNet.CodeGen.csproj b/src/IbanNet.CodeGen/IbanNet.CodeGen.csproj index 938f975..8ba33aa 100644 --- a/src/IbanNet.CodeGen/IbanNet.CodeGen.csproj +++ b/src/IbanNet.CodeGen/IbanNet.CodeGen.csproj @@ -12,4 +12,8 @@ + + + + diff --git a/src/IbanNet.CodeGen/Swift/SwiftCsvRecord.cs b/src/IbanNet.CodeGen/Swift/SwiftCsvRecord.cs index 9f8e235..39f0a3a 100644 --- a/src/IbanNet.CodeGen/Swift/SwiftCsvRecord.cs +++ b/src/IbanNet.CodeGen/Swift/SwiftCsvRecord.cs @@ -1,6 +1,8 @@ using System.Globalization; using CsvHelper.Configuration.Attributes; using IbanNet.CodeGen.Swift.Converters; +using IbanNet.Registry.Patterns; +using IbanNet.Registry.Swift; namespace IbanNet.CodeGen.Swift; @@ -78,6 +80,8 @@ public record IbanCsvData [Name("IBAN structure")] public string Pattern { get; set; } = default!; + public Pattern SwiftPattern => new SwiftPattern(Pattern); + [Name("IBAN length")] public int Length { get; set; } diff --git a/src/IbanNet/Properties/AssemblyInfoAttributes.cs b/src/IbanNet/Properties/AssemblyInfoAttributes.cs index 863c88c..d1afbe3 100644 --- a/src/IbanNet/Properties/AssemblyInfoAttributes.cs +++ b/src/IbanNet/Properties/AssemblyInfoAttributes.cs @@ -3,5 +3,8 @@ [assembly: InternalsVisibleTo("IbanNet.Tests")] [assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] +#if DEBUG +[assembly: InternalsVisibleTo("IbanNet.CodeGen")] +#endif [assembly: NeutralResourcesLanguage("en")] [assembly: CLSCompliant(true)] diff --git a/src/IbanNet/Registry/Swift/SwiftPattern.cs b/src/IbanNet/Registry/Swift/SwiftPattern.cs index e948719..832a579 100644 --- a/src/IbanNet/Registry/Swift/SwiftPattern.cs +++ b/src/IbanNet/Registry/Swift/SwiftPattern.cs @@ -3,12 +3,7 @@ namespace IbanNet.Registry.Swift; /// -#if DEBUG -public -#else -internal -#endif - class SwiftPattern : Pattern +internal class SwiftPattern : Pattern { private static readonly SwiftPatternTokenizer Tokenizer = new(); private string? _pattern; @@ -34,36 +29,25 @@ internal SwiftPattern(string pattern, int maxLength, bool isFixedLength) } /// - public override bool IsFixedLength - { - get - { - return _isFixedLength ?? base.IsFixedLength; - } - } + public override bool IsFixedLength => _isFixedLength ?? base.IsFixedLength; /// - public override int MaxLength - { - get - { - return _maxLength ?? base.MaxLength; - } - } + public override int MaxLength => _maxLength ?? base.MaxLength; /// public override string ToString() { - return _pattern ??= string.Join("", Tokens.Select(t => - { - if (t.Value is not null) + return _pattern ??= string.Join("", + Tokens.Select(t => { - return t.Value; - } + if (t.Value is not null) + { + return t.Value; + } - string fixedLen = t.IsFixedLength ? "!" : string.Empty; - return $"{t.MaxLength}{fixedLen}{GetToken(t.Category)}"; - })); + string fixedLen = t.IsFixedLength ? "!" : string.Empty; + return $"{t.MaxLength}{fixedLen}{GetToken(t.Category)}"; + })); } private static char GetToken(AsciiCategory category) diff --git a/src/IbanNet/Registry/Swift/SwiftRegistryProvider.tt b/src/IbanNet/Registry/Swift/SwiftRegistryProvider.tt index dfb22a4..ab68429 100644 --- a/src/IbanNet/Registry/Swift/SwiftRegistryProvider.tt +++ b/src/IbanNet/Registry/Swift/SwiftRegistryProvider.tt @@ -152,7 +152,7 @@ public class SwiftRegistryProvider : IIbanRegistryProvider <# foreach (var record in records) { - var pattern = new SwiftPattern(record.Iban.Pattern); + var pattern = record.Iban.SwiftPattern; #> [GeneratedCode("SwiftRegistryProviderT4", "1.1-<#= registryReleaseVersion #>")]