mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 10:33:07 +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)
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user