Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions RhythmGameUtilities/Enums/TypeCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ public static class TypeCode
/// <summary>
/// BPM Marker
/// </summary>
public const string BPM = "B";
public const string BPM_Marker = "B";

/// <summary>
/// Time Signature Marker
/// </summary>
public const string TimeSignature = "TS";
public const string TimeSignatureMarker = "TS";

/// <summary>
/// Note Marker
/// </summary>
public const string Note = "N";
public const string NoteMarker = "N";

/// <summary>
/// Event Marker
/// </summary>
public const string Event = "E";
public const string EventMarker = "E";

}

Expand Down
8 changes: 4 additions & 4 deletions RhythmGameUtilities/Scripts/Parsers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public static Dictionary<int, int[]> ParseTimeSignaturesFromChartSection(
KeyValuePair<string, string[]>[] section)
{
return section
.Where(item => item.Value[0] == TypeCode.TimeSignature)
.Where(item => item.Value[0] == TypeCode.TimeSignatureMarker)
.Select(item =>
new KeyValuePair<int, int[]>(int.Parse(item.Key), item.Value.Skip(1).Select(int.Parse).ToArray()))
.ToDictionary(item => item.Key, x => x.Value);
Expand All @@ -123,7 +123,7 @@ public static Dictionary<int, int> ParseBpmFromChartSection(
KeyValuePair<string, string[]>[] section)
{
return section
.Where(item => item.Value[0] == TypeCode.BPM)
.Where(item => item.Value[0] == TypeCode.BPM_Marker)
.Select(item => new KeyValuePair<int, int>(int.Parse(item.Key), int.Parse(item.Value.Skip(1).First())))
.OrderBy(item => item.Key)
.ToDictionary(item => item.Key, x => x.Value);
Expand All @@ -132,7 +132,7 @@ public static Dictionary<int, int> ParseBpmFromChartSection(
public static Note[] ParseNotesFromChartSection(KeyValuePair<string, string[]>[] section)
{
return section
.Where(item => item.Value.Length == 3 && item.Value.First() == TypeCode.Note).Select(
.Where(item => item.Value.Length == 3 && item.Value.First() == TypeCode.NoteMarker).Select(
item => new Note
{
Position = int.Parse(item.Key),
Expand All @@ -145,7 +145,7 @@ public static Dictionary<int, string> ParseLyricsFromChartSection(
KeyValuePair<string, string[]>[] section)
{
return section
.Where(item => item.Value.First() == TypeCode.Event)
.Where(item => item.Value.First() == TypeCode.EventMarker)
.Select(
item => new KeyValuePair<int, string>(int.Parse(item.Key),
JSON_VALUE_PATTERN.Matches(item.Value.Skip(1).First()).Select(part => part.Value.Trim('"'))
Expand Down
8 changes: 4 additions & 4 deletions UnityPackage/Enums/TypeCode.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@ public static class TypeCode
/// <summary>
/// BPM Marker
/// </summary>
public const string BPM = "B";
public const string BPM_Marker = "B";

/// <summary>
/// Time Signature Marker
/// </summary>
public const string TimeSignature = "TS";
public const string TimeSignatureMarker = "TS";

/// <summary>
/// Note Marker
/// </summary>
public const string Note = "N";
public const string NoteMarker = "N";

/// <summary>
/// Event Marker
/// </summary>
public const string Event = "E";
public const string EventMarker = "E";

}

Expand Down
8 changes: 4 additions & 4 deletions UnityPackage/Scripts/Parsers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ public static Dictionary<int, int[]> ParseTimeSignaturesFromChartSection(
KeyValuePair<string, string[]>[] section)
{
return section
.Where(item => item.Value[0] == TypeCode.TimeSignature)
.Where(item => item.Value[0] == TypeCode.TimeSignatureMarker)
.Select(item =>
new KeyValuePair<int, int[]>(int.Parse(item.Key), item.Value.Skip(1).Select(int.Parse).ToArray()))
.ToDictionary(item => item.Key, x => x.Value);
Expand All @@ -123,7 +123,7 @@ public static Dictionary<int, int> ParseBpmFromChartSection(
KeyValuePair<string, string[]>[] section)
{
return section
.Where(item => item.Value[0] == TypeCode.BPM)
.Where(item => item.Value[0] == TypeCode.BPM_Marker)
.Select(item => new KeyValuePair<int, int>(int.Parse(item.Key), int.Parse(item.Value.Skip(1).First())))
.OrderBy(item => item.Key)
.ToDictionary(item => item.Key, x => x.Value);
Expand All @@ -132,7 +132,7 @@ public static Dictionary<int, int> ParseBpmFromChartSection(
public static Note[] ParseNotesFromChartSection(KeyValuePair<string, string[]>[] section)
{
return section
.Where(item => item.Value.Length == 3 && item.Value.First() == TypeCode.Note).Select(
.Where(item => item.Value.Length == 3 && item.Value.First() == TypeCode.NoteMarker).Select(
item => new Note
{
Position = int.Parse(item.Key),
Expand All @@ -145,7 +145,7 @@ public static Dictionary<int, string> ParseLyricsFromChartSection(
KeyValuePair<string, string[]>[] section)
{
return section
.Where(item => item.Value.First() == TypeCode.Event)
.Where(item => item.Value.First() == TypeCode.EventMarker)
.Select(
item => new KeyValuePair<int, string>(int.Parse(item.Key),
JSON_VALUE_PATTERN.Matches(item.Value.Skip(1).First()).Select(part => part.Value.Trim('"'))
Expand Down