diff --git a/osu.Game.Tests/Beatmaps/Formats/OsuJsonDecoderTest.cs b/osu.Game.Tests/Beatmaps/Formats/OsuJsonDecoderTest.cs index 5a66a7047d..7886383725 100644 --- a/osu.Game.Tests/Beatmaps/Formats/OsuJsonDecoderTest.cs +++ b/osu.Game.Tests/Beatmaps/Formats/OsuJsonDecoderTest.cs @@ -158,8 +158,8 @@ namespace osu.Game.Tests.Beatmaps.Formats using (var stream = Resource.OpenResource(filename)) using (var sr = new StreamReader(stream)) { - var legacyDecoded = new OsuLegacyDecoder().Decode(sr); + var legacyDecoded = new LegacyBeatmapDecoder().DecodeBeatmap(sr); using (var ms = new MemoryStream()) using (var sw = new StreamWriter(ms)) using (var sr2 = new StreamReader(ms)) @@ -168,7 +168,7 @@ namespace osu.Game.Tests.Beatmaps.Formats sw.Flush(); ms.Position = 0; - return (legacyDecoded, new OsuJsonDecoder().Decode(sr2)); + return (legacyDecoded, new OsuJsonDecoder().DecodeBeatmap(sr2)); } } } diff --git a/osu.Game/Beatmaps/Formats/OsuJsonDecoder.cs b/osu.Game/Beatmaps/Formats/OsuJsonDecoder.cs index d00cbbb8fb..e2d7414013 100644 --- a/osu.Game/Beatmaps/Formats/OsuJsonDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuJsonDecoder.cs @@ -3,34 +3,33 @@ using System.IO; using osu.Game.IO.Serialization; +using osu.Game.Storyboards; namespace osu.Game.Beatmaps.Formats { - public class OsuJsonDecoder : BeatmapDecoder + public class OsuJsonDecoder : Decoder { public static void Register() { AddDecoder("{"); } - protected override void ParseFile(StreamReader stream, Beatmap beatmap) + public override Decoder GetStoryboardDecoder() => this; + + protected override void ParseBeatmap(StreamReader stream, Beatmap beatmap) { stream.BaseStream.Position = 0; stream.DiscardBufferedData(); - try - { - string fullText = stream.ReadToEnd(); - fullText.DeserializeInto(beatmap); - } - catch - { - // Temporary because storyboards are deserialized into beatmaps at the moment - // This try-catch shouldn't exist in the future - } + stream.ReadToEnd().DeserializeInto(beatmap); foreach (var hitObject in beatmap.HitObjects) hitObject.ApplyDefaults(beatmap.ControlPointInfo, beatmap.BeatmapInfo.BaseDifficulty); } + + protected override void ParseStoryboard(StreamReader stream, Storyboard storyboard) + { + // throw new System.NotImplementedException(); + } } }