From f0e5049bac5ee57e747f70572b2b23312af09ee5 Mon Sep 17 00:00:00 2001 From: IIHOSHI Yoshinori Date: Thu, 2 Jan 2025 01:08:32 +0900 Subject: [PATCH] Fix to use IntegerParser for th12.3 --- ThScoreFileConverter/Models/Th123/CardForDeckReplacer.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/ThScoreFileConverter/Models/Th123/CardForDeckReplacer.cs b/ThScoreFileConverter/Models/Th123/CardForDeckReplacer.cs index 2475cb5c..863f484b 100644 --- a/ThScoreFileConverter/Models/Th123/CardForDeckReplacer.cs +++ b/ThScoreFileConverter/Models/Th123/CardForDeckReplacer.cs @@ -9,6 +9,7 @@ using System.Collections.Generic; using System.Text.RegularExpressions; +using ThScoreFileConverter.Core.Models; using ThScoreFileConverter.Core.Models.Th123; using ThScoreFileConverter.Helpers; using CardType = ThScoreFileConverter.Core.Models.Th105.CardType; @@ -18,8 +19,9 @@ namespace ThScoreFileConverter.Models.Th123; // %T123DC[ww][x][yy][z] internal sealed class CardForDeckReplacer : IStringReplaceable { + private static readonly IntegerParser CardNumberParser = new(@"\d{2}"); private static readonly string Pattern = StringHelper.Create( - $@"{Definitions.FormatPrefix}DC({Parsers.CharaParser.Pattern})({Parsers.CardTypeParser.Pattern})(\d{{2}})([NC])"); + $@"{Definitions.FormatPrefix}DC({Parsers.CharaParser.Pattern})({Parsers.CardTypeParser.Pattern})({CardNumberParser.Pattern})([NC])"); private readonly MatchEvaluator evaluator; @@ -33,7 +35,7 @@ public CardForDeckReplacer( { var chara = Parsers.CharaParser.Parse(match.Groups[1].Value); var cardType = Parsers.CardTypeParser.Parse(match.Groups[2]); - var number = IntegerHelper.Parse(match.Groups[3].Value); + var number = CardNumberParser.Parse(match.Groups[3]); var type = match.Groups[4].Value.ToUpperInvariant(); if (chara == Chara.Oonamazu)