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

Merge pull request #3308 from smoogipoo/decoder-logging

Log the format line when a decoder isn't found
This commit is contained in:
Dan Balasescu 2018-08-24 10:45:17 +09:00 committed by GitHub
commit 0802dbdce5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -55,11 +55,11 @@ namespace osu.Game.Beatmaps.Formats
} while (line != null && line.Length == 0);
if (line == null)
throw new IOException(@"Unknown file format");
throw new IOException(@"Unknown file format (null)");
var decoder = typedDecoders.Select(d => line.StartsWith(d.Key) ? d.Value : null).FirstOrDefault();
var decoder = typedDecoders.Select(d => line.StartsWith(d.Key, StringComparison.InvariantCulture) ? d.Value : null).FirstOrDefault();
if (decoder == null)
throw new IOException(@"Unknown file format");
throw new IOException($@"Unknown file format ({line})");
return (Decoder<T>)decoder.Invoke(line);
}