Cleanup some obsolete warnings

This commit is contained in:
JustArchi
2020-12-05 21:53:18 +01:00
parent 4e190b7dfd
commit bc8ee3592d
10 changed files with 21 additions and 93 deletions

View File

@@ -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() { }

View File

@@ -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<string, string> Apps;
#pragma warning restore IDE0052
#pragma warning disable IDE0052
[JsonProperty(PropertyName = "depots", Required = Required.Always)]
private readonly ImmutableDictionary<string, string> 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<string, string> 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<KeyValuePair<uint, ulong>> apps, IReadOnlyCollection<KeyValuePair<uint, ulong>> accessTokens, IReadOnlyCollection<KeyValuePair<uint, string>> depots) {
if ((steamID == 0) || !new SteamID(steamID).IsIndividualAccount) {

View File

@@ -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() { }

View File

@@ -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();

View File

@@ -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)) {

View File

@@ -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 {

View File

@@ -96,7 +96,6 @@ namespace ArchiSteamFarm.Json {
[JsonExtensionData]
internal Dictionary<string, JToken>? 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<Tag>? 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() { }

View File

@@ -55,15 +55,11 @@ namespace ArchiSteamFarm {
private readonly ArchiCacheable<string> 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;

View File

@@ -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<byte[]> 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
}
}

View File

@@ -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<Steam.Asset.EType> 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() { }