From dba1478459e710d61a435a329a4bb378a620bacb Mon Sep 17 00:00:00 2001 From: IIHOSHI Yoshinori Date: Thu, 2 Jan 2025 06:37:02 +0900 Subject: [PATCH] Fix to use IntegerParser for th18 --- ThScoreFileConverter/Models/Th18/AbilityCardReplacer.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ThScoreFileConverter/Models/Th18/AbilityCardReplacer.cs b/ThScoreFileConverter/Models/Th18/AbilityCardReplacer.cs index 0a42565c..f6d6f1be 100644 --- a/ThScoreFileConverter/Models/Th18/AbilityCardReplacer.cs +++ b/ThScoreFileConverter/Models/Th18/AbilityCardReplacer.cs @@ -9,6 +9,7 @@ using System.Linq; using System.Text.RegularExpressions; +using ThScoreFileConverter.Core.Models; using ThScoreFileConverter.Helpers; namespace ThScoreFileConverter.Models.Th18; @@ -16,11 +17,12 @@ namespace ThScoreFileConverter.Models.Th18; // %T18ABIL[xx] internal sealed class AbilityCardReplacer(IAbilityCardHolder holder) : IStringReplaceable { - private static readonly string Pattern = StringHelper.Create($@"{Definitions.FormatPrefix}ABIL(\d{{2}})"); + private static readonly IntegerParser NumberParser = new(@"\d{2}"); + private static readonly string Pattern = StringHelper.Create($@"{Definitions.FormatPrefix}ABIL({NumberParser.Pattern})"); private readonly MatchEvaluator evaluator = new(match => { - var number = IntegerHelper.Parse(match.Groups[1].Value); + var number = NumberParser.Parse(match.Groups[1]); if (!Definitions.AbilityCardTable.TryGetValue(number - 1, out var card)) return match.ToString();