diff --git a/osu.Game/Beatmaps/BeatmapInfo.cs b/osu.Game/Beatmaps/BeatmapInfo.cs index 0b234b3c2d..6f45f5ec71 100644 --- a/osu.Game/Beatmaps/BeatmapInfo.cs +++ b/osu.Game/Beatmaps/BeatmapInfo.cs @@ -163,20 +163,6 @@ namespace osu.Game.Beatmaps return false; } - public bool Equals(IBeatmapInfo other) - { - if (ReferenceEquals(this, other)) return true; - if (other == null) return false; - - if (other is BeatmapInfo b && Equals(b)) - return true; - - if (OnlineID > 0 && other.OnlineID > 0) - return other.OnlineID == OnlineID; - - return false; - } - public bool AudioEquals(BeatmapInfo other) => other != null && BeatmapSet != null && other.BeatmapSet != null && BeatmapSet.Hash == other.BeatmapSet.Hash && (Metadata ?? BeatmapSet.Metadata).AudioFile == (other.Metadata ?? other.BeatmapSet.Metadata).AudioFile; diff --git a/osu.Game/Beatmaps/BeatmapSetInfo.cs b/osu.Game/Beatmaps/BeatmapSetInfo.cs index fa314fe400..6dd8cc5ade 100644 --- a/osu.Game/Beatmaps/BeatmapSetInfo.cs +++ b/osu.Game/Beatmaps/BeatmapSetInfo.cs @@ -78,20 +78,6 @@ namespace osu.Game.Beatmaps return false; } - public bool Equals(IBeatmapSetInfo other) - { - if (ReferenceEquals(this, other)) return true; - if (other == null) return false; - - if (other is BeatmapSetInfo b && Equals(b)) - return true; - - if (OnlineID > 0 && other.OnlineID > 0) - return other.OnlineID == OnlineID; - - return false; - } - #region Implementation of IHasOnlineID int IHasOnlineID.OnlineID => OnlineID ?? -1; diff --git a/osu.Game/Beatmaps/IBeatmapInfo.cs b/osu.Game/Beatmaps/IBeatmapInfo.cs index ab096b8897..84ea6d3019 100644 --- a/osu.Game/Beatmaps/IBeatmapInfo.cs +++ b/osu.Game/Beatmaps/IBeatmapInfo.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System; using osu.Game.Database; using osu.Game.Rulesets; @@ -12,7 +11,7 @@ namespace osu.Game.Beatmaps /// /// A single beatmap difficulty. /// - public interface IBeatmapInfo : IHasOnlineID, IEquatable + public interface IBeatmapInfo : IHasOnlineID { /// /// The user-specified name given to this beatmap. diff --git a/osu.Game/Beatmaps/IBeatmapSetInfo.cs b/osu.Game/Beatmaps/IBeatmapSetInfo.cs index 67f38397d4..20c46d9063 100644 --- a/osu.Game/Beatmaps/IBeatmapSetInfo.cs +++ b/osu.Game/Beatmaps/IBeatmapSetInfo.cs @@ -12,7 +12,7 @@ namespace osu.Game.Beatmaps /// /// A representation of a collection of beatmap difficulties, generally packaged as an ".osz" archive. /// - public interface IBeatmapSetInfo : IHasOnlineID, IEquatable + public interface IBeatmapSetInfo : IHasOnlineID { /// /// The date when this beatmap was imported. diff --git a/osu.Game/Models/RealmBeatmap.cs b/osu.Game/Models/RealmBeatmap.cs index f80d1f513a..2a197d296a 100644 --- a/osu.Game/Models/RealmBeatmap.cs +++ b/osu.Game/Models/RealmBeatmap.cs @@ -106,27 +106,6 @@ namespace osu.Game.Models return ID == other.ID; } - #region Implementation of IEquatable - - public bool Equals(IBeatmapInfo? other) - { - if (ReferenceEquals(this, other)) return true; - if (other == null) return false; - - if (other is RealmBeatmap b && Equals(b)) - return true; - - if (!string.IsNullOrEmpty(Hash) && !string.IsNullOrEmpty(other.Hash)) - return Hash == other.Hash; - - if (OnlineID > 0 && other.OnlineID > 0) - return other.OnlineID == OnlineID; - - return false; - } - - #endregion - public bool AudioEquals(RealmBeatmap? other) => other != null && BeatmapSet != null && other.BeatmapSet != null diff --git a/osu.Game/Models/RealmBeatmapSet.cs b/osu.Game/Models/RealmBeatmapSet.cs index 9cfa2de44d..1747cce67a 100644 --- a/osu.Game/Models/RealmBeatmapSet.cs +++ b/osu.Game/Models/RealmBeatmapSet.cs @@ -7,6 +7,7 @@ using System.Linq; using osu.Framework.Testing; using osu.Game.Beatmaps; using osu.Game.Database; +using osu.Game.Extensions; using Realms; #nullable enable @@ -61,21 +62,7 @@ namespace osu.Game.Models return ID == other.ID; } - public bool Equals(IBeatmapSetInfo? other) - { - if (ReferenceEquals(this, other)) return true; - if (other == null) return false; - - if (other is RealmBeatmapSet b && Equals(b)) - return true; - - if (OnlineID > 0 && other.OnlineID > 0) - return OnlineID == other.OnlineID; - - return false; - } - - public override string ToString() => Metadata?.ToString() ?? base.ToString(); + public override string ToString() => Metadata?.GetDisplayString() ?? base.ToString(); IEnumerable IBeatmapSetInfo.Beatmaps => Beatmaps;