Update pointless `CompareTo` implementation once again

This commit is contained in:
Salman Ahmed 2022-02-11 04:01:10 +03:00
parent 9574bc1382
commit 1b729e891d
1 changed files with 10 additions and 2 deletions

View File

@ -11,7 +11,7 @@ namespace osu.Game.Rulesets
{ {
[ExcludeFromDynamicCompile] [ExcludeFromDynamicCompile]
[Table(@"RulesetInfo")] [Table(@"RulesetInfo")]
public sealed class EFRulesetInfo : IEquatable<EFRulesetInfo>, IRulesetInfo public sealed class EFRulesetInfo : IEquatable<EFRulesetInfo>, IComparable<EFRulesetInfo>, IRulesetInfo
{ {
public int? ID { get; set; } public int? ID { get; set; }
@ -42,7 +42,15 @@ public Ruleset CreateInstance()
public bool Equals(EFRulesetInfo other) => other != null && ID == other.ID && Available == other.Available && Name == other.Name && InstantiationInfo == other.InstantiationInfo; public bool Equals(EFRulesetInfo other) => other != null && ID == other.ID && Available == other.Available && Name == other.Name && InstantiationInfo == other.InstantiationInfo;
public int CompareTo(RulesetInfo other) => OnlineID.CompareTo(other.OnlineID); public int CompareTo(EFRulesetInfo other) => OnlineID.CompareTo(other.OnlineID);
public int CompareTo(IRulesetInfo other)
{
if (!(other is EFRulesetInfo ruleset))
throw new ArgumentException($@"Object is not of type {nameof(EFRulesetInfo)}.", nameof(other));
return CompareTo(ruleset);
}
public override bool Equals(object obj) => obj is EFRulesetInfo rulesetInfo && Equals(rulesetInfo); public override bool Equals(object obj) => obj is EFRulesetInfo rulesetInfo && Equals(rulesetInfo);