From c95653e72b964808b399d92e6bd029036d8c5e5f Mon Sep 17 00:00:00 2001 From: JustArchi Date: Fri, 14 Dec 2018 16:07:46 +0100 Subject: [PATCH] Code review --- ArchiSteamFarm/ArchiWebHandler.cs | 5 +++-- ArchiSteamFarm/IPC/Controllers/Api/NLogController.cs | 2 +- ArchiSteamFarm/Statistics.cs | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ArchiSteamFarm/ArchiWebHandler.cs b/ArchiSteamFarm/ArchiWebHandler.cs index cf50a6c28..ca82ab678 100644 --- a/ArchiSteamFarm/ArchiWebHandler.cs +++ b/ArchiSteamFarm/ArchiWebHandler.cs @@ -21,6 +21,7 @@ using System; using System.Collections.Generic; +using System.Collections.Immutable; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Net; @@ -53,11 +54,11 @@ namespace ArchiSteamFarm { private static readonly SemaphoreSlim InventorySemaphore = new SemaphoreSlim(1, 1); - private static readonly Dictionary WebLimitingSemaphores = new Dictionary(3) { + private static readonly ImmutableDictionary WebLimitingSemaphores = new Dictionary(3) { { SteamCommunityURL, (new SemaphoreSlim(1, 1), new SemaphoreSlim(WebBrowser.MaxConnections, WebBrowser.MaxConnections)) }, { SteamStoreURL, (new SemaphoreSlim(1, 1), new SemaphoreSlim(WebBrowser.MaxConnections, WebBrowser.MaxConnections)) }, { WebAPI.DefaultBaseAddress.Host, (new SemaphoreSlim(1, 1), new SemaphoreSlim(WebBrowser.MaxConnections, WebBrowser.MaxConnections)) } - }; + }.ToImmutableDictionary(); private readonly Bot Bot; private readonly ArchiCachable CachedApiKey; diff --git a/ArchiSteamFarm/IPC/Controllers/Api/NLogController.cs b/ArchiSteamFarm/IPC/Controllers/Api/NLogController.cs index fbd7a4bfa..3003517f4 100644 --- a/ArchiSteamFarm/IPC/Controllers/Api/NLogController.cs +++ b/ArchiSteamFarm/IPC/Controllers/Api/NLogController.cs @@ -75,7 +75,7 @@ namespace ArchiSteamFarm.IPC.Controllers.Api { break; } - await webSocket.CloseAsync(WebSocketCloseStatus.NormalClosure, string.Empty, CancellationToken.None).ConfigureAwait(false); + await webSocket.CloseAsync(WebSocketCloseStatus.NormalClosure, "", CancellationToken.None).ConfigureAwait(false); break; } } finally { diff --git a/ArchiSteamFarm/Statistics.cs b/ArchiSteamFarm/Statistics.cs index ebfa2d263..cdc70d7b7 100644 --- a/ArchiSteamFarm/Statistics.cs +++ b/ArchiSteamFarm/Statistics.cs @@ -21,6 +21,7 @@ using System; using System.Collections.Generic; +using System.Collections.Immutable; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Threading; @@ -40,12 +41,12 @@ namespace ArchiSteamFarm { private const byte MinPersonaStateTTL = 8; // Minimum amount of hours we must wait before requesting persona state update private const string URL = "https://" + SharedInfo.StatisticsServer; - private static readonly HashSet AcceptedMatchableTypes = new HashSet { + private static readonly ImmutableHashSet AcceptedMatchableTypes = ImmutableHashSet.Create( Steam.Asset.EType.Emoticon, Steam.Asset.EType.FoilTradingCard, Steam.Asset.EType.ProfileBackground, Steam.Asset.EType.TradingCard - }; + ); private readonly Bot Bot; private readonly SemaphoreSlim MatchActivelySemaphore = new SemaphoreSlim(1, 1);