Skip to content

Commit c9fe48d

Browse files
committed
[F] RSL不再是static的,解决多实例冲突问题
1 parent a9a83a1 commit c9fe48d

6 files changed

Lines changed: 16 additions & 16 deletions

File tree

‎generator/chu/C2sGenerator.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public class C2sGenerator : IGenerator<ChuChart>
1616
return (text, alerts);
1717
}
1818

19-
private static string Serialize(ChuChart chart, List<Alert> alerts)
19+
private string Serialize(ChuChart chart, List<Alert> alerts)
2020
{
2121
chart.Sort();
2222

@@ -68,7 +68,7 @@ private static string Serialize(ChuChart chart, List<Alert> alerts)
6868
return sb.ToString();
6969
}
7070

71-
private static List<string> allowedAirColors = ["DEF", "I"]; // TODO 搞清楚UGC里的'I'颜色,在C2S里,对应的字符串是什么
71+
private static readonly List<string> allowedAirColors = ["DEF", "I"]; // TODO 搞清楚UGC里的'I'颜色,在C2S里,对应的字符串是什么
7272
private static string AirColorTag(ChuNote n)
7373
{
7474
if (allowedAirColors.Contains(n.Tag)) return n.Tag;

‎generator/chu/SusGenerator.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ namespace MuConvert.chu;
66

77
public class SusGenerator : IGenerator<ChuChart>
88
{
9-
private static int RSL = 480 * 4;
9+
private int RSL = 480 * 4;
1010

1111
public (string, List<Alert>) Generate(ChuChart chart)
1212
{
@@ -15,7 +15,7 @@ public class SusGenerator : IGenerator<ChuChart>
1515
return (text, alerts);
1616
}
1717

18-
private static string Serialize(ChuChart sus)
18+
private string Serialize(ChuChart sus)
1919
{
2020
sus.Sort();
2121

‎generator/chu/UgcGenerator.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace MuConvert.chu;
77

88
public class UgcGenerator : IGenerator<ChuChart>
99
{
10-
private static int RSL = 480 * 4;
10+
private int RSL = 480 * 4;
1111

1212
public (string, List<Alert>) Generate(ChuChart chart)
1313
{
@@ -16,7 +16,7 @@ public class UgcGenerator : IGenerator<ChuChart>
1616
return (text, alerts);
1717
}
1818

19-
private static string Serialize(ChuChart ugc, List<Alert> alerts)
19+
private string Serialize(ChuChart ugc, List<Alert> alerts)
2020
{
2121
ugc.Sort();
2222

‎parser/chu/C2sParser.cs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace MuConvert.chu;
1313
*/
1414
public class C2sParser: BaseChuParser
1515
{
16-
private static int RSL = 384;
16+
private int RSL = 384;
1717
private static readonly HashSet<string> HeadTags = new(StringComparer.OrdinalIgnoreCase)
1818
{ "VERSION", "MUSIC", "SEQUENCEID", "DIFFICULT", "LEVEL", "CREATOR", "BPM_DEF", "MET_DEF", "RESOLUTION", "CLK_DEF", "PROGJUDGE_BPM", "PROGJUDGE_AER", "TUTORIAL" };
1919
private static readonly HashSet<string> TimingTags = new(StringComparer.OrdinalIgnoreCase)
@@ -59,7 +59,7 @@ public override (ChuChart, List<Alert>) Parse(string text)
5959
return (chart, alerts);
6060
}
6161

62-
private static void ParseHeader(string[] p, ChuChart chart)
62+
private void ParseHeader(string[] p, ChuChart chart)
6363
{
6464
var tag = p[0].ToUpperInvariant();
6565
switch (tag)
@@ -71,7 +71,7 @@ private static void ParseHeader(string[] p, ChuChart chart)
7171
}
7272
}
7373

74-
private static void ParseTiming(string[] p, ChuChart chart)
74+
private void ParseTiming(string[] p, ChuChart chart)
7575
{
7676
var tag = p[0].ToUpperInvariant();
7777
switch (tag)

‎parser/chu/SusParser.cs‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ namespace MuConvert.chu;
1313
*/
1414
public class SusParser: BaseChuParser
1515
{
16-
private static int RSL = 480 * 4;
16+
private int RSL = 480 * 4;
1717

1818
private static readonly Dictionary<int, string> TypeMap = new()
1919
{
@@ -71,7 +71,7 @@ private static bool IsHeaderLine(string content)
7171
|| content.StartsWith("REQUEST ");
7272
}
7373

74-
private static void ParseHeaderLine(string content, ChuChart chart, List<Alert> alerts, int lineNum)
74+
private void ParseHeaderLine(string content, ChuChart chart, List<Alert> alerts, int lineNum)
7575
{
7676
if (content.StartsWith("TITLE "))
7777
{
@@ -103,7 +103,7 @@ private static void ParseHeaderLine(string content, ChuChart chart, List<Alert>
103103
}
104104
}
105105

106-
private static void ParseNoteLine(string content, ChuChart chart, List<Alert> alerts, int lineNum)
106+
private void ParseNoteLine(string content, ChuChart chart, List<Alert> alerts, int lineNum)
107107
{
108108
var colonIdx = content.IndexOf(':');
109109
if (colonIdx < 0)

‎parser/chu/UgcParser.cs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ namespace MuConvert.chu;
1414
*/
1515
public class UgcParser: BaseChuParser
1616
{
17-
private static int RSL = 480 * 4;
17+
private int RSL = 480 * 4;
1818
private int Version = 8;
1919

2020
public override (ChuChart, List<Alert>) Parse(string text)
@@ -332,7 +332,7 @@ private int ParseNoteLine(string[] lines, int idx, ChuChart chart, List<Alert> a
332332
return idx;
333333
}
334334

335-
private static void ParseTapNote(string code, ChuNote note, List<Alert> alerts, int lineNum, ChuChart chart, bool isCHR)
335+
private void ParseTapNote(string code, ChuNote note, List<Alert> alerts, int lineNum, ChuChart chart, bool isCHR)
336336
{
337337
note.Type = "TAP";
338338
ParseCellWidth(code, 1, note, alerts, lineNum, chart);
@@ -488,7 +488,7 @@ private static bool TryParseFollowerLine(string line, out string marker, out int
488488
return true;
489489
}
490490

491-
private static void ParseCellWidth(string code, int startIdx, ChuNote note, List<Alert> alerts, int lineNum, ChuChart chart)
491+
private void ParseCellWidth(string code, int startIdx, ChuNote note, List<Alert> alerts, int lineNum, ChuChart chart)
492492
{
493493
if (code.Length > startIdx)
494494
{
@@ -579,7 +579,7 @@ private int ParseAirCrushNote(string[] lines, int idx, string code, ChuNote note
579579
}
580580

581581
// ReSharper disable once UnusedParameter.Local
582-
private static string FormatNoteRef(ChuNote note, string code)
582+
private string FormatNoteRef(ChuNote note, string code)
583583
{
584584
var (m, o) = Utils.BarAndTick(note.Time, RSL);
585585
return $"#{m}'{o}:{code}";

0 commit comments

Comments
 (0)