1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 18:52:55 +08:00

Don't trim whitespace from variable keys / values

This commit is contained in:
Dean Herbert 2022-11-08 13:30:11 +09:00
parent b764d1bd04
commit 064a245c50
2 changed files with 10 additions and 4 deletions

View File

@ -130,14 +130,20 @@ namespace osu.Game.Beatmaps.Formats
}
}
protected KeyValuePair<string, string> SplitKeyVal(string line, char separator = ':')
protected KeyValuePair<string, string> SplitKeyVal(string line, char separator = ':', bool shouldTrim = true)
{
string[] split = line.Split(separator, 2);
if (shouldTrim)
{
for (int i = 0; i < split.Length; i++)
split[i] = split[i].Trim();
}
return new KeyValuePair<string, string>
(
split[0].Trim(),
split.Length > 1 ? split[1].Trim() : string.Empty
split[0],
split.Length > 1 ? split[1] : string.Empty
);
}

View File

@ -349,7 +349,7 @@ namespace osu.Game.Beatmaps.Formats
private void handleVariables(string line)
{
var pair = SplitKeyVal(line, '=');
var pair = SplitKeyVal(line, '=', false);
variables[pair.Key] = pair.Value;
}