diff --git a/ArchiSteamFarm/ArchiHandler.cs b/ArchiSteamFarm/ArchiHandler.cs index fe8bb3bd4..66b8705db 100644 --- a/ArchiSteamFarm/ArchiHandler.cs +++ b/ArchiSteamFarm/ArchiHandler.cs @@ -67,7 +67,7 @@ namespace ArchiSteamFarm { } } - internal readonly List Notifications; + internal readonly HashSet Notifications; internal NotificationsCallback(JobID jobID, CMsgClientUserNotifications msg) { JobID = jobID; @@ -76,7 +76,7 @@ namespace ArchiSteamFarm { return; } - Notifications = new List(msg.notifications.Count); + Notifications = new HashSet(); foreach (var notification in msg.notifications) { Notifications.Add(new Notification((Notification.ENotificationType) notification.user_notification_type)); } @@ -90,7 +90,7 @@ namespace ArchiSteamFarm { } if (msg.count_new_items > 0) { - Notifications = new List(1) { + Notifications = new HashSet() { new Notification(Notification.ENotificationType.Items) }; } @@ -99,7 +99,6 @@ namespace ArchiSteamFarm { internal sealed class OfflineMessageCallback : CallbackMsg { internal readonly uint OfflineMessages; - internal readonly List Users; internal OfflineMessageCallback(JobID jobID, CMsgClientOfflineMessageNotification msg) { JobID = jobID; @@ -109,7 +108,6 @@ namespace ArchiSteamFarm { } OfflineMessages = msg.offline_messages; - Users = msg.friends_with_offline_messages; } } diff --git a/ArchiSteamFarm/ArchiWebHandler.cs b/ArchiSteamFarm/ArchiWebHandler.cs index 099239679..f69dc59fe 100644 --- a/ArchiSteamFarm/ArchiWebHandler.cs +++ b/ArchiSteamFarm/ArchiWebHandler.cs @@ -194,15 +194,13 @@ namespace ArchiSteamFarm { } internal async Task RefreshSessionIfNeeded() { - DateTime now = DateTime.Now; - if (now.Subtract(LastSessionRefreshCheck).TotalSeconds < MinSessionTTL) { + if (DateTime.Now.Subtract(LastSessionRefreshCheck).TotalSeconds < MinSessionTTL) { return true; } await SessionSemaphore.WaitAsync().ConfigureAwait(false); - now = DateTime.Now; - if (now.Subtract(LastSessionRefreshCheck).TotalSeconds < MinSessionTTL) { + if (DateTime.Now.Subtract(LastSessionRefreshCheck).TotalSeconds < MinSessionTTL) { SessionSemaphore.Release(); return true; } @@ -212,8 +210,7 @@ namespace ArchiSteamFarm { bool? isLoggedIn = await IsLoggedIn().ConfigureAwait(false); if (isLoggedIn.GetValueOrDefault(true)) { result = true; - now = DateTime.Now; - LastSessionRefreshCheck = now; + LastSessionRefreshCheck = DateTime.Now; } else { Logging.LogGenericInfo("Refreshing our session!", Bot.BotName); result = await Bot.RefreshSession().ConfigureAwait(false); diff --git a/ArchiSteamFarm/Bot.cs b/ArchiSteamFarm/Bot.cs index a622b5d00..a208f454f 100755 --- a/ArchiSteamFarm/Bot.cs +++ b/ArchiSteamFarm/Bot.cs @@ -1745,7 +1745,7 @@ namespace ArchiSteamFarm { } private void OnOfflineMessage(ArchiHandler.OfflineMessageCallback callback) { - if (callback == null) { + if (callback == null || callback.OfflineMessages == 0) { return; } diff --git a/ArchiSteamFarm/JSON/Steam.cs b/ArchiSteamFarm/JSON/Steam.cs index 40f4c7198..20fe6e0a5 100644 --- a/ArchiSteamFarm/JSON/Steam.cs +++ b/ArchiSteamFarm/JSON/Steam.cs @@ -79,8 +79,8 @@ namespace ArchiSteamFarm { return; } - uint result; - if (!uint.TryParse(value, out result)) { + ulong result; + if (!ulong.TryParse(value, out result)) { return; } @@ -100,8 +100,8 @@ namespace ArchiSteamFarm { return; } - uint result; - if (!uint.TryParse(value, out result)) { + ulong result; + if (!ulong.TryParse(value, out result)) { return; } @@ -127,8 +127,8 @@ namespace ArchiSteamFarm { return; } - uint result; - if (!uint.TryParse(value, out result)) { + ulong result; + if (!ulong.TryParse(value, out result)) { return; } @@ -148,8 +148,8 @@ namespace ArchiSteamFarm { return; } - uint result; - if (!uint.TryParse(value, out result)) { + ulong result; + if (!ulong.TryParse(value, out result)) { return; } @@ -337,7 +337,7 @@ namespace ArchiSteamFarm { internal bool NewVersion { get; } = true; [JsonProperty(PropertyName = "version", Required = Required.Always)] - internal int Version { get; } = 2; + internal byte Version { get; } = 2; [JsonProperty(PropertyName = "me", Required = Required.Always)] internal ItemList ItemsToGive { get; } = new ItemList(); diff --git a/ArchiSteamFarm/WebBrowser.cs b/ArchiSteamFarm/WebBrowser.cs index c5b847e84..693d98f5c 100644 --- a/ArchiSteamFarm/WebBrowser.cs +++ b/ArchiSteamFarm/WebBrowser.cs @@ -213,7 +213,7 @@ namespace ArchiSteamFarm { return null; } - if (request.StartsWith("https://") && Program.GlobalConfig.ForceHttp) { + if (request.StartsWith("https://", StringComparison.Ordinal) && Program.GlobalConfig.ForceHttp) { return null; }