1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 13:27:23 +08:00
osu-lazer/osu.Game/Beatmaps/Formats/JsonBeatmapDecoder.cs
2018-04-20 18:32:24 +09:00

28 lines
847 B
C#

// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.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(StreamReader stream, Beatmap output)
{
stream.BaseStream.Position = 0;
stream.DiscardBufferedData();
stream.ReadToEnd().DeserializeInto(output);
foreach (var hitObject in output.HitObjects)
hitObject.ApplyDefaults(output.ControlPointInfo, output.BeatmapInfo.BaseDifficulty);
}
}
}