mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 21:43:04 +08:00
Use Regex to only care about colors and commas when parsing a color.
This commit is contained in:
parent
89bf811fad
commit
a9f8c2acb8
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using osu.Framework.Logging;
|
||||
using osu.Game.Audio;
|
||||
using osu.Game.Beatmaps.ControlPoints;
|
||||
@ -73,10 +74,12 @@ namespace osu.Game.Beatmaps.Formats
|
||||
|
||||
bool isCombo = pair.Key.StartsWith(@"Combo");
|
||||
|
||||
string[] split = pair.Value.Split(',');
|
||||
line = Regex.Replace(pair.Value, "[^0-9,]", "");
|
||||
|
||||
string[] split = line.Split(',');
|
||||
|
||||
if (split.Length != 3)
|
||||
throw new InvalidOperationException($@"Color specified in incorrect format (should be R,G,B): {pair.Value}");
|
||||
throw new InvalidOperationException($@"Color specified in incorrect format (should be R,G,B): {line}");
|
||||
|
||||
if (!byte.TryParse(split[0], out var r) || !byte.TryParse(split[1], out var g) || !byte.TryParse(split[2], out var b))
|
||||
throw new InvalidOperationException(@"Color must be specified with 8-bit integer components");
|
||||
|
Loading…
Reference in New Issue
Block a user