1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 20:07:25 +08:00

Check equality by ID -> OnlineBeatmapSetID -> Hash -> ReferenceEquals

This commit is contained in:
iiSaLMaN 2019-10-17 01:18:29 +03:00
parent 14c72f85fa
commit 405ab07800

View File

@ -65,10 +65,19 @@ namespace osu.Game.Beatmaps
public bool Equals(BeatmapSetInfo other)
{
if (!OnlineBeatmapSetID.HasValue || !(other?.OnlineBeatmapSetID.HasValue ?? false))
return ReferenceEquals(this, other);
if (other == null)
return false;
return OnlineBeatmapSetID == other.OnlineBeatmapSetID;
if (ID != 0 && other.ID != 0)
return ID == other.ID;
if (OnlineBeatmapSetID.HasValue && other.OnlineBeatmapSetID.HasValue)
return OnlineBeatmapSetID == other.OnlineBeatmapSetID;
if (!string.IsNullOrEmpty(Hash) && !string.IsNullOrEmpty(other.Hash))
return Hash == other.Hash;
return ReferenceEquals(this, other);
}
}
}