mirror of
https://github.com/ppy/osu.git
synced 2024-12-30 13:32:55 +08:00
11eda44d34
Migrate all usages of StreamReader in the context of decoding beatmaps, storyboards or skins to the new LineBufferedReader.
25 lines
767 B
C#
25 lines
767 B
C#
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
using osu.Game.IO;
|
|
using osu.Game.IO.Serialization;
|
|
|
|
namespace osu.Game.Beatmaps.Formats
|
|
{
|
|
public class JsonBeatmapDecoder : Decoder<Beatmap>
|
|
{
|
|
public static void Register()
|
|
{
|
|
AddDecoder<Beatmap>("{", m => new JsonBeatmapDecoder());
|
|
}
|
|
|
|
protected override void ParseStreamInto(LineBufferedReader stream, Beatmap output)
|
|
{
|
|
stream.ReadToEnd().DeserializeInto(output);
|
|
|
|
foreach (var hitObject in output.HitObjects)
|
|
hitObject.ApplyDefaults(output.ControlPointInfo, output.BeatmapInfo.BaseDifficulty);
|
|
}
|
|
}
|
|
}
|