From bc8ee3592d78d74d1b5ae163f2bfc46c7bdeacb9 Mon Sep 17 00:00:00 2001 From: JustArchi Date: Sat, 5 Dec 2020 21:53:18 +0100 Subject: [PATCH] Cleanup some obsolete warnings --- .../CatAPI.cs | 2 -- .../RequestData.cs | 18 +++---------- .../ResponseData.cs | 18 ++++++------- ArchiSteamFarm/Bot.cs | 8 ------ ArchiSteamFarm/BotDatabase.cs | 2 -- ArchiSteamFarm/GitHub.cs | 4 +-- ArchiSteamFarm/Json/Steam.cs | 26 ------------------- ArchiSteamFarm/MobileAuthenticator.cs | 4 --- ArchiSteamFarm/RuntimeCompatibility.cs | 8 ++---- ArchiSteamFarm/Statistics.cs | 24 +++++------------ 10 files changed, 21 insertions(+), 93 deletions(-) diff --git a/ArchiSteamFarm.CustomPlugins.ExamplePlugin/CatAPI.cs b/ArchiSteamFarm.CustomPlugins.ExamplePlugin/CatAPI.cs index b69042c40..54cb60dde 100644 --- a/ArchiSteamFarm.CustomPlugins.ExamplePlugin/CatAPI.cs +++ b/ArchiSteamFarm.CustomPlugins.ExamplePlugin/CatAPI.cs @@ -53,10 +53,8 @@ namespace ArchiSteamFarm.CustomPlugins.ExamplePlugin { [SuppressMessage("ReSharper", "ClassCannotBeInstantiated")] private sealed class MeowResponse { -#pragma warning disable 649 [JsonProperty(PropertyName = "file", Required = Required.Always)] internal readonly string Link = ""; -#pragma warning restore 649 [JsonConstructor] private MeowResponse() { } diff --git a/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/RequestData.cs b/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/RequestData.cs index 141fda6d7..05ecaeb8a 100644 --- a/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/RequestData.cs +++ b/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/RequestData.cs @@ -27,42 +27,32 @@ using SteamKit2; namespace ArchiSteamFarm.OfficialPlugins.SteamTokenDumper { internal sealed class RequestData { -#pragma warning disable IDE0052 [JsonProperty(PropertyName = "apps", Required = Required.Always)] private readonly ImmutableDictionary Apps; -#pragma warning restore IDE0052 -#pragma warning disable IDE0052 [JsonProperty(PropertyName = "depots", Required = Required.Always)] private readonly ImmutableDictionary Depots; -#pragma warning restore IDE0052 -#pragma warning disable IDE0052 [JsonProperty(PropertyName = "guid", Required = Required.Always)] private readonly string Guid = ASF.GlobalDatabase?.Identifier.ToString("N") ?? throw new InvalidOperationException(nameof(ASF.GlobalDatabase.Identifier)); -#pragma warning restore IDE0052 private readonly ulong SteamID; -#pragma warning disable IDE0052 [JsonProperty(PropertyName = "subs", Required = Required.Always)] private readonly ImmutableDictionary Subs; -#pragma warning restore IDE0052 -#pragma warning disable IDE0051, 414 +#pragma warning disable CS0414 [JsonProperty(PropertyName = "token", Required = Required.Always)] private readonly string Token = SharedInfo.Token; -#pragma warning restore IDE0051, 414 +#pragma warning restore CS0414 -#pragma warning disable IDE0051, 414 +#pragma warning disable CS0414 [JsonProperty(PropertyName = "v", Required = Required.Always)] private readonly byte Version = SharedInfo.ApiVersion; -#pragma warning restore IDE0051, 414 +#pragma warning restore CS0414 -#pragma warning disable IDE0051 [JsonProperty(PropertyName = "steamid", Required = Required.Always)] private string SteamIDText => new SteamID(SteamID).Render(); -#pragma warning restore IDE0051 internal RequestData(ulong steamID, IReadOnlyCollection> apps, IReadOnlyCollection> accessTokens, IReadOnlyCollection> depots) { if ((steamID == 0) || !new SteamID(steamID).IsIndividualAccount) { diff --git a/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/ResponseData.cs b/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/ResponseData.cs index 4a0e26a60..5cec5d417 100644 --- a/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/ResponseData.cs +++ b/ArchiSteamFarm.OfficialPlugins.SteamTokenDumper/ResponseData.cs @@ -25,34 +25,32 @@ using Newtonsoft.Json; namespace ArchiSteamFarm.OfficialPlugins.SteamTokenDumper { [SuppressMessage("ReSharper", "ClassCannotBeInstantiated")] internal sealed class ResponseData { -#pragma warning disable 649 [JsonProperty(PropertyName = "data", Required = Required.Always)] internal readonly InternalData Data = new(); -#pragma warning restore 649 -#pragma warning disable 649 +#pragma warning disable CS0649 [JsonProperty(PropertyName = "success", Required = Required.Always)] internal readonly bool Success; -#pragma warning restore 649 +#pragma warning restore CS0649 [JsonConstructor] private ResponseData() { } internal sealed class InternalData { -#pragma warning disable 649 +#pragma warning disable CS0649 [JsonProperty(PropertyName = "new_apps", Required = Required.Always)] internal readonly uint NewAppsCount; -#pragma warning restore 649 +#pragma warning restore CS0649 -#pragma warning disable 649 +#pragma warning disable CS0649 [JsonProperty(PropertyName = "new_depots", Required = Required.Always)] internal readonly uint NewDepotsCount; -#pragma warning restore 649 +#pragma warning restore CS0649 -#pragma warning disable 649 +#pragma warning disable CS0649 [JsonProperty(PropertyName = "new_subs", Required = Required.Always)] internal readonly uint NewSubsCount; -#pragma warning restore 649 +#pragma warning restore CS0649 [JsonConstructor] internal InternalData() { } diff --git a/ArchiSteamFarm/Bot.cs b/ArchiSteamFarm/Bot.cs index 4c6f55242..608e4d9e1 100755 --- a/ArchiSteamFarm/Bot.cs +++ b/ArchiSteamFarm/Bot.cs @@ -147,7 +147,6 @@ namespace ArchiSteamFarm { private readonly SteamUser SteamUser; private readonly Trading Trading; -#pragma warning disable CS8605 private IEnumerable<(string FilePath, EFileType FileType)> RelatedFiles { get { foreach (EFileType fileType in Enum.GetValues(typeof(EFileType))) { @@ -163,13 +162,10 @@ namespace ArchiSteamFarm { } } } -#pragma warning restore CS8605 -#pragma warning disable IDE0051 [JsonProperty(PropertyName = SharedInfo.UlongCompatibilityStringPrefix + nameof(SteamID))] private string SSteamID => SteamID.ToString(CultureInfo.InvariantCulture); -#pragma warning restore IDE0051 [JsonProperty] [PublicAPI] @@ -209,10 +205,8 @@ namespace ArchiSteamFarm { private string? AuthCode; -#pragma warning disable IDE0052 [JsonProperty] private string? AvatarHash; -#pragma warning restore IDE0052 private Timer? ConnectionFailureTimer; private bool FirstTradeSent; @@ -1569,7 +1563,6 @@ namespace ArchiSteamFarm { } } -#pragma warning disable CS8605 internal static IOrderedDictionary ValidateGamesToRedeemInBackground(IOrderedDictionary gamesToRedeemInBackground) { if ((gamesToRedeemInBackground == null) || (gamesToRedeemInBackground.Count == 0)) { throw new ArgumentNullException(nameof(gamesToRedeemInBackground)); @@ -1610,7 +1603,6 @@ namespace ArchiSteamFarm { return gamesToRedeemInBackground; } -#pragma warning restore CS8605 private async Task CheckOccupationStatus() { StopPlayingWasBlockedTimer(); diff --git a/ArchiSteamFarm/BotDatabase.cs b/ArchiSteamFarm/BotDatabase.cs index d5dbd87f7..5e32319bc 100644 --- a/ArchiSteamFarm/BotDatabase.cs +++ b/ArchiSteamFarm/BotDatabase.cs @@ -170,7 +170,6 @@ namespace ArchiSteamFarm { return botDatabase; } -#pragma warning disable CS8605 internal (string? Key, string? Name) GetGameToRedeemInBackground() { lock (GamesToRedeemInBackground) { foreach (DictionaryEntry game in GamesToRedeemInBackground) { @@ -180,7 +179,6 @@ namespace ArchiSteamFarm { return (null, null); } -#pragma warning restore CS8605 internal void RemoveGameToRedeemInBackground(string key) { if (string.IsNullOrEmpty(key)) { diff --git a/ArchiSteamFarm/GitHub.cs b/ArchiSteamFarm/GitHub.cs index 3c918fd46..2c0706835 100644 --- a/ArchiSteamFarm/GitHub.cs +++ b/ArchiSteamFarm/GitHub.cs @@ -160,10 +160,8 @@ namespace ArchiSteamFarm { } } -#pragma warning disable 649 [JsonProperty(PropertyName = "body", Required = Required.Always)] - private readonly string? MarkdownBody; -#pragma warning restore 649 + private readonly string? MarkdownBody = ""; private MarkdownDocument? Changelog { get { diff --git a/ArchiSteamFarm/Json/Steam.cs b/ArchiSteamFarm/Json/Steam.cs index e5e063b8e..5fac22cdd 100644 --- a/ArchiSteamFarm/Json/Steam.cs +++ b/ArchiSteamFarm/Json/Steam.cs @@ -96,7 +96,6 @@ namespace ArchiSteamFarm.Json { [JsonExtensionData] internal Dictionary? AdditionalProperties { private get; set; } -#pragma warning disable IDE0051 [JsonProperty(PropertyName = "amount", Required = Required.Always)] private string AmountText { get => Amount.ToString(CultureInfo.InvariantCulture); @@ -117,9 +116,7 @@ namespace ArchiSteamFarm.Json { Amount = amount; } } -#pragma warning restore IDE0051 -#pragma warning disable IDE0052 [JsonProperty(PropertyName = "assetid", Required = Required.DisallowNull)] private string AssetIDText { get => AssetID.ToString(CultureInfo.InvariantCulture); @@ -140,9 +137,7 @@ namespace ArchiSteamFarm.Json { AssetID = assetID; } } -#pragma warning restore IDE0052 -#pragma warning disable IDE0051 [JsonProperty(PropertyName = "classid", Required = Required.DisallowNull)] private string ClassIDText { set { @@ -159,9 +154,7 @@ namespace ArchiSteamFarm.Json { ClassID = classID; } } -#pragma warning restore IDE0051 -#pragma warning disable IDE0051 [JsonProperty(PropertyName = "contextid", Required = Required.DisallowNull)] private string ContextIDText { get => ContextID.ToString(CultureInfo.InvariantCulture); @@ -182,16 +175,12 @@ namespace ArchiSteamFarm.Json { ContextID = contextID; } } -#pragma warning restore IDE0051 -#pragma warning disable IDE0051 [JsonProperty(PropertyName = "id", Required = Required.DisallowNull)] private string IDText { set => AssetIDText = value; } -#pragma warning restore IDE0051 -#pragma warning disable IDE0051 [JsonProperty(PropertyName = "instanceid", Required = Required.DisallowNull)] private string InstanceIDText { set { @@ -208,7 +197,6 @@ namespace ArchiSteamFarm.Json { InstanceID = instanceID; } } -#pragma warning restore IDE0051 // Constructed from trades being received or plugins public Asset(uint appID, ulong contextID, ulong classID, uint amount, ulong instanceID = 0, ulong assetID = 0, bool marketable = true, bool tradable = true, ImmutableHashSet? tags = null, uint realAppID = 0, EType type = EType.Unknown, ERarity rarity = ERarity.Unknown) { @@ -380,7 +368,6 @@ namespace ArchiSteamFarm.Json { internal ulong LastAssetID { get; private set; } internal bool MoreItems { get; private set; } -#pragma warning disable IDE0051 [JsonProperty(PropertyName = "last_assetid", Required = Required.DisallowNull)] private string LastAssetIDText { set { @@ -399,14 +386,11 @@ namespace ArchiSteamFarm.Json { LastAssetID = lastAssetID; } } -#pragma warning restore IDE0051 -#pragma warning disable IDE0051 [JsonProperty(PropertyName = "more_items", Required = Required.DisallowNull)] private byte MoreItemsNumber { set => MoreItems = value > 0; } -#pragma warning restore IDE0051 [JsonConstructor] private InventoryResponse() { } @@ -546,7 +530,6 @@ namespace ArchiSteamFarm.Json { internal bool Tradable { get; set; } -#pragma warning disable IDE0051 [JsonProperty(PropertyName = "classid", Required = Required.Always)] private string ClassIDText { set { @@ -565,9 +548,7 @@ namespace ArchiSteamFarm.Json { ClassID = classID; } } -#pragma warning restore IDE0051 -#pragma warning disable IDE0051 [JsonProperty(PropertyName = "instanceid", Required = Required.DisallowNull)] private string InstanceIDText { set { @@ -584,21 +565,16 @@ namespace ArchiSteamFarm.Json { InstanceID = instanceID; } } -#pragma warning restore IDE0051 -#pragma warning disable IDE0051 [JsonProperty(PropertyName = "marketable", Required = Required.Always)] private byte MarketableNumber { set => Marketable = value > 0; } -#pragma warning restore IDE0051 -#pragma warning disable IDE0051 [JsonProperty(PropertyName = "tradable", Required = Required.Always)] private byte TradableNumber { set => Tradable = value > 0; } -#pragma warning restore IDE0051 [JsonConstructor] internal Description() { } @@ -655,7 +631,6 @@ namespace ArchiSteamFarm.Json { internal ulong TradeOfferID { get; private set; } -#pragma warning disable IDE0051 [JsonProperty(PropertyName = "tradeofferid", Required = Required.Always)] private string TradeOfferIDText { set { @@ -674,7 +649,6 @@ namespace ArchiSteamFarm.Json { TradeOfferID = tradeOfferID; } } -#pragma warning restore IDE0051 [JsonConstructor] private TradeOfferSendResponse() { } diff --git a/ArchiSteamFarm/MobileAuthenticator.cs b/ArchiSteamFarm/MobileAuthenticator.cs index 494448b1f..ddb2c06d8 100644 --- a/ArchiSteamFarm/MobileAuthenticator.cs +++ b/ArchiSteamFarm/MobileAuthenticator.cs @@ -55,15 +55,11 @@ namespace ArchiSteamFarm { private readonly ArchiCacheable CachedDeviceID; -#pragma warning disable 649 [JsonProperty(PropertyName = "identity_secret", Required = Required.Always)] private readonly string IdentitySecret = ""; -#pragma warning restore 649 -#pragma warning disable 649 [JsonProperty(PropertyName = "shared_secret", Required = Required.Always)] private readonly string SharedSecret = ""; -#pragma warning restore 649 private Bot? Bot; diff --git a/ArchiSteamFarm/RuntimeCompatibility.cs b/ArchiSteamFarm/RuntimeCompatibility.cs index a4860f230..a2e477319 100644 --- a/ArchiSteamFarm/RuntimeCompatibility.cs +++ b/ArchiSteamFarm/RuntimeCompatibility.cs @@ -60,7 +60,7 @@ namespace ArchiSteamFarm { } } -#pragma warning disable 1998 +#pragma warning disable CS1998 [PublicAPI] public static class File { public static async Task AppendAllTextAsync(string path, string contents) => @@ -70,7 +70,6 @@ namespace ArchiSteamFarm { await System.IO.File.AppendAllTextAsync(path, contents).ConfigureAwait(false); #endif -#pragma warning disable IDE0022 public static void Move(string sourceFileName, string destFileName, bool overwrite) { #if NETFRAMEWORK if (overwrite && System.IO.File.Exists(destFileName)) { @@ -82,7 +81,6 @@ namespace ArchiSteamFarm { System.IO.File.Move(sourceFileName, destFileName, overwrite); #endif } -#pragma warning restore IDE0022 public static async Task ReadAllBytesAsync(string path) => #if NETFRAMEWORK @@ -105,7 +103,7 @@ namespace ArchiSteamFarm { await System.IO.File.WriteAllTextAsync(path, contents).ConfigureAwait(false); #endif } -#pragma warning restore 1998 +#pragma warning restore CS1998 [PublicAPI] public static class HashCode { @@ -129,9 +127,7 @@ namespace ArchiSteamFarm { return (result[0] == System.IO.Path.DirectorySeparatorChar) || (result[0] == System.IO.Path.AltDirectorySeparatorChar) ? result[1..] : result; #else -#pragma warning disable IDE0022 return System.IO.Path.GetRelativePath(relativeTo, path); -#pragma warning restore IDE0022 #endif } } diff --git a/ArchiSteamFarm/Statistics.cs b/ArchiSteamFarm/Statistics.cs index 4021a2ee7..6e212b637 100644 --- a/ArchiSteamFarm/Statistics.cs +++ b/ArchiSteamFarm/Statistics.cs @@ -702,33 +702,30 @@ namespace ArchiSteamFarm { [SuppressMessage("ReSharper", "ClassCannotBeInstantiated")] private sealed class ListedUser { -#pragma warning disable 649 +#pragma warning disable CS0649 [JsonProperty(PropertyName = "items_count", Required = Required.Always)] internal readonly ushort ItemsCount; -#pragma warning restore 649 +#pragma warning restore CS0649 internal readonly HashSet MatchableTypes = new(); -#pragma warning disable 649 +#pragma warning disable CS0649 [JsonProperty(PropertyName = "steam_id", Required = Required.Always)] internal readonly ulong SteamID; -#pragma warning restore 649 +#pragma warning restore CS0649 -#pragma warning disable 649 [JsonProperty(PropertyName = "trade_token", Required = Required.Always)] internal readonly string TradeToken = ""; -#pragma warning restore 649 internal float Score => GamesCount / (float) ItemsCount; -#pragma warning disable 649 +#pragma warning disable CS0649 [JsonProperty(PropertyName = "games_count", Required = Required.Always)] private readonly ushort GamesCount; -#pragma warning restore 649 +#pragma warning restore CS0649 internal bool MatchEverything { get; private set; } -#pragma warning disable IDE0051 [JsonProperty(PropertyName = "matchable_backgrounds", Required = Required.Always)] private byte MatchableBackgroundsNumber { set { @@ -748,9 +745,7 @@ namespace ArchiSteamFarm { } } } -#pragma warning restore IDE0051 -#pragma warning disable IDE0051 [JsonProperty(PropertyName = "matchable_cards", Required = Required.Always)] private byte MatchableCardsNumber { set { @@ -770,9 +765,7 @@ namespace ArchiSteamFarm { } } } -#pragma warning restore IDE0051 -#pragma warning disable IDE0051 [JsonProperty(PropertyName = "matchable_emoticons", Required = Required.Always)] private byte MatchableEmoticonsNumber { set { @@ -792,9 +785,7 @@ namespace ArchiSteamFarm { } } } -#pragma warning restore IDE0051 -#pragma warning disable IDE0051 [JsonProperty(PropertyName = "matchable_foil_cards", Required = Required.Always)] private byte MatchableFoilCardsNumber { set { @@ -814,9 +805,7 @@ namespace ArchiSteamFarm { } } } -#pragma warning restore IDE0051 -#pragma warning disable IDE0051 [JsonProperty(PropertyName = "match_everything", Required = Required.Always)] private byte MatchEverythingNumber { set { @@ -836,7 +825,6 @@ namespace ArchiSteamFarm { } } } -#pragma warning restore IDE0051 [JsonConstructor] private ListedUser() { }