diff --git a/osu.Game/Beatmaps/Beatmap.cs b/osu.Game/Beatmaps/Beatmap.cs index fc8bb751f9..feeaa5617a 100644 --- a/osu.Game/Beatmaps/Beatmap.cs +++ b/osu.Game/Beatmaps/Beatmap.cs @@ -70,5 +70,14 @@ namespace osu.Game.Beatmaps /// /// The star difficulty. public double CalculateStarDifficulty() => Ruleset.GetRuleset(BeatmapInfo.Mode).CreateDifficultyCalculator(this).Calculate(); + + /// + /// Constructs a new beatmap. + /// + /// The original beatmap to use the parameters of. + public Beatmap(Beatmap original = null) + : base(original) + { + } } } diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index e7ede36b4b..979156ac96 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -10,6 +10,7 @@ using osu.Game.Beatmaps.Samples; using osu.Game.Beatmaps.Timing; using osu.Game.Modes; using osu.Game.Modes.Objects; +using osu.Game.Beatmaps.Legacy; namespace osu.Game.Beatmaps.Formats { @@ -242,6 +243,16 @@ namespace osu.Game.Beatmaps.Formats } } + protected override Beatmap ParseFile(TextReader stream) + { + return new LegacyBeatmap(base.ParseFile(stream)); + } + + public override Beatmap Decode(TextReader stream) + { + return new LegacyBeatmap(base.Decode(stream)); + } + protected override void ParseFile(TextReader stream, Beatmap beatmap) { HitObjectParser parser = null; diff --git a/osu.Game/Beatmaps/Legacy/IIsLegacy.cs b/osu.Game/Beatmaps/Legacy/IIsLegacy.cs new file mode 100644 index 0000000000..23ab9f4bc4 --- /dev/null +++ b/osu.Game/Beatmaps/Legacy/IIsLegacy.cs @@ -0,0 +1,9 @@ +namespace osu.Game.Beatmaps.Legacy +{ + /// + /// A Beatmap that was loaded from a legacy .osu beatmap file (version <=15). + /// + public interface IIsLegacy + { + } +} diff --git a/osu.Game/Beatmaps/Legacy/LegacyBeatmap.cs b/osu.Game/Beatmaps/Legacy/LegacyBeatmap.cs new file mode 100644 index 0000000000..00aeeb2b49 --- /dev/null +++ b/osu.Game/Beatmaps/Legacy/LegacyBeatmap.cs @@ -0,0 +1,17 @@ +namespace osu.Game.Beatmaps.Legacy +{ + /// + /// A type of Beatmap loaded from a legacy .osu beatmap file (version <=15). + /// + internal class LegacyBeatmap : Beatmap, IIsLegacy + { + /// + /// Constructs a new beatmap. + /// + /// The original beatmap to use the parameters of. + public LegacyBeatmap(Beatmap original = null) + : base(original) + { + } + } +} diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj index 80d5c906e0..c0f11dbcb9 100644 --- a/osu.Game/osu.Game.csproj +++ b/osu.Game/osu.Game.csproj @@ -75,7 +75,9 @@ + +