diff --git a/TemplateGenerator/Extensions/EnumerableExtensions.cs b/TemplateGenerator/Extensions/EnumerableExtensions.cs index dd1be6df3..fd22050f1 100644 --- a/TemplateGenerator/Extensions/EnumerableExtensions.cs +++ b/TemplateGenerator/Extensions/EnumerableExtensions.cs @@ -34,4 +34,13 @@ public static Dictionary ToStringDictionary(this IEnumera return source.ToDictionary(static element => element.ToShortName(), static element => element.ToString()); } + + public static Dictionary ToPatternKeyedDictionary( + this IEnumerable<(TKey Key, TValue Value)> source) + where TKey : struct, Enum + { + Guard.IsNotNull(source); + + return source.ToDictionary(static pair => pair.Key.ToPattern(), static pair => pair.Value); + } } diff --git a/TemplateGenerator/Models/Definitions.cs b/TemplateGenerator/Models/Definitions.cs index 338cc2501..0909d4201 100644 --- a/TemplateGenerator/Models/Definitions.cs +++ b/TemplateGenerator/Models/Definitions.cs @@ -61,5 +61,5 @@ public class Definitions { (GameMode.Story, "ゲーム本編"), (GameMode.SpellPractice, "スペルプラクティス"), - }.ToStringKeyedDictionary(); + }.ToPatternKeyedDictionary(); } diff --git a/TemplateGenerator/Models/Th15/Definitions.cs b/TemplateGenerator/Models/Th15/Definitions.cs index 606056989..2ccaae840 100644 --- a/TemplateGenerator/Models/Th15/Definitions.cs +++ b/TemplateGenerator/Models/Th15/Definitions.cs @@ -50,5 +50,5 @@ public class Definitions : Models.Definitions { (GameMode.Pointdevice, "完全無欠モード"), (GameMode.Legacy, "レガシーモード"), - }.ToStringKeyedDictionary(); + }.ToPatternKeyedDictionary(); } diff --git a/ThScoreFileConverter.Core/Models/GameMode.cs b/ThScoreFileConverter.Core/Models/GameMode.cs index 54357bde0..45661f19f 100644 --- a/ThScoreFileConverter.Core/Models/GameMode.cs +++ b/ThScoreFileConverter.Core/Models/GameMode.cs @@ -15,12 +15,12 @@ public enum GameMode /// /// Story Mode. /// - [EnumAltName("S")] + [Pattern("S")] Story, /// /// Spell Practice Mode. /// - [EnumAltName("P")] + [Pattern("P")] SpellPractice, } diff --git a/ThScoreFileConverter.Core/Models/Th15/GameMode.cs b/ThScoreFileConverter.Core/Models/Th15/GameMode.cs index 14a8400a6..09b094688 100644 --- a/ThScoreFileConverter.Core/Models/Th15/GameMode.cs +++ b/ThScoreFileConverter.Core/Models/Th15/GameMode.cs @@ -15,12 +15,12 @@ public enum GameMode /// /// Represents the Pointdevice Mode. /// - [EnumAltName("P")] + [Pattern("P")] Pointdevice, /// /// Represents the Legacy Mode. /// - [EnumAltName("L")] + [Pattern("L")] Legacy, } diff --git a/ThScoreFileConverter/Models/Th08/Parsers.cs b/ThScoreFileConverter/Models/Th08/Parsers.cs index 4fa8ee433..ab48c5eea 100644 --- a/ThScoreFileConverter/Models/Th08/Parsers.cs +++ b/ThScoreFileConverter/Models/Th08/Parsers.cs @@ -5,10 +5,12 @@ // //----------------------------------------------------------------------- +using ThScoreFileConverter.Core.Models; using ThScoreFileConverter.Core.Models.Th08; -using GameMode = ThScoreFileConverter.Core.Models.GameMode; using Level = ThScoreFileConverter.Core.Models.Level; using LevelWithTotal = ThScoreFileConverter.Core.Models.LevelWithTotal; +using Stage = ThScoreFileConverter.Core.Models.Th08.Stage; +using StageWithTotal = ThScoreFileConverter.Core.Models.Th08.StageWithTotal; namespace ThScoreFileConverter.Models.Th08; @@ -20,8 +22,7 @@ internal static class Parsers /// /// Gets the parser of . /// - public static EnumShortNameParser GameModeParser { get; } = - new EnumShortNameParser(); + public static EnumPatternParser GameModeParser { get; } = new(); /// /// Gets the parser of . diff --git a/ThScoreFileConverter/Models/Th13/Parsers.cs b/ThScoreFileConverter/Models/Th13/Parsers.cs index 57b73ff81..ab6ca891d 100644 --- a/ThScoreFileConverter/Models/Th13/Parsers.cs +++ b/ThScoreFileConverter/Models/Th13/Parsers.cs @@ -18,8 +18,7 @@ internal static class Parsers /// /// Gets the parser of . /// - public static EnumShortNameParser GameModeParser { get; } = - new EnumShortNameParser(); + public static EnumPatternParser GameModeParser { get; } = new(); /// /// Gets the parser of . diff --git a/ThScoreFileConverter/Models/Th14/Parsers.cs b/ThScoreFileConverter/Models/Th14/Parsers.cs index 6bd15c57f..4c94a0e60 100644 --- a/ThScoreFileConverter/Models/Th14/Parsers.cs +++ b/ThScoreFileConverter/Models/Th14/Parsers.cs @@ -18,8 +18,7 @@ internal static class Parsers /// /// Gets the parser of . /// - public static EnumShortNameParser GameModeParser { get; } = - new EnumShortNameParser(); + public static EnumPatternParser GameModeParser { get; } = new(); /// /// Gets the parser of . diff --git a/ThScoreFileConverter/Models/Th15/Parsers.cs b/ThScoreFileConverter/Models/Th15/Parsers.cs index 3854c948f..3235c6fe9 100644 --- a/ThScoreFileConverter/Models/Th15/Parsers.cs +++ b/ThScoreFileConverter/Models/Th15/Parsers.cs @@ -19,8 +19,7 @@ internal static class Parsers /// /// Gets the parser of . /// - public static EnumShortNameParser GameModeParser { get; } = - new EnumShortNameParser(); + public static EnumPatternParser GameModeParser { get; } = new(); /// /// Gets the parser of . diff --git a/ThScoreFileConverter/Models/Th16/Parsers.cs b/ThScoreFileConverter/Models/Th16/Parsers.cs index f02892c1d..6e7cc3c5e 100644 --- a/ThScoreFileConverter/Models/Th16/Parsers.cs +++ b/ThScoreFileConverter/Models/Th16/Parsers.cs @@ -18,8 +18,7 @@ internal static class Parsers /// /// Gets the parser of . /// - public static EnumShortNameParser GameModeParser { get; } = - new EnumShortNameParser(); + public static EnumPatternParser GameModeParser { get; } = new(); /// /// Gets the parser of . diff --git a/ThScoreFileConverter/Models/Th17/Parsers.cs b/ThScoreFileConverter/Models/Th17/Parsers.cs index 2e7281ca7..91fa8fadc 100644 --- a/ThScoreFileConverter/Models/Th17/Parsers.cs +++ b/ThScoreFileConverter/Models/Th17/Parsers.cs @@ -18,8 +18,7 @@ internal static class Parsers /// /// Gets the parser of . /// - public static EnumShortNameParser GameModeParser { get; } = - new EnumShortNameParser(); + public static EnumPatternParser GameModeParser { get; } = new(); /// /// Gets the parser of . diff --git a/ThScoreFileConverter/Models/Th18/Parsers.cs b/ThScoreFileConverter/Models/Th18/Parsers.cs index 0f3d057d0..c2c9994bf 100644 --- a/ThScoreFileConverter/Models/Th18/Parsers.cs +++ b/ThScoreFileConverter/Models/Th18/Parsers.cs @@ -18,8 +18,7 @@ internal static class Parsers /// /// Gets the parser of . /// - public static EnumShortNameParser GameModeParser { get; } = - new EnumShortNameParser(); + public static EnumPatternParser GameModeParser { get; } = new(); /// /// Gets the parser of .