mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-01 06:00:46 +00:00
Code review
This commit is contained in:
@@ -23,7 +23,6 @@ using System;
|
|||||||
using System.Collections.Concurrent;
|
using System.Collections.Concurrent;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Collections.Immutable;
|
using System.Collections.Immutable;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using System.Globalization;
|
using System.Globalization;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Net;
|
using System.Net;
|
||||||
@@ -1075,11 +1074,9 @@ namespace ArchiSteamFarm {
|
|||||||
PlayableAppID = appID;
|
PlayableAppID = appID;
|
||||||
}
|
}
|
||||||
|
|
||||||
[SuppressMessage("ReSharper", "PossibleUnintendedReferenceComparison")]
|
public bool Equals(Game other) => (other != null) && (ReferenceEquals(other, this) || ((AppID == other.AppID) && (BadgeLevel == other.BadgeLevel) && (GameName == other.GameName)));
|
||||||
public bool Equals(Game other) => (other != null) && ((other == this) || (AppID == other.AppID));
|
|
||||||
|
|
||||||
public override bool Equals(object obj) => (obj != null) && ((obj == this) || (obj is Game game && Equals(game)));
|
public override bool Equals(object obj) => (obj != null) && ((obj == this) || (obj is Game game && Equals(game)));
|
||||||
public override int GetHashCode() => (int) (AppID - 1 - int.MaxValue);
|
public override int GetHashCode() => RuntimeCompatibility.HashCode.Combine(AppID, BadgeLevel, GameName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -22,7 +22,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
|
|
||||||
namespace ArchiSteamFarm.Collections {
|
namespace ArchiSteamFarm.Collections {
|
||||||
@@ -198,9 +197,7 @@ namespace ArchiSteamFarm.Collections {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[SuppressMessage("ReSharper", "AssignNullToNotNullAttribute")]
|
|
||||||
void ICollection<T>.Add(T item) => Add(item);
|
void ICollection<T>.Add(T item) => Add(item);
|
||||||
|
|
||||||
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
|
||||||
|
|
||||||
internal void ReplaceWith(IEnumerable<T> other) {
|
internal void ReplaceWith(IEnumerable<T> other) {
|
||||||
|
|||||||
@@ -83,6 +83,15 @@ namespace ArchiSteamFarm {
|
|||||||
}
|
}
|
||||||
#pragma warning restore 1998
|
#pragma warning restore 1998
|
||||||
|
|
||||||
|
internal static class HashCode {
|
||||||
|
internal static int Combine<T1, T2, T3>(T1 value1, T2 value2, T3 value3) =>
|
||||||
|
#if NETFRAMEWORK
|
||||||
|
(value1, value2, value3).GetHashCode();
|
||||||
|
#else
|
||||||
|
System.HashCode.Combine(value1, value2, value3);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
internal static class Path {
|
internal static class Path {
|
||||||
internal static string GetRelativePath(string relativeTo, string path) {
|
internal static string GetRelativePath(string relativeTo, string path) {
|
||||||
#if NETFRAMEWORK
|
#if NETFRAMEWORK
|
||||||
|
|||||||
Reference in New Issue
Block a user