mirror of
https://github.com/osukey/osukey.git
synced 2025-08-03 22:56:36 +09:00
Minor cleanups for legacy beatmap decoders
Replaces some string.StartsWith(string, StringComparison.Ordinal) calls with ring.StartsWith(char) , when only one char is compared. Possible since .NET-Standard 2.1 And another LegacyStoryboardDecoder.handleEvents() cleanup, saves some MB of allocations.
This commit is contained in:
@ -64,15 +64,16 @@ namespace osu.Game.Beatmaps.Formats
|
||||
private void handleEvents(string line)
|
||||
{
|
||||
var depth = 0;
|
||||
var lineSpan = line.AsSpan();
|
||||
|
||||
while (lineSpan.StartsWith(" ", StringComparison.Ordinal) || lineSpan.StartsWith("_", StringComparison.Ordinal))
|
||||
foreach (char c in line)
|
||||
{
|
||||
lineSpan = lineSpan.Slice(1);
|
||||
++depth;
|
||||
if (c == ' ' || c == '_')
|
||||
depth++;
|
||||
else
|
||||
break;
|
||||
}
|
||||
|
||||
line = lineSpan.ToString();
|
||||
line = line.Substring(depth);
|
||||
|
||||
decodeVariables(ref line);
|
||||
|
||||
|
Reference in New Issue
Block a user