2018-04-13 09:19:50 +00:00
|
|
|
|
// 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());
|
|
|
|
|
}
|
|
|
|
|
|
2018-04-20 09:32:24 +00:00
|
|
|
|
protected override void ParseStreamInto(StreamReader stream, Beatmap output)
|
2018-04-13 09:19:50 +00:00
|
|
|
|
{
|
|
|
|
|
stream.BaseStream.Position = 0;
|
|
|
|
|
stream.DiscardBufferedData();
|
|
|
|
|
|
2018-04-20 09:32:24 +00:00
|
|
|
|
stream.ReadToEnd().DeserializeInto(output);
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2018-04-20 09:32:24 +00:00
|
|
|
|
foreach (var hitObject in output.HitObjects)
|
|
|
|
|
hitObject.ApplyDefaults(output.ControlPointInfo, output.BeatmapInfo.BaseDifficulty);
|
2018-04-13 09:19:50 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|