R# cleanup

This commit is contained in:
JustArchi
2019-10-13 17:21:40 +02:00
parent 0a6392cd2b
commit a0dfb28e59
15 changed files with 84 additions and 71 deletions

View File

@@ -20,6 +20,7 @@
// limitations under the License.
using System;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using JetBrains.Annotations;
using Newtonsoft.Json;
@@ -32,7 +33,7 @@ namespace ArchiSteamFarm.CustomPlugins.ExamplePlugin {
private const string URL = "https://aws.random.cat";
[ItemCanBeNull]
internal static async Task<string> GetRandomCatURL([NotNull] WebBrowser webBrowser) {
internal static async Task<string> GetRandomCatURL([JetBrains.Annotations.NotNull] WebBrowser webBrowser) {
const string request = URL + "/meow";
WebBrowser.ObjectResponse<MeowResponse> response = await webBrowser.UrlGetToJsonObject<MeowResponse>(request).ConfigureAwait(false);
@@ -50,7 +51,7 @@ namespace ArchiSteamFarm.CustomPlugins.ExamplePlugin {
return Uri.EscapeUriString(response.Content.Link);
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
[SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
private sealed class MeowResponse {
#pragma warning disable 649
[JsonProperty(PropertyName = "file", Required = Required.Always)]

View File

@@ -21,6 +21,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
@@ -44,7 +45,7 @@ namespace ArchiSteamFarm {
private bool ProcessingGiftsScheduled;
private bool TradingScheduled;
internal Actions([NotNull] Bot bot) => Bot = bot ?? throw new ArgumentNullException(nameof(bot));
internal Actions([JetBrains.Annotations.NotNull] Bot bot) => Bot = bot ?? throw new ArgumentNullException(nameof(bot));
public void Dispose() {
// Those are objects that are always being created if constructor doesn't throw exception
@@ -232,7 +233,7 @@ namespace ArchiSteamFarm {
}
[PublicAPI]
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "FunctionComplexityOverflow")]
[SuppressMessage("ReSharper", "FunctionComplexityOverflow")]
public async Task<(bool Success, string Message)> SendTradeOffer(uint appID = Steam.Asset.SteamAppID, ulong contextID = Steam.Asset.SteamCommunityContextID, ulong targetSteamID = 0, string tradeToken = null, IReadOnlyCollection<uint> wantedRealAppIDs = null, IReadOnlyCollection<Steam.Asset.EType> wantedTypes = null) {
if ((appID == 0) || (contextID == 0)) {
Bot.ArchiLogger.LogNullError(nameof(appID) + " || " + nameof(contextID));

View File

@@ -21,6 +21,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Net;
@@ -46,7 +47,7 @@ namespace ArchiSteamFarm {
internal DateTime LastPacketReceived { get; private set; }
internal ArchiHandler([NotNull] ArchiLogger archiLogger, [NotNull] SteamUnifiedMessages steamUnifiedMessages) {
internal ArchiHandler([JetBrains.Annotations.NotNull] ArchiLogger archiLogger, [JetBrains.Annotations.NotNull] SteamUnifiedMessages steamUnifiedMessages) {
if ((archiLogger == null) || (steamUnifiedMessages == null)) {
throw new ArgumentNullException(nameof(archiLogger) + " || " + nameof(steamUnifiedMessages));
}
@@ -705,7 +706,7 @@ namespace ArchiSteamFarm {
Client.PostCallback(new VanityURLChangedCallback(packetMsg.TargetJobID, response.Body));
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "MemberCanBeInternal")]
[SuppressMessage("ReSharper", "MemberCanBeInternal")]
public sealed class PurchaseResponseCallback : CallbackMsg {
public readonly Dictionary<uint, string> Items;
@@ -721,7 +722,7 @@ namespace ArchiSteamFarm {
PurchaseResultDetail = purchaseResult;
}
internal PurchaseResponseCallback([NotNull] JobID jobID, [NotNull] CMsgClientPurchaseResponse msg) {
internal PurchaseResponseCallback([JetBrains.Annotations.NotNull] JobID jobID, [JetBrains.Annotations.NotNull] CMsgClientPurchaseResponse msg) {
if ((jobID == null) || (msg == null)) {
throw new ArgumentNullException(nameof(jobID) + " || " + nameof(msg));
}
@@ -787,7 +788,7 @@ namespace ArchiSteamFarm {
internal sealed class PlayingSessionStateCallback : CallbackMsg {
internal readonly bool PlayingBlocked;
internal PlayingSessionStateCallback([NotNull] JobID jobID, [NotNull] CMsgClientPlayingSessionState msg) {
internal PlayingSessionStateCallback([JetBrains.Annotations.NotNull] JobID jobID, [JetBrains.Annotations.NotNull] CMsgClientPlayingSessionState msg) {
if ((jobID == null) || (msg == null)) {
throw new ArgumentNullException(nameof(jobID) + " || " + nameof(msg));
}
@@ -800,7 +801,7 @@ namespace ArchiSteamFarm {
internal sealed class RedeemGuestPassResponseCallback : CallbackMsg {
internal readonly EResult Result;
internal RedeemGuestPassResponseCallback([NotNull] JobID jobID, [NotNull] CMsgClientRedeemGuestPassResponse msg) {
internal RedeemGuestPassResponseCallback([JetBrains.Annotations.NotNull] JobID jobID, [JetBrains.Annotations.NotNull] CMsgClientRedeemGuestPassResponse msg) {
if ((jobID == null) || (msg == null)) {
throw new ArgumentNullException(nameof(jobID) + " || " + nameof(msg));
}
@@ -813,7 +814,7 @@ namespace ArchiSteamFarm {
internal sealed class SharedLibraryLockStatusCallback : CallbackMsg {
internal readonly ulong LibraryLockedBySteamID;
internal SharedLibraryLockStatusCallback([NotNull] JobID jobID, [NotNull] CMsgClientSharedLibraryLockStatus msg) {
internal SharedLibraryLockStatusCallback([JetBrains.Annotations.NotNull] JobID jobID, [JetBrains.Annotations.NotNull] CMsgClientSharedLibraryLockStatus msg) {
if ((jobID == null) || (msg == null)) {
throw new ArgumentNullException(nameof(jobID) + " || " + nameof(msg));
}
@@ -831,7 +832,7 @@ namespace ArchiSteamFarm {
internal sealed class UserNotificationsCallback : CallbackMsg {
internal readonly Dictionary<EUserNotification, uint> Notifications;
internal UserNotificationsCallback([NotNull] JobID jobID, [NotNull] CMsgClientUserNotifications msg) {
internal UserNotificationsCallback([JetBrains.Annotations.NotNull] JobID jobID, [JetBrains.Annotations.NotNull] CMsgClientUserNotifications msg) {
if ((jobID == null) || (msg == null)) {
throw new ArgumentNullException(nameof(jobID) + " || " + nameof(msg));
}
@@ -870,7 +871,7 @@ namespace ArchiSteamFarm {
}
}
internal UserNotificationsCallback([NotNull] JobID jobID, [NotNull] CMsgClientItemAnnouncements msg) {
internal UserNotificationsCallback([JetBrains.Annotations.NotNull] JobID jobID, [JetBrains.Annotations.NotNull] CMsgClientItemAnnouncements msg) {
if ((jobID == null) || (msg == null)) {
throw new ArgumentNullException(nameof(jobID) + " || " + nameof(msg));
}
@@ -899,7 +900,7 @@ namespace ArchiSteamFarm {
internal sealed class VanityURLChangedCallback : CallbackMsg {
internal readonly string VanityURL;
internal VanityURLChangedCallback([NotNull] JobID jobID, [NotNull] CMsgClientVanityURLChangedNotification msg) {
internal VanityURLChangedCallback([JetBrains.Annotations.NotNull] JobID jobID, [JetBrains.Annotations.NotNull] CMsgClientVanityURLChangedNotification msg) {
if ((jobID == null) || (msg == null)) {
throw new ArgumentNullException(nameof(jobID) + " || " + nameof(msg));
}

View File

@@ -22,6 +22,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Net;
using System.Net.Http;
@@ -87,7 +88,7 @@ namespace ArchiSteamFarm {
private bool MarkingInventoryScheduled;
private string VanityURL;
internal ArchiWebHandler([NotNull] Bot bot) {
internal ArchiWebHandler([JetBrains.Annotations.NotNull] Bot bot) {
Bot = bot ?? throw new ArgumentNullException(nameof(bot));
CachedApiKey = new ArchiCacheable<string>(ResolveApiKey);
@@ -122,7 +123,7 @@ namespace ArchiSteamFarm {
[ItemCanBeNull]
[PublicAPI]
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "FunctionComplexityOverflow")]
[SuppressMessage("ReSharper", "FunctionComplexityOverflow")]
public async Task<HashSet<Steam.Asset>> GetInventory(ulong steamID = 0, uint appID = Steam.Asset.SteamAppID, ulong contextID = Steam.Asset.SteamCommunityContextID, bool? marketable = null, bool? tradable = null, IReadOnlyCollection<uint> wantedRealAppIDs = null, IReadOnlyCollection<Steam.Asset.EType> wantedTypes = null, IReadOnlyCollection<(uint RealAppID, Steam.Asset.EType Type, Steam.Asset.ERarity Rarity)> wantedSets = null) {
if ((appID == 0) || (contextID == 0)) {
Bot.ArchiLogger.LogNullError(nameof(appID) + " || " + nameof(contextID));
@@ -1388,7 +1389,7 @@ namespace ArchiSteamFarm {
return true;
}
[NotNull]
[JetBrains.Annotations.NotNull]
internal HttpClient GenerateDisposableHttpClient() => WebBrowser.GenerateDisposableHttpClient();
[ItemCanBeNull]

View File

@@ -24,6 +24,7 @@ using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Security.Cryptography;
@@ -142,7 +143,7 @@ namespace ArchiSteamFarm {
#pragma warning disable IDE0051
[JsonProperty(PropertyName = SharedInfo.UlongCompatibilityStringPrefix + nameof(SteamID))]
[NotNull]
[JetBrains.Annotations.NotNull]
private string SSteamID => SteamID.ToString();
#pragma warning restore IDE0051
@@ -197,7 +198,7 @@ namespace ArchiSteamFarm {
private string TwoFactorCode;
private byte TwoFactorCodeFailures;
private Bot([NotNull] string botName, [NotNull] BotConfig botConfig, [NotNull] BotDatabase botDatabase) {
private Bot([JetBrains.Annotations.NotNull] string botName, [JetBrains.Annotations.NotNull] BotConfig botConfig, [JetBrains.Annotations.NotNull] BotDatabase botDatabase) {
if (string.IsNullOrEmpty(botName) || (botConfig == null) || (botDatabase == null)) {
throw new ArgumentNullException(nameof(botName) + " || " + nameof(botConfig) + " || " + nameof(botDatabase));
}
@@ -2771,7 +2772,7 @@ namespace ArchiSteamFarm {
WalletCurrency = callback.Currency;
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "FunctionComplexityOverflow")]
[SuppressMessage("ReSharper", "FunctionComplexityOverflow")]
private async Task RedeemGamesInBackground() {
if (!await GamesRedeemerInBackgroundSemaphore.WaitAsync(0).ConfigureAwait(false)) {
return;

View File

@@ -22,6 +22,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Linq;
using System.Threading;
@@ -34,7 +35,7 @@ using Newtonsoft.Json.Linq;
using SteamKit2;
namespace ArchiSteamFarm {
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
[SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
public sealed class BotConfig {
internal const byte SteamParentalCodeLength = 4;
@@ -224,7 +225,7 @@ namespace ArchiSteamFarm {
private bool ShouldSerializeSensitiveDetails = true;
[JsonProperty(PropertyName = SharedInfo.UlongCompatibilityStringPrefix + nameof(SteamMasterClanID), Required = Required.DisallowNull)]
[NotNull]
[JetBrains.Annotations.NotNull]
private string SSteamMasterClanID {
get => SteamMasterClanID.ToString();

View File

@@ -23,6 +23,7 @@ using System;
using System.Collections;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using JetBrains.Annotations;
@@ -35,7 +36,7 @@ namespace ArchiSteamFarm.Collections {
public ConcurrentHashSet() => BackingCollection = new ConcurrentDictionary<T, bool>();
public ConcurrentHashSet([NotNull] IEqualityComparer<T> comparer) {
public ConcurrentHashSet([JetBrains.Annotations.NotNull] IEqualityComparer<T> comparer) {
if (comparer == null) {
throw new ArgumentNullException(nameof(comparer));
}
@@ -46,7 +47,7 @@ namespace ArchiSteamFarm.Collections {
public bool Add(T item) => BackingCollection.TryAdd(item, true);
public void Clear() => BackingCollection.Clear();
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "AssignNullToNotNullAttribute")]
[SuppressMessage("ReSharper", "AssignNullToNotNullAttribute")]
public bool Contains(T item) => BackingCollection.ContainsKey(item);
public void CopyTo(T[] array, int arrayIndex) => BackingCollection.Keys.CopyTo(array, arrayIndex);
@@ -97,7 +98,7 @@ namespace ArchiSteamFarm.Collections {
return otherSet.Any(Contains);
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "AssignNullToNotNullAttribute")]
[SuppressMessage("ReSharper", "AssignNullToNotNullAttribute")]
public bool Remove(T item) => BackingCollection.TryRemove(item, out _);
public bool SetEquals(IEnumerable<T> other) {
@@ -126,22 +127,22 @@ namespace ArchiSteamFarm.Collections {
}
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "AnnotationConflictInHierarchy")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "AssignNullToNotNullAttribute")]
void ICollection<T>.Add([NotNull] T item) => Add(item);
[SuppressMessage("ReSharper", "AnnotationConflictInHierarchy")]
[SuppressMessage("ReSharper", "AssignNullToNotNullAttribute")]
void ICollection<T>.Add([JetBrains.Annotations.NotNull] T item) => Add(item);
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
// We use Count() and not Any() because we must ensure full loop pass
[PublicAPI]
public bool AddRange([NotNull] IEnumerable<T> items) => items.Count(Add) > 0;
public bool AddRange([JetBrains.Annotations.NotNull] IEnumerable<T> items) => items.Count(Add) > 0;
// We use Count() and not Any() because we must ensure full loop pass
[PublicAPI]
public bool RemoveRange([NotNull] IEnumerable<T> items) => items.Count(Remove) > 0;
public bool RemoveRange([JetBrains.Annotations.NotNull] IEnumerable<T> items) => items.Count(Remove) > 0;
[PublicAPI]
public bool ReplaceIfNeededWith([NotNull] IReadOnlyCollection<T> other) {
public bool ReplaceIfNeededWith([JetBrains.Annotations.NotNull] IReadOnlyCollection<T> other) {
if (SetEquals(other)) {
return false;
}
@@ -152,7 +153,7 @@ namespace ArchiSteamFarm.Collections {
}
[PublicAPI]
public void ReplaceWith([NotNull] IEnumerable<T> other) {
public void ReplaceWith([JetBrains.Annotations.NotNull] IEnumerable<T> other) {
BackingCollection.Clear();
foreach (T item in other) {

View File

@@ -21,7 +21,7 @@
using System.Collections;
using System.Collections.Generic;
using JetBrains.Annotations;
using System.Diagnostics.CodeAnalysis;
using Nito.AsyncEx;
namespace ArchiSteamFarm.Collections {
@@ -80,8 +80,8 @@ namespace ArchiSteamFarm.Collections {
}
}
[NotNull]
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "AnnotationRedundancyInHierarchy")]
[JetBrains.Annotations.NotNull]
[SuppressMessage("ReSharper", "AnnotationRedundancyInHierarchy")]
public IEnumerator<T> GetEnumerator() => new ConcurrentEnumerator<T>(BackingCollection, Lock.ReaderLock());
public int IndexOf(T item) {
@@ -108,11 +108,11 @@ namespace ArchiSteamFarm.Collections {
}
}
[NotNull]
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "AnnotationRedundancyInHierarchy")]
[JetBrains.Annotations.NotNull]
[SuppressMessage("ReSharper", "AnnotationRedundancyInHierarchy")]
IEnumerator IEnumerable.GetEnumerator() => GetEnumerator();
internal void ReplaceWith([NotNull] IEnumerable<T> collection) {
internal void ReplaceWith([JetBrains.Annotations.NotNull] IEnumerable<T> collection) {
using (Lock.WriterLock()) {
BackingCollection.Clear();
BackingCollection.AddRange(collection);

View File

@@ -21,6 +21,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
@@ -38,7 +39,7 @@ namespace ArchiSteamFarm {
private readonly Bot Bot;
private readonly Dictionary<uint, string> CachedGamesOwned = new Dictionary<uint, string>();
internal Commands([NotNull] Bot bot) => Bot = bot ?? throw new ArgumentNullException(nameof(bot));
internal Commands([JetBrains.Annotations.NotNull] Bot bot) => Bot = bot ?? throw new ArgumentNullException(nameof(bot));
[PublicAPI]
public static string FormatBotResponse(string response, string botName) {
@@ -1622,7 +1623,7 @@ namespace ArchiSteamFarm {
return responses.Count > 0 ? string.Join(Environment.NewLine, responses) : null;
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "FunctionComplexityOverflow")]
[SuppressMessage("ReSharper", "FunctionComplexityOverflow")]
private async Task<(string Response, Dictionary<string, string> OwnedGames)> ResponseOwns(ulong steamID, string query) {
if ((steamID == 0) || string.IsNullOrEmpty(query)) {
Bot.ArchiLogger.LogNullError(nameof(steamID) + " || " + nameof(query));
@@ -2141,7 +2142,7 @@ namespace ArchiSteamFarm {
return responses.Count > 0 ? string.Join(Environment.NewLine, responses) : null;
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "FunctionComplexityOverflow")]
[SuppressMessage("ReSharper", "FunctionComplexityOverflow")]
private async Task<string> ResponseRedeem(ulong steamID, string keysText, ERedeemFlags redeemFlags = ERedeemFlags.None) {
if ((steamID == 0) || string.IsNullOrEmpty(keysText)) {
Bot.ArchiLogger.LogNullError(nameof(steamID) + " || " + nameof(keysText));

View File

@@ -22,6 +22,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Net;
using System.Threading;
@@ -33,7 +34,7 @@ using Newtonsoft.Json.Linq;
using SteamKit2;
namespace ArchiSteamFarm {
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
[SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
public sealed class GlobalConfig {
internal const byte DefaultConnectionTimeout = 90;
internal const byte DefaultLoginLimiterDelay = 10;
@@ -217,7 +218,7 @@ namespace ArchiSteamFarm {
private bool ShouldSerializeSensitiveDetails = true;
[JsonProperty(PropertyName = SharedInfo.UlongCompatibilityStringPrefix + nameof(SteamOwnerID), Required = Required.DisallowNull)]
[NotNull]
[JetBrains.Annotations.NotNull]
private string SSteamOwnerID {
get => SteamOwnerID.ToString();
@@ -267,7 +268,7 @@ namespace ArchiSteamFarm {
return Enum.IsDefined(typeof(EUpdateChannel), UpdateChannel) ? (true, null) : (false, string.Format(Strings.ErrorConfigPropertyInvalid, nameof(UpdateChannel), UpdateChannel));
}
[NotNull]
[JetBrains.Annotations.NotNull]
internal static GlobalConfig Create() =>
new GlobalConfig {
ShouldSerializeEverything = false,

View File

@@ -21,6 +21,7 @@
using System;
using System.Collections.Concurrent;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Net;
using System.Threading;
@@ -30,7 +31,7 @@ using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Primitives;
namespace ArchiSteamFarm.IPC.Integration {
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "ClassNeverInstantiated.Global")]
[SuppressMessage("ReSharper", "ClassNeverInstantiated.Global")]
internal sealed class ApiAuthenticationMiddleware {
internal const string HeadersField = "Authentication";
@@ -44,7 +45,7 @@ namespace ArchiSteamFarm.IPC.Integration {
private readonly RequestDelegate Next;
public ApiAuthenticationMiddleware([NotNull] RequestDelegate next) {
public ApiAuthenticationMiddleware([JetBrains.Annotations.NotNull] RequestDelegate next) {
Next = next ?? throw new ArgumentNullException(nameof(next));
lock (FailedAuthorizations) {

View File

@@ -21,11 +21,11 @@
using System;
using System.ComponentModel.DataAnnotations;
using JetBrains.Annotations;
using System.Diagnostics.CodeAnalysis;
using Newtonsoft.Json;
namespace ArchiSteamFarm.IPC.Requests {
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
[SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
public sealed class CommandRequest {
/// <summary>
/// Specifies the command that will be executed by ASF.
@@ -34,7 +34,7 @@ namespace ArchiSteamFarm.IPC.Requests {
[Required]
public readonly string Command;
internal CommandRequest([NotNull] string command) {
internal CommandRequest([JetBrains.Annotations.NotNull] string command) {
if (string.IsNullOrEmpty(command)) {
throw new ArgumentNullException(nameof(command));
}

View File

@@ -22,6 +22,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using ArchiSteamFarm.Localization;
using HtmlAgilityPack;
@@ -71,7 +72,7 @@ namespace ArchiSteamFarm.Json {
#pragma warning disable IDE0051
[JsonProperty(PropertyName = "amount", Required = Required.Always)]
[NotNull]
[JetBrains.Annotations.NotNull]
private string AmountText {
get => Amount.ToString();
@@ -94,7 +95,7 @@ namespace ArchiSteamFarm.Json {
#pragma warning restore IDE0051
[JsonProperty(PropertyName = "assetid", Required = Required.DisallowNull)]
[NotNull]
[JetBrains.Annotations.NotNull]
private string AssetIDText {
get => AssetID.ToString();
@@ -117,7 +118,7 @@ namespace ArchiSteamFarm.Json {
#pragma warning disable IDE0051
[JsonProperty(PropertyName = "classid", Required = Required.DisallowNull)]
[NotNull]
[JetBrains.Annotations.NotNull]
private string ClassIDText {
get => ClassID.ToString();
@@ -139,7 +140,7 @@ namespace ArchiSteamFarm.Json {
#pragma warning disable IDE0051
[JsonProperty(PropertyName = "contextid", Required = Required.DisallowNull)]
[NotNull]
[JetBrains.Annotations.NotNull]
private string ContextIDText {
get => ContextID.ToString();
@@ -163,7 +164,7 @@ namespace ArchiSteamFarm.Json {
#pragma warning disable IDE0051
[JsonProperty(PropertyName = "id", Required = Required.DisallowNull)]
[NotNull]
[JetBrains.Annotations.NotNull]
private string IDText {
get => AssetIDText;
set => AssetIDText = value;
@@ -189,7 +190,7 @@ namespace ArchiSteamFarm.Json {
[JsonConstructor]
private Asset() { }
[NotNull]
[JetBrains.Annotations.NotNull]
internal Asset CreateShallowCopy() => (Asset) MemberwiseClone();
public enum ERarity : byte {
@@ -213,7 +214,7 @@ namespace ArchiSteamFarm.Json {
}
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
[SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
public class BooleanResponse {
[JsonProperty(PropertyName = "success", Required = Required.Always)]
public readonly bool Success;
@@ -222,7 +223,7 @@ namespace ArchiSteamFarm.Json {
protected BooleanResponse() { }
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
[SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
public sealed class ConfirmationDetails : BooleanResponse {
internal MobileAuthenticator.Confirmation Confirmation { get; set; }
internal ulong TradeOfferID { get; private set; }
@@ -316,7 +317,7 @@ namespace ArchiSteamFarm.Json {
}
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
[SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
public class EResultResponse {
[JsonProperty(PropertyName = "success", Required = Required.Always)]
public readonly EResult Result;
@@ -325,7 +326,7 @@ namespace ArchiSteamFarm.Json {
protected EResultResponse() { }
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
[SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
public class NumberResponse {
[PublicAPI]
public bool Success { get; private set; }
@@ -415,7 +416,7 @@ namespace ArchiSteamFarm.Json {
}
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
[SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
internal sealed class InventoryResponse : NumberResponse {
[JsonProperty(PropertyName = "assets", Required = Required.DisallowNull)]
internal readonly ImmutableHashSet<Asset> Assets;
@@ -653,7 +654,7 @@ namespace ArchiSteamFarm.Json {
[JsonProperty(PropertyName = "internal_name", Required = Required.Always)]
internal readonly string Value;
internal Tag([NotNull] string identifier, [NotNull] string value) {
internal Tag([JetBrains.Annotations.NotNull] string identifier, [JetBrains.Annotations.NotNull] string value) {
if (string.IsNullOrEmpty(identifier) || string.IsNullOrEmpty(value)) {
throw new ArgumentNullException(nameof(identifier) + " || " + nameof(value));
}
@@ -668,7 +669,7 @@ namespace ArchiSteamFarm.Json {
}
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
[SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
internal sealed class NewDiscoveryQueueResponse {
[JsonProperty(PropertyName = "queue", Required = Required.Always)]
internal readonly ImmutableHashSet<uint> Queue;
@@ -677,7 +678,7 @@ namespace ArchiSteamFarm.Json {
private NewDiscoveryQueueResponse() { }
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
[SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
internal sealed class RedeemWalletResponse : EResultResponse {
[JsonProperty(PropertyName = "wallet", Required = Required.DisallowNull)]
internal readonly InternalKeyDetails KeyDetails;
@@ -700,7 +701,7 @@ namespace ArchiSteamFarm.Json {
}
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
[SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
internal sealed class TradeOfferAcceptResponse {
[JsonProperty(PropertyName = "needs_mobile_confirmation", Required = Required.DisallowNull)]
internal readonly bool RequiresMobileConfirmation;
@@ -722,7 +723,7 @@ namespace ArchiSteamFarm.Json {
}
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
[SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
internal sealed class TradeOfferSendResponse {
[JsonProperty(PropertyName = "needs_mobile_confirmation", Required = Required.DisallowNull)]
internal readonly bool RequiresMobileConfirmation;
@@ -754,7 +755,7 @@ namespace ArchiSteamFarm.Json {
private TradeOfferSendResponse() { }
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
[SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
internal sealed class UserPrivacy {
[JsonProperty(PropertyName = "eCommentPermission", Required = Required.Always)]
internal readonly ECommentPermission CommentPermission;
@@ -763,7 +764,7 @@ namespace ArchiSteamFarm.Json {
internal readonly PrivacySettings Settings;
// Constructed from privacy change request
internal UserPrivacy([NotNull] PrivacySettings settings, ECommentPermission commentPermission) {
internal UserPrivacy([JetBrains.Annotations.NotNull] PrivacySettings settings, ECommentPermission commentPermission) {
Settings = settings ?? throw new ArgumentNullException(nameof(settings));
CommentPermission = commentPermission;
}

View File

@@ -21,6 +21,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Security.Cryptography;
using System.Text;
using System.Threading;
@@ -32,7 +33,7 @@ using JetBrains.Annotations;
using Newtonsoft.Json;
namespace ArchiSteamFarm {
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
[SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
internal sealed class MobileAuthenticator {
private const byte CodeDigits = 5;
private const byte CodeInterval = 30;
@@ -278,7 +279,7 @@ namespace ArchiSteamFarm {
return true;
}
internal void Init([NotNull] Bot bot) => Bot = bot ?? throw new ArgumentNullException(nameof(bot));
internal void Init([JetBrains.Annotations.NotNull] Bot bot) => Bot = bot ?? throw new ArgumentNullException(nameof(bot));
internal static bool IsValidDeviceID(string deviceID) {
if (string.IsNullOrEmpty(deviceID)) {

View File

@@ -22,6 +22,7 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
@@ -58,7 +59,7 @@ namespace ArchiSteamFarm {
private DateTime LastPersonaStateRequest;
private bool ShouldSendHeartBeats;
internal Statistics([NotNull] Bot bot) {
internal Statistics([JetBrains.Annotations.NotNull] Bot bot) {
Bot = bot ?? throw new ArgumentNullException(nameof(bot));
MatchActivelyTimer = new Timer(
@@ -340,7 +341,7 @@ namespace ArchiSteamFarm {
}
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "FunctionComplexityOverflow")]
[SuppressMessage("ReSharper", "FunctionComplexityOverflow")]
private async Task<bool> MatchActivelyRound(IReadOnlyCollection<Steam.Asset.EType> acceptedMatchableTypes, IDictionary<ulong, (byte Tries, ISet<ulong> GivenAssetIDs, ISet<ulong> ReceivedAssetIDs)> triedSteamIDs) {
if ((acceptedMatchableTypes == null) || (acceptedMatchableTypes.Count == 0) || (triedSteamIDs == null)) {
Bot.ArchiLogger.LogNullError(nameof(acceptedMatchableTypes) + " || " + nameof(triedSteamIDs));
@@ -663,7 +664,7 @@ namespace ArchiSteamFarm {
return skippedSetsThisRound.Count > 0;
}
[System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
[SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
private sealed class ListedUser {
internal readonly HashSet<Steam.Asset.EType> MatchableTypes = new HashSet<Steam.Asset.EType>();