osu/osu.Game/Beatmaps/Formats/JsonBeatmapDecoder.cs

25 lines
751 B
C#
Raw Normal View History

// 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.
2018-04-13 09:19:50 +00:00
using osu.Game.IO;
2018-04-13 09:19:50 +00:00
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)
2018-04-13 09:19:50 +00:00
{
stream.ReadToEnd().DeserializeInto(output);
2018-04-13 09:19:50 +00:00
foreach (var hitObject in output.HitObjects)
hitObject.ApplyDefaults(output.ControlPointInfo, output.Difficulty);
2018-04-13 09:19:50 +00:00
}
}
}