Skip to content

Commit

Permalink
Fix to use PatternAttribute for level-related enums
Browse files Browse the repository at this point in the history
  • Loading branch information
y-iihoshi committed Dec 31, 2024
1 parent 9bdf8fe commit 562e803
Show file tree
Hide file tree
Showing 36 changed files with 102 additions and 94 deletions.
2 changes: 1 addition & 1 deletion TemplateGenerator/Models/Definitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class Definitions
EnumHelper<Level>.Enumerable.Where(CanPractice).ToPatternDictionary();

public static IReadOnlyDictionary<string, string> LevelWithTotalNames { get; } =
EnumHelper<LevelWithTotal>.Enumerable.ToStringDictionary();
EnumHelper<LevelWithTotal>.Enumerable.ToPatternDictionary();

public static IEnumerable<string> LevelKeysTotalFirst { get; } = LevelWithTotalNames.Keys.RotateRight();

Expand Down
2 changes: 1 addition & 1 deletion TemplateGenerator/Models/Th07/Definitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public static class Definitions
EnumHelper<Level>.Enumerable.Where(CanPractice).ToPatternDictionary();

public static IReadOnlyDictionary<string, string> LevelWithTotalNames { get; } =
EnumHelper<LevelWithTotal>.Enumerable.ToStringDictionary();
EnumHelper<LevelWithTotal>.Enumerable.ToPatternDictionary();

public static IEnumerable<string> LevelKeysTotalFirst { get; } = LevelWithTotalNames.Keys.RotateRight();

Expand Down
2 changes: 1 addition & 1 deletion TemplateGenerator/Models/Th075/Definitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public static class Definitions
EnumHelper<Level>.Enumerable.ToPatternDictionary();

public static IReadOnlyDictionary<string, string> LevelWithTotalNames { get; } =
EnumHelper<LevelWithTotal>.Enumerable.ToStringDictionary();
EnumHelper<LevelWithTotal>.Enumerable.ToPatternDictionary();

public static IEnumerable<string> LevelKeysTotalFirst { get; } = LevelWithTotalNames.Keys.RotateRight();

Expand Down
2 changes: 1 addition & 1 deletion TemplateGenerator/Models/Th08/Definitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ public class Definitions : Models.Definitions

public static IReadOnlyDictionary<string, string> LevelSpellPracticeNames { get; } =
EnumHelper<LevelPractice>.Enumerable.ToDictionary(
static level => level.ToShortName(),
static level => level.ToPattern(),
static level => (level.ToLongName().Length > 0) ? level.ToLongName() : level.ToString());

public static IReadOnlyDictionary<string, (string ShortName, string LongName)> CharacterNames { get; } = new[]
Expand Down
2 changes: 1 addition & 1 deletion TemplateGenerator/Models/Th105/Definitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class Definitions
EnumHelper<Level>.Enumerable.ToPatternDictionary();

public static IReadOnlyDictionary<string, string> LevelWithTotalNames { get; } =
EnumHelper<LevelWithTotal>.Enumerable.ToStringDictionary();
EnumHelper<LevelWithTotal>.Enumerable.ToPatternDictionary();

public static IEnumerable<string> LevelKeysTotalFirst { get; } = LevelWithTotalNames.Keys.RotateRight();

Expand Down
2 changes: 1 addition & 1 deletion TemplateGenerator/Models/Th13/Definitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class Definitions : Models.Definitions

public static IReadOnlyDictionary<string, string> LevelSpellPracticeNames { get; } =
EnumHelper<LevelPractice>.Enumerable.ToDictionary(
static level => level.ToShortName(),
static level => level.ToPattern(),
static level => (level.ToLongName().Length > 0) ? level.ToLongName() : level.ToString());

public static IReadOnlyDictionary<string, string> CharacterNames { get; } = new[]
Expand Down
2 changes: 1 addition & 1 deletion TemplateGenerator/Models/Th145/Definitions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public static class Definitions
EnumHelper<Level>.Enumerable.ToPatternDictionary();

public static IReadOnlyDictionary<string, string> LevelWithTotalNames { get; } =
EnumHelper<LevelWithTotal>.Enumerable.ToStringDictionary();
EnumHelper<LevelWithTotal>.Enumerable.ToPatternDictionary();

public static IEnumerable<string> LevelKeysTotalFirst { get; } = LevelWithTotalNames.Keys.RotateRight();

Expand Down
12 changes: 6 additions & 6 deletions ThScoreFileConverter.Core/Models/LevelWithTotal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,36 +15,36 @@ public enum LevelWithTotal
/// <summary>
/// Represents level Easy.
/// </summary>
[EnumAltName("E")]
[Pattern("E")]
Easy,

/// <summary>
/// Represents level Normal.
/// </summary>
[EnumAltName("N")]
[Pattern("N")]
Normal,

/// <summary>
/// Represents level Hard.
/// </summary>
[EnumAltName("H")]
[Pattern("H")]
Hard,

/// <summary>
/// Represents level Lunatic.
/// </summary>
[EnumAltName("L")]
[Pattern("L")]
Lunatic,

/// <summary>
/// Represents level Extra.
/// </summary>
[EnumAltName("X")]
[Pattern("X")]
Extra,

/// <summary>
/// Represents total across levels.
/// </summary>
[EnumAltName("T")]
[Pattern("T")]
Total,
}
14 changes: 7 additions & 7 deletions ThScoreFileConverter.Core/Models/Th07/LevelWithTotal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,42 +15,42 @@ public enum LevelWithTotal
/// <summary>
/// Represents level Easy.
/// </summary>
[EnumAltName("E")]
[Pattern("E")]
Easy,

/// <summary>
/// Represents level Normal.
/// </summary>
[EnumAltName("N")]
[Pattern("N")]
Normal,

/// <summary>
/// Represents level Hard.
/// </summary>
[EnumAltName("H")]
[Pattern("H")]
Hard,

/// <summary>
/// Represents level Lunatic.
/// </summary>
[EnumAltName("L")]
[Pattern("L")]
Lunatic,

/// <summary>
/// Represents level Extra.
/// </summary>
[EnumAltName("X")]
[Pattern("X")]
Extra,

/// <summary>
/// Represents level Phantasm.
/// </summary>
[EnumAltName("P")]
[Pattern("P")]
Phantasm,

/// <summary>
/// Represents total across levels.
/// </summary>
[EnumAltName("T")]
[Pattern("T")]
Total,
}
10 changes: 5 additions & 5 deletions ThScoreFileConverter.Core/Models/Th075/LevelWithTotal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,30 @@ public enum LevelWithTotal
/// <summary>
/// Represents level Easy.
/// </summary>
[EnumAltName("E")]
[Pattern("E")]
Easy,

/// <summary>
/// Represents level Normal.
/// </summary>
[EnumAltName("N")]
[Pattern("N")]
Normal,

/// <summary>
/// Represents level Hard.
/// </summary>
[EnumAltName("H")]
[Pattern("H")]
Hard,

/// <summary>
/// Represents level Lunatic.
/// </summary>
[EnumAltName("L")]
[Pattern("L")]
Lunatic,

/// <summary>
/// Represents total across levels.
/// </summary>
[EnumAltName("T")]
[Pattern("T")]
Total,
}
6 changes: 6 additions & 0 deletions ThScoreFileConverter.Core/Models/Th08/LevelPractice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,41 @@ public enum LevelPractice
/// Represents level Easy.
/// </summary>
[EnumAltName("E")]
[Pattern("E")]
Easy,

/// <summary>
/// Represents level Normal.
/// </summary>
[EnumAltName("N")]
[Pattern("N")]
Normal,

/// <summary>
/// Represents level Hard.
/// </summary>
[EnumAltName("H")]
[Pattern("H")]
Hard,

/// <summary>
/// Represents level Lunatic.
/// </summary>
[EnumAltName("L")]
[Pattern("L")]
Lunatic,

/// <summary>
/// Represents level Extra.
/// </summary>
[EnumAltName("X")]
[Pattern("X")]
Extra,

/// <summary>
/// Represents level Last Word.
/// </summary>
[EnumAltName("W", LongName = "Last Word")]
[Pattern("W")]
LastWord,
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,41 +16,48 @@ public enum LevelPracticeWithTotal
/// Represents level Easy.
/// </summary>
[EnumAltName("E")]
[Pattern("E")]
Easy,

/// <summary>
/// Represents level Normal.
/// </summary>
[EnumAltName("N")]
[Pattern("N")]
Normal,

/// <summary>
/// Represents level Hard.
/// </summary>
[EnumAltName("H")]
[Pattern("H")]
Hard,

/// <summary>
/// Represents level Lunatic.
/// </summary>
[EnumAltName("L")]
[Pattern("L")]
Lunatic,

/// <summary>
/// Represents level Extra.
/// </summary>
[EnumAltName("X")]
[Pattern("X")]
Extra,

/// <summary>
/// Represents level Last Word.
/// </summary>
[EnumAltName("W", LongName = "Last Word")]
[Pattern("W")]
LastWord,

/// <summary>
/// Represents total across levels.
/// </summary>
[EnumAltName("T")]
[Pattern("T")]
Total,
}
10 changes: 5 additions & 5 deletions ThScoreFileConverter.Core/Models/Th105/LevelWithTotal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,30 +15,30 @@ public enum LevelWithTotal
/// <summary>
/// Represents level Easy.
/// </summary>
[EnumAltName("E")]
[Pattern("E")]
Easy,

/// <summary>
/// Represents level Normal.
/// </summary>
[EnumAltName("N")]
[Pattern("N")]
Normal,

/// <summary>
/// Represents level Hard.
/// </summary>
[EnumAltName("H")]
[Pattern("H")]
Hard,

/// <summary>
/// Represents level Lunatic.
/// </summary>
[EnumAltName("L")]
[Pattern("L")]
Lunatic,

/// <summary>
/// Represents total across levels.
/// </summary>
[EnumAltName("T")]
[Pattern("T")]
Total,
}
6 changes: 6 additions & 0 deletions ThScoreFileConverter.Core/Models/Th13/LevelPractice.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,35 +16,41 @@ public enum LevelPractice
/// Represents level Easy.
/// </summary>
[EnumAltName("E")]
[Pattern("E")]
Easy,

/// <summary>
/// Represents level Normal.
/// </summary>
[EnumAltName("N")]
[Pattern("N")]
Normal,

/// <summary>
/// Represents level Hard.
/// </summary>
[EnumAltName("H")]
[Pattern("H")]
Hard,

/// <summary>
/// Represents level Lunatic.
/// </summary>
[EnumAltName("L")]
[Pattern("L")]
Lunatic,

/// <summary>
/// Represents level Extra.
/// </summary>
[EnumAltName("X")]
[Pattern("X")]
Extra,

/// <summary>
/// Represents Over Drive.
/// </summary>
[EnumAltName("D", LongName = "Over Drive")]
[Pattern("D")]
OverDrive,
}
Loading

0 comments on commit 562e803

Please sign in to comment.