Skip to content

Commit

Permalink
Add DisplayAttribute to th9.5 enums
Browse files Browse the repository at this point in the history
  • Loading branch information
y-iihoshi committed Dec 31, 2024
1 parent 40a2892 commit e4d90aa
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 13 deletions.
27 changes: 14 additions & 13 deletions TemplateGenerator/Models/Th095/Definitions.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Collections.Generic;
using System.Linq;
using TemplateGenerator.Extensions;
using ThScoreFileConverter.Core.Extensions;
using ThScoreFileConverter.Core.Helpers;
using ThScoreFileConverter.Core.Models.Th095;
Expand All @@ -15,18 +14,20 @@ public static class Definitions

public static IReadOnlyDictionary<string, (string Id, string Name)> LevelNames { get; } = new[]
{
(Level.One, ("Level1", "Level 1")),
(Level.Two, ("Level2", "Level 2")),
(Level.Three, ("Level3", "Level 3")),
(Level.Four, ("Level4", "Level 4")),
(Level.Five, ("Level5", "Level 5")),
(Level.Six, ("Level6", "Level 6")),
(Level.Seven, ("Level7", "Level 7")),
(Level.Eight, ("Level8", "Level 8")),
(Level.Nine, ("Level9", "Level 9")),
(Level.Ten, ("Level10", "Level 10")),
(Level.Extra, ("Extra", "Level Extra")),
}.ToPatternKeyedDictionary();
(Level.One, "Level1"),
(Level.Two, "Level2"),
(Level.Three, "Level3"),
(Level.Four, "Level4"),
(Level.Five, "Level5"),
(Level.Six, "Level6"),
(Level.Seven, "Level7"),
(Level.Eight, "Level8"),
(Level.Nine, "Level9"),
(Level.Ten, "Level10"),
(Level.Extra, "Extra"),
}.ToDictionary(
static pair => pair.Item1.ToPattern(),
static pair => (pair.Item2, pair.Item1.ToDisplayName()));

public static IReadOnlyDictionary<string, int> NumScenesPerLevel { get; } =
EnumHelper<Level>.Enumerable.ToDictionary(
Expand Down
13 changes: 13 additions & 0 deletions ThScoreFileConverter.Core/Models/Th095/Level.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
// </copyright>
//-----------------------------------------------------------------------

using System.ComponentModel.DataAnnotations;

namespace ThScoreFileConverter.Core.Models.Th095;

/// <summary>
Expand All @@ -15,66 +17,77 @@ public enum Level
/// <summary>
/// Represents level 1.
/// </summary>
[Display(Name = "Level 1")]
[Pattern("1")]
One,

/// <summary>
/// Represents level 2.
/// </summary>
[Display(Name = "Level 2")]
[Pattern("2")]
Two,

/// <summary>
/// Represents level 3.
/// </summary>
[Display(Name = "Level 3")]
[Pattern("3")]
Three,

/// <summary>
/// Represents level 4.
/// </summary>
[Display(Name = "Level 4")]
[Pattern("4")]
Four,

/// <summary>
/// Represents level 5.
/// </summary>
[Display(Name = "Level 5")]
[Pattern("5")]
Five,

/// <summary>
/// Represents level 6.
/// </summary>
[Display(Name = "Level 6")]
[Pattern("6")]
Six,

/// <summary>
/// Represents level 7.
/// </summary>
[Display(Name = "Level 7")]
[Pattern("7")]
Seven,

/// <summary>
/// Represents level 8.
/// </summary>
[Display(Name = "Level 8")]
[Pattern("8")]
Eight,

/// <summary>
/// Represents level 9.
/// </summary>
[Display(Name = "Level 9")]
[Pattern("9")]
Nine,

/// <summary>
/// Represents level 10.
/// </summary>
[Display(Name = "Level 10")]
[Pattern("0")]
Ten,

/// <summary>
/// Represents level Extra.
/// </summary>
[Display(Name = "Level Extra")]
[Pattern("X")]
Extra,
}

0 comments on commit e4d90aa

Please sign in to comment.