2019-01-24 08:43:03 +00:00
|
|
|
|
// 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
|
|
|
|
|
2022-06-17 07:37:17 +00:00
|
|
|
|
#nullable disable
|
|
|
|
|
|
2019-09-09 22:43:30 +00:00
|
|
|
|
using osu.Game.IO;
|
2017-12-05 15:38:12 +00:00
|
|
|
|
using osu.Game.IO.Serialization;
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2017-12-05 15:38:12 +00:00
|
|
|
|
namespace osu.Game.Beatmaps.Formats
|
|
|
|
|
{
|
2018-03-09 12:23:03 +00:00
|
|
|
|
public class JsonBeatmapDecoder : Decoder<Beatmap>
|
2017-12-05 15:38:12 +00:00
|
|
|
|
{
|
|
|
|
|
public static void Register()
|
|
|
|
|
{
|
2022-06-24 12:25:23 +00:00
|
|
|
|
AddDecoder<Beatmap>("{", _ => new JsonBeatmapDecoder());
|
2017-12-05 15:38:12 +00:00
|
|
|
|
}
|
2018-04-13 09:19:50 +00:00
|
|
|
|
|
2019-09-09 22:43:30 +00:00
|
|
|
|
protected override void ParseStreamInto(LineBufferedReader stream, Beatmap output)
|
2017-12-05 15:38:12 +00:00
|
|
|
|
{
|
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)
|
2021-10-02 03:34:29 +00:00
|
|
|
|
hitObject.ApplyDefaults(output.ControlPointInfo, output.Difficulty);
|
2017-12-05 15:38:12 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|