diff --git a/ArchiSteamFarm.CustomPlugins.ExamplePlugin/CatAPI.cs b/ArchiSteamFarm.CustomPlugins.ExamplePlugin/CatAPI.cs index 64d74d3c5..738737bc8 100644 --- a/ArchiSteamFarm.CustomPlugins.ExamplePlugin/CatAPI.cs +++ b/ArchiSteamFarm.CustomPlugins.ExamplePlugin/CatAPI.cs @@ -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 GetRandomCatURL([NotNull] WebBrowser webBrowser) { + internal static async Task GetRandomCatURL([JetBrains.Annotations.NotNull] WebBrowser webBrowser) { const string request = URL + "/meow"; WebBrowser.ObjectResponse response = await webBrowser.UrlGetToJsonObject(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)] diff --git a/ArchiSteamFarm/Actions.cs b/ArchiSteamFarm/Actions.cs index eeff5cae0..f3d3fe20e 100644 --- a/ArchiSteamFarm/Actions.cs +++ b/ArchiSteamFarm/Actions.cs @@ -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 wantedRealAppIDs = null, IReadOnlyCollection wantedTypes = null) { if ((appID == 0) || (contextID == 0)) { Bot.ArchiLogger.LogNullError(nameof(appID) + " || " + nameof(contextID)); diff --git a/ArchiSteamFarm/ArchiHandler.cs b/ArchiSteamFarm/ArchiHandler.cs index ddec2a522..f9a5bf3d8 100644 --- a/ArchiSteamFarm/ArchiHandler.cs +++ b/ArchiSteamFarm/ArchiHandler.cs @@ -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 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 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)); } diff --git a/ArchiSteamFarm/ArchiWebHandler.cs b/ArchiSteamFarm/ArchiWebHandler.cs index f40905d43..7ddb8d03a 100644 --- a/ArchiSteamFarm/ArchiWebHandler.cs +++ b/ArchiSteamFarm/ArchiWebHandler.cs @@ -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(ResolveApiKey); @@ -122,7 +123,7 @@ namespace ArchiSteamFarm { [ItemCanBeNull] [PublicAPI] - [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "FunctionComplexityOverflow")] + [SuppressMessage("ReSharper", "FunctionComplexityOverflow")] public async Task> GetInventory(ulong steamID = 0, uint appID = Steam.Asset.SteamAppID, ulong contextID = Steam.Asset.SteamCommunityContextID, bool? marketable = null, bool? tradable = null, IReadOnlyCollection wantedRealAppIDs = null, IReadOnlyCollection 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] diff --git a/ArchiSteamFarm/Bot.cs b/ArchiSteamFarm/Bot.cs index ae5560daf..8533aaa98 100755 --- a/ArchiSteamFarm/Bot.cs +++ b/ArchiSteamFarm/Bot.cs @@ -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; diff --git a/ArchiSteamFarm/BotConfig.cs b/ArchiSteamFarm/BotConfig.cs index afa1c4dd8..68b3643cb 100644 --- a/ArchiSteamFarm/BotConfig.cs +++ b/ArchiSteamFarm/BotConfig.cs @@ -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(); diff --git a/ArchiSteamFarm/Collections/ConcurrentHashSet.cs b/ArchiSteamFarm/Collections/ConcurrentHashSet.cs index 3a0ba229f..1edacbc50 100644 --- a/ArchiSteamFarm/Collections/ConcurrentHashSet.cs +++ b/ArchiSteamFarm/Collections/ConcurrentHashSet.cs @@ -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(); - public ConcurrentHashSet([NotNull] IEqualityComparer comparer) { + public ConcurrentHashSet([JetBrains.Annotations.NotNull] IEqualityComparer 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 other) { @@ -126,22 +127,22 @@ namespace ArchiSteamFarm.Collections { } } - [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "AnnotationConflictInHierarchy")] - [System.Diagnostics.CodeAnalysis.SuppressMessage("ReSharper", "AssignNullToNotNullAttribute")] - void ICollection.Add([NotNull] T item) => Add(item); + [SuppressMessage("ReSharper", "AnnotationConflictInHierarchy")] + [SuppressMessage("ReSharper", "AssignNullToNotNullAttribute")] + void ICollection.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 items) => items.Count(Add) > 0; + public bool AddRange([JetBrains.Annotations.NotNull] IEnumerable items) => items.Count(Add) > 0; // We use Count() and not Any() because we must ensure full loop pass [PublicAPI] - public bool RemoveRange([NotNull] IEnumerable items) => items.Count(Remove) > 0; + public bool RemoveRange([JetBrains.Annotations.NotNull] IEnumerable items) => items.Count(Remove) > 0; [PublicAPI] - public bool ReplaceIfNeededWith([NotNull] IReadOnlyCollection other) { + public bool ReplaceIfNeededWith([JetBrains.Annotations.NotNull] IReadOnlyCollection other) { if (SetEquals(other)) { return false; } @@ -152,7 +153,7 @@ namespace ArchiSteamFarm.Collections { } [PublicAPI] - public void ReplaceWith([NotNull] IEnumerable other) { + public void ReplaceWith([JetBrains.Annotations.NotNull] IEnumerable other) { BackingCollection.Clear(); foreach (T item in other) { diff --git a/ArchiSteamFarm/Collections/ConcurrentList.cs b/ArchiSteamFarm/Collections/ConcurrentList.cs index f0f514a4d..1650ba260 100644 --- a/ArchiSteamFarm/Collections/ConcurrentList.cs +++ b/ArchiSteamFarm/Collections/ConcurrentList.cs @@ -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 GetEnumerator() => new ConcurrentEnumerator(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 collection) { + internal void ReplaceWith([JetBrains.Annotations.NotNull] IEnumerable collection) { using (Lock.WriterLock()) { BackingCollection.Clear(); BackingCollection.AddRange(collection); diff --git a/ArchiSteamFarm/Commands.cs b/ArchiSteamFarm/Commands.cs index 3af384a9d..b80370c42 100644 --- a/ArchiSteamFarm/Commands.cs +++ b/ArchiSteamFarm/Commands.cs @@ -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 CachedGamesOwned = new Dictionary(); - 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 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 ResponseRedeem(ulong steamID, string keysText, ERedeemFlags redeemFlags = ERedeemFlags.None) { if ((steamID == 0) || string.IsNullOrEmpty(keysText)) { Bot.ArchiLogger.LogNullError(nameof(steamID) + " || " + nameof(keysText)); diff --git a/ArchiSteamFarm/GlobalConfig.cs b/ArchiSteamFarm/GlobalConfig.cs index 5760758c4..30609f2df 100644 --- a/ArchiSteamFarm/GlobalConfig.cs +++ b/ArchiSteamFarm/GlobalConfig.cs @@ -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, diff --git a/ArchiSteamFarm/IPC/Integration/ApiAuthenticationMiddleware.cs b/ArchiSteamFarm/IPC/Integration/ApiAuthenticationMiddleware.cs index cbd630a1f..54d6366cb 100644 --- a/ArchiSteamFarm/IPC/Integration/ApiAuthenticationMiddleware.cs +++ b/ArchiSteamFarm/IPC/Integration/ApiAuthenticationMiddleware.cs @@ -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) { diff --git a/ArchiSteamFarm/IPC/Requests/CommandRequest.cs b/ArchiSteamFarm/IPC/Requests/CommandRequest.cs index 1a255905e..14a98f89e 100644 --- a/ArchiSteamFarm/IPC/Requests/CommandRequest.cs +++ b/ArchiSteamFarm/IPC/Requests/CommandRequest.cs @@ -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 { /// /// 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)); } diff --git a/ArchiSteamFarm/Json/Steam.cs b/ArchiSteamFarm/Json/Steam.cs index 1133fc9ab..a7348498d 100644 --- a/ArchiSteamFarm/Json/Steam.cs +++ b/ArchiSteamFarm/Json/Steam.cs @@ -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 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 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; } diff --git a/ArchiSteamFarm/MobileAuthenticator.cs b/ArchiSteamFarm/MobileAuthenticator.cs index 212473849..14ddaad16 100644 --- a/ArchiSteamFarm/MobileAuthenticator.cs +++ b/ArchiSteamFarm/MobileAuthenticator.cs @@ -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)) { diff --git a/ArchiSteamFarm/Statistics.cs b/ArchiSteamFarm/Statistics.cs index b9e2ce35a..71c5646a1 100644 --- a/ArchiSteamFarm/Statistics.cs +++ b/ArchiSteamFarm/Statistics.cs @@ -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 MatchActivelyRound(IReadOnlyCollection acceptedMatchableTypes, IDictionary GivenAssetIDs, ISet 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 MatchableTypes = new HashSet();