Skip to content

Commit d580e85

Browse files
committed
[F] 修一些小问题
1 parent b54b7e9 commit d580e85

3 files changed

Lines changed: 7 additions & 6 deletions

File tree

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,13 +160,13 @@ return maidataText; // maidataText即为转谱结果
160160
var (c2sChart, alerts) = new C2sParser().Parse(c2sText); // 解析 C2S 谱面字符串
161161
var (ugcChart, alerts) = new UgcParser().Parse(ugcText); // 解析 UGC 谱面字符串
162162
var (susChart, alerts) = new SusParser().Parse(susText); // 解析 SUS 谱面字符串
163-
// 以上得到的c2sChart、ugcChart、susChart,都是IChuChart类型的谱面表示对象
163+
// 以上得到的c2sChart、ugcChart、susChart,都是ChuChart类型的谱面表示对象
164164
// alerts是解析过程中可能产生的警告信息等,建议打印出来。
165165

166166
var (c2sText, alerts) = new C2sGenerator().Generate(ugcChart); // UGC -> C2S
167167
var (ugcText, alerts) = new UgcGenerator().Generate(c2sChart); // C2S -> UGC
168168
var (susText, alerts) = new SusGenerator().Generate(c2sChart); // C2S -> SUS
169-
// 各种Generator的Generate方法,均接受任意的IChuChart对象
169+
// 各种Generator的Generate方法,均接受 ChuChart(可将任一 Parser 产出的 ChuChart 互相传入)
170170
// 同上,alerts是生成过程中可能产生的警告信息等,建议打印出来。
171171
```
172172

parser/chu/C2sParser.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ private static void ParseTiming(string[] p, ChuChart chart)
7676
switch (tag)
7777
{
7878
case "BPM":
79-
chart.BpmList.Add(new BPM(Int(p, 1) + new Rational(Int(p, 2), RSL), decimal.Parse(p[3])));
79+
chart.BpmList.Add(new BPM(Int(p, 1) + new Rational(Int(p, 2), RSL),
80+
decimal.Parse(p[3], CultureInfo.InvariantCulture)));
8081
break;
8182
case "MET":
8283
chart.MetList.Add(new MET(Int(p, 1) + new Rational(Int(p, 2), RSL), Int(p, 4, 4), Int(p, 3, 4)));
@@ -85,7 +86,7 @@ private static void ParseTiming(string[] p, ChuChart chart)
8586
chart.SflList.Add((
8687
Int(p, 1) + new Rational(Int(p, 2), RSL),
8788
new Rational(Int(p, 3), RSL),
88-
decimal.Parse(p[4])));
89+
decimal.Parse(p[4], CultureInfo.InvariantCulture)));
8990
break;
9091
}
9192
}

parser/chu/UgcParser.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ private static int ParseHoldNote(bool isAirHold, string[] lines, int idx, string
358358
if (isAirHold)
359359
{
360360
var colorChar = code.Last(); // 颜色标记 N/I
361-
note.Tag = AirColor[colorChar.ToString()];
361+
note.Tag = AirColor.GetValueOrDefault(colorChar.ToString(), "");
362362
}
363363

364364
bool foundFirst = false;
@@ -394,7 +394,7 @@ private static int ParseSlideNote(bool isAirSlide, string[] lines, int idx, stri
394394
if (isAirSlide)
395395
{
396396
var colorChar = code.Last(); // 颜色标记 N/I
397-
colorTag = AirColor[colorChar.ToString()];
397+
colorTag = AirColor.GetValueOrDefault(colorChar.ToString(), "");
398398
// 解析高度数据。目前只解析、不使用。
399399
TryParseUgcBase36Int2(code.AsSpan(3, code.Length - 4), out _); // out var startHeight 起始的高度值
400400
}

0 commit comments

Comments
 (0)