mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 14:42:56 +08:00
Check equality by ID -> OnlineBeatmapSetID -> Hash -> ReferenceEquals
This commit is contained in:
parent
14c72f85fa
commit
405ab07800
@ -65,10 +65,19 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
public bool Equals(BeatmapSetInfo other)
|
public bool Equals(BeatmapSetInfo other)
|
||||||
{
|
{
|
||||||
if (!OnlineBeatmapSetID.HasValue || !(other?.OnlineBeatmapSetID.HasValue ?? false))
|
if (other == null)
|
||||||
return ReferenceEquals(this, other);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user