From b8d000bf1322d16fc5957f80bb6ca06dee19de30 Mon Sep 17 00:00:00 2001 From: JustArchi Date: Fri, 11 Jan 2019 01:02:58 +0100 Subject: [PATCH] Add json constructor attributes --- .../CatAPI.cs | 1 + ArchiSteamFarm/GitHub.cs | 4 +-- ArchiSteamFarm/IPC/Requests/ASFRequest.cs | 2 +- .../BotGamesToRedeemInBackgroundRequest.cs | 2 +- .../IPC/Requests/BotPauseRequest.cs | 2 +- .../IPC/Requests/BotRedeemRequest.cs | 2 +- ArchiSteamFarm/IPC/Requests/BotRequest.cs | 2 +- ArchiSteamFarm/IPC/Requests/WWWSendRequest.cs | 2 +- ArchiSteamFarm/Json/Steam.cs | 28 +++++++++---------- 9 files changed, 23 insertions(+), 22 deletions(-) diff --git a/ArchiSteamFarm.CustomPlugins.ExamplePlugin/CatAPI.cs b/ArchiSteamFarm.CustomPlugins.ExamplePlugin/CatAPI.cs index f38109b16..ad7df23aa 100644 --- a/ArchiSteamFarm.CustomPlugins.ExamplePlugin/CatAPI.cs +++ b/ArchiSteamFarm.CustomPlugins.ExamplePlugin/CatAPI.cs @@ -58,6 +58,7 @@ namespace ArchiSteamFarm.CustomPlugins.ExamplePlugin { internal readonly string Link; #pragma warning restore 649 + [JsonConstructor] private MeowResponse() { } } } diff --git a/ArchiSteamFarm/GitHub.cs b/ArchiSteamFarm/GitHub.cs index cd75fe2f6..092c05a21 100644 --- a/ArchiSteamFarm/GitHub.cs +++ b/ArchiSteamFarm/GitHub.cs @@ -197,7 +197,7 @@ namespace ArchiSteamFarm { private string _ChangelogHTML; private string _ChangelogPlainText; - // Deserialized from JSON + [JsonConstructor] private ReleaseResponse() { } internal sealed class Asset { @@ -210,7 +210,7 @@ namespace ArchiSteamFarm { [JsonProperty(PropertyName = "size", Required = Required.Always)] internal readonly uint Size; - // Deserialized from JSON + [JsonConstructor] private Asset() { } } } diff --git a/ArchiSteamFarm/IPC/Requests/ASFRequest.cs b/ArchiSteamFarm/IPC/Requests/ASFRequest.cs index d84d9e4c0..2dfd641a8 100644 --- a/ArchiSteamFarm/IPC/Requests/ASFRequest.cs +++ b/ArchiSteamFarm/IPC/Requests/ASFRequest.cs @@ -33,7 +33,7 @@ namespace ArchiSteamFarm.IPC.Requests { [Required] public readonly GlobalConfig GlobalConfig; - // Deserialized from JSON + [JsonConstructor] private ASFRequest() { } } } diff --git a/ArchiSteamFarm/IPC/Requests/BotGamesToRedeemInBackgroundRequest.cs b/ArchiSteamFarm/IPC/Requests/BotGamesToRedeemInBackgroundRequest.cs index 389c0e3b7..7a8e646a4 100644 --- a/ArchiSteamFarm/IPC/Requests/BotGamesToRedeemInBackgroundRequest.cs +++ b/ArchiSteamFarm/IPC/Requests/BotGamesToRedeemInBackgroundRequest.cs @@ -38,7 +38,7 @@ namespace ArchiSteamFarm.IPC.Requests { [Required] public readonly OrderedDictionary GamesToRedeemInBackground; - // Deserialized from JSON + [JsonConstructor] private BotGamesToRedeemInBackgroundRequest() { } } } diff --git a/ArchiSteamFarm/IPC/Requests/BotPauseRequest.cs b/ArchiSteamFarm/IPC/Requests/BotPauseRequest.cs index 8e922ccd3..e98ccb159 100644 --- a/ArchiSteamFarm/IPC/Requests/BotPauseRequest.cs +++ b/ArchiSteamFarm/IPC/Requests/BotPauseRequest.cs @@ -37,7 +37,7 @@ namespace ArchiSteamFarm.IPC.Requests { [JsonProperty(Required = Required.DisallowNull)] public readonly ushort ResumeInSeconds; - // Deserialized from JSON + [JsonConstructor] private BotPauseRequest() { } } } diff --git a/ArchiSteamFarm/IPC/Requests/BotRedeemRequest.cs b/ArchiSteamFarm/IPC/Requests/BotRedeemRequest.cs index 84cb99f98..02f3c2de9 100644 --- a/ArchiSteamFarm/IPC/Requests/BotRedeemRequest.cs +++ b/ArchiSteamFarm/IPC/Requests/BotRedeemRequest.cs @@ -34,7 +34,7 @@ namespace ArchiSteamFarm.IPC.Requests { [Required] public readonly ImmutableHashSet KeysToRedeem; - // Deserialized from JSON + [JsonConstructor] private BotRedeemRequest() { } } } diff --git a/ArchiSteamFarm/IPC/Requests/BotRequest.cs b/ArchiSteamFarm/IPC/Requests/BotRequest.cs index 9354f7596..9195c86ba 100644 --- a/ArchiSteamFarm/IPC/Requests/BotRequest.cs +++ b/ArchiSteamFarm/IPC/Requests/BotRequest.cs @@ -33,7 +33,7 @@ namespace ArchiSteamFarm.IPC.Requests { [Required] public readonly BotConfig BotConfig; - // Deserialized from JSON + [JsonConstructor] private BotRequest() { } } } diff --git a/ArchiSteamFarm/IPC/Requests/WWWSendRequest.cs b/ArchiSteamFarm/IPC/Requests/WWWSendRequest.cs index 373a7e2b3..f88c75901 100644 --- a/ArchiSteamFarm/IPC/Requests/WWWSendRequest.cs +++ b/ArchiSteamFarm/IPC/Requests/WWWSendRequest.cs @@ -36,7 +36,7 @@ namespace ArchiSteamFarm.IPC.Requests { [JsonProperty(Required = Required.Always)] public readonly string URL; - // Deserialized from JSON + [JsonConstructor] private WWWSendRequest() { } } } diff --git a/ArchiSteamFarm/Json/Steam.cs b/ArchiSteamFarm/Json/Steam.cs index d864b329d..aec8cd7ae 100644 --- a/ArchiSteamFarm/Json/Steam.cs +++ b/ArchiSteamFarm/Json/Steam.cs @@ -170,7 +170,7 @@ namespace ArchiSteamFarm.Json { Type = type; } - // Deserialized from JSON + [JsonConstructor] private Asset() { } public enum EType : byte { @@ -189,7 +189,7 @@ namespace ArchiSteamFarm.Json { [JsonProperty(PropertyName = "success", Required = Required.Always)] public readonly bool Success; - // Deserialized from JSON + [JsonConstructor] protected BooleanResponse() { } } @@ -269,7 +269,7 @@ namespace ArchiSteamFarm.Json { } } - // Deserialized from JSON + [JsonConstructor] private ConfirmationDetails() { } // REF: Internal documentation @@ -290,7 +290,7 @@ namespace ArchiSteamFarm.Json { [JsonProperty(PropertyName = "success", Required = Required.Always)] public readonly EResult Result; - // Deserialized from JSON + [JsonConstructor] protected EResultResponse() { } } @@ -319,7 +319,7 @@ namespace ArchiSteamFarm.Json { } } - // Deserialized from JSON + [JsonConstructor] protected NumberResponse() { } } @@ -422,7 +422,7 @@ namespace ArchiSteamFarm.Json { set => MoreItems = value > 0; } - // Deserialized from JSON + [JsonConstructor] private InventoryResponse() { } internal sealed class Description { @@ -462,7 +462,7 @@ namespace ArchiSteamFarm.Json { set => Tradable = value > 0; } - // Deserialized from JSON + [JsonConstructor] private Description() { } } } @@ -472,7 +472,7 @@ namespace ArchiSteamFarm.Json { [JsonProperty(PropertyName = "queue", Required = Required.Always)] internal readonly HashSet Queue; - // Deserialized from JSON + [JsonConstructor] private NewDiscoveryQueueResponse() { } } @@ -487,14 +487,14 @@ namespace ArchiSteamFarm.Json { [JsonProperty(PropertyName = "currency", Required = Required.DisallowNull)] internal readonly ECurrencyCode? WalletCurrencyCode; - // Deserialized from JSON + [JsonConstructor] private RedeemWalletResponse() { } internal sealed class InternalKeyDetails { [JsonProperty(PropertyName = "currencycode", Required = Required.Always)] internal readonly ECurrencyCode CurrencyCode; - // Deserialized from JSON + [JsonConstructor] private InternalKeyDetails() { } } } @@ -504,7 +504,7 @@ namespace ArchiSteamFarm.Json { [JsonProperty(PropertyName = "needs_mobile_confirmation", Required = Required.DisallowNull)] internal readonly bool RequiresMobileConfirmation; - // Deserialized from JSON + [JsonConstructor] private TradeOfferAcceptResponse() { } } @@ -547,7 +547,7 @@ namespace ArchiSteamFarm.Json { } } - // Deserialized from JSON + [JsonConstructor] private TradeOfferSendResponse() { } } @@ -565,7 +565,7 @@ namespace ArchiSteamFarm.Json { CommentPermission = commentPermission; } - // Deserialized from JSON + [JsonConstructor] private UserPrivacy() { } internal sealed class PrivacySettings { @@ -601,7 +601,7 @@ namespace ArchiSteamFarm.Json { InventoryGifts = inventoryGifts; } - // Deserialized from JSON + [JsonConstructor] private PrivacySettings() { } internal enum EPrivacySetting : byte {