From 44c5bf4ad5d6958f920ebd906253fc4f9d6c30ec Mon Sep 17 00:00:00 2001 From: JustArchi Date: Thu, 4 Apr 2019 17:56:38 +0200 Subject: [PATCH] Misc --- ArchiSteamFarm/BotDatabase.cs | 3 +-- ArchiSteamFarm/GlobalDatabase.cs | 3 +-- ArchiSteamFarm/MobileAuthenticator.cs | 1 + ArchiSteamFarm/Statistics.cs | 4 ++++ ArchiSteamFarm/SteamKit2/ServerRecordEndPoint.cs | 1 + 5 files changed, 8 insertions(+), 4 deletions(-) diff --git a/ArchiSteamFarm/BotDatabase.cs b/ArchiSteamFarm/BotDatabase.cs index eb6f0f7ce..532f2f8df 100644 --- a/ArchiSteamFarm/BotDatabase.cs +++ b/ArchiSteamFarm/BotDatabase.cs @@ -67,7 +67,6 @@ namespace ArchiSteamFarm { private string FilePath; private bool ReadOnly; - // This constructor is used when creating new database private BotDatabase([NotNull] string filePath) { if (string.IsNullOrEmpty(filePath)) { throw new ArgumentNullException(nameof(filePath)); @@ -76,7 +75,7 @@ namespace ArchiSteamFarm { FilePath = filePath; } - // This constructor is used only by deserializer + [JsonConstructor] private BotDatabase() { } public void Dispose() => FileSemaphore.Dispose(); diff --git a/ArchiSteamFarm/GlobalDatabase.cs b/ArchiSteamFarm/GlobalDatabase.cs index 35bb3a6c4..d78497299 100644 --- a/ArchiSteamFarm/GlobalDatabase.cs +++ b/ArchiSteamFarm/GlobalDatabase.cs @@ -49,7 +49,6 @@ namespace ArchiSteamFarm { private string FilePath; - // This constructor is used when creating new database private GlobalDatabase([NotNull] string filePath) : this() { if (string.IsNullOrEmpty(filePath)) { throw new ArgumentNullException(nameof(filePath)); @@ -58,7 +57,7 @@ namespace ArchiSteamFarm { FilePath = filePath; } - // This constructor is used only by deserializer + [JsonConstructor] private GlobalDatabase() => ServerListProvider.ServerListUpdated += OnServerListUpdated; public void Dispose() { diff --git a/ArchiSteamFarm/MobileAuthenticator.cs b/ArchiSteamFarm/MobileAuthenticator.cs index cc6018d5e..b655391f8 100644 --- a/ArchiSteamFarm/MobileAuthenticator.cs +++ b/ArchiSteamFarm/MobileAuthenticator.cs @@ -63,6 +63,7 @@ namespace ArchiSteamFarm { [JsonProperty(PropertyName = "device_id")] private string DeviceID; + [JsonConstructor] private MobileAuthenticator() { } internal void CorrectDeviceID(string deviceID) { diff --git a/ArchiSteamFarm/Statistics.cs b/ArchiSteamFarm/Statistics.cs index f1b673a89..001097526 100644 --- a/ArchiSteamFarm/Statistics.cs +++ b/ArchiSteamFarm/Statistics.cs @@ -559,6 +559,7 @@ namespace ArchiSteamFarm { return skippedSetsThisRound.Count > 0; } + [SuppressMessage("ReSharper", "ClassCannotBeInstantiated")] private sealed class ListedUser { internal readonly HashSet MatchableTypes = new HashSet(); @@ -685,6 +686,9 @@ namespace ArchiSteamFarm { } } } + + [JsonConstructor] + private ListedUser() { } } } } diff --git a/ArchiSteamFarm/SteamKit2/ServerRecordEndPoint.cs b/ArchiSteamFarm/SteamKit2/ServerRecordEndPoint.cs index dcf1269f8..864b47ee7 100644 --- a/ArchiSteamFarm/SteamKit2/ServerRecordEndPoint.cs +++ b/ArchiSteamFarm/SteamKit2/ServerRecordEndPoint.cs @@ -45,6 +45,7 @@ namespace ArchiSteamFarm.SteamKit2 { ProtocolTypes = protocolTypes; } + [JsonConstructor] private ServerRecordEndPoint() { } public bool Equals(ServerRecordEndPoint other) => (other != null) && (ReferenceEquals(other, this) || ((Host == other.Host) && (Port == other.Port) && (ProtocolTypes == other.ProtocolTypes)));