diff --git a/CollapseLauncher/Classes/Helper/HttpClientBuilder.cs b/CollapseLauncher/Classes/Helper/HttpClientBuilder.cs index 71526b5b2..0c231434c 100644 --- a/CollapseLauncher/Classes/Helper/HttpClientBuilder.cs +++ b/CollapseLauncher/Classes/Helper/HttpClientBuilder.cs @@ -2,7 +2,6 @@ using Hi3Helper.Shared.Region; using System; using System.Collections.Generic; -using System.Diagnostics; using System.Net; using System.Net.Http; using System.Net.Security; @@ -15,8 +14,8 @@ public class HttpClientBuilder : HttpClientBuilder; public class HttpClientBuilder where THandler : HttpMessageHandler, new() { - private const int _maxConnectionsDefault = 32; - private const double _httpTimeoutDefault = 90; // in Seconds + private const int MaxConnectionsDefault = 32; + private const double HttpTimeoutDefault = 90; // in Seconds private bool IsUseProxy { get; set; } = true; private bool IsUseSystemProxy { get; set; } = true; @@ -24,14 +23,14 @@ public class HttpClientBuilder : HttpClientBuilder; private bool IsAllowHttpCookies { get; set; } private bool IsAllowUntrustedCert { get; set; } - private int MaxConnections { get; set; } = _maxConnectionsDefault; + private int MaxConnections { get; set; } = MaxConnectionsDefault; private DecompressionMethods DecompressionMethod { get; set; } = DecompressionMethods.All; private WebProxy? ExternalProxy { get; set; } private Version HttpProtocolVersion { get; set; } = HttpVersion.Version30; private string? HttpUserAgent { get; set; } = GetDefaultUserAgent(); private string? HttpAuthHeader { get; set; } private HttpVersionPolicy HttpProtocolVersionPolicy { get; set; } = HttpVersionPolicy.RequestVersionOrLower; - private TimeSpan HttpTimeout { get; set; } = TimeSpan.FromSeconds(_httpTimeoutDefault); + private TimeSpan HttpTimeout { get; set; } = TimeSpan.FromSeconds(HttpTimeoutDefault); private Uri? HttpBaseUri { get; set; } private Dictionary HttpHeaders { get; set; } = new(StringComparer.OrdinalIgnoreCase); @@ -80,7 +79,7 @@ public HttpClientBuilder UseExternalProxy(Uri hostUri, string? usernam return this; } - public HttpClientBuilder UseLauncherConfig(int maxConnections = _maxConnectionsDefault) + public HttpClientBuilder UseLauncherConfig(int maxConnections = MaxConnectionsDefault) { bool lIsUseProxy = LauncherConfig.GetAppConfigValue("IsUseProxy").ToBool(); bool lIsAllowHttpRedirections = LauncherConfig.GetAppConfigValue("IsAllowHttpRedirections").ToBool(); @@ -111,7 +110,7 @@ public HttpClientBuilder UseLauncherConfig(int maxConnections = _maxCo return this; } - public HttpClientBuilder SetMaxConnection(int maxConnections = _maxConnectionsDefault) + public HttpClientBuilder SetMaxConnection(int maxConnections = MaxConnectionsDefault) { if (maxConnections < 2) maxConnections = 2; @@ -159,18 +158,18 @@ public HttpClientBuilder SetHttpVersion(Version? version = null, HttpV return this; } - public HttpClientBuilder SetTimeout(double fromSeconds = _httpTimeoutDefault) + public HttpClientBuilder SetTimeout(double fromSeconds = HttpTimeoutDefault) { if (double.IsNaN(fromSeconds) || double.IsInfinity(fromSeconds)) - fromSeconds = _httpTimeoutDefault; + fromSeconds = HttpTimeoutDefault; return SetTimeout(TimeSpan.FromSeconds(fromSeconds)); } public HttpClientBuilder SetTimeout(TimeSpan? timeout = null) { - timeout ??= TimeSpan.FromSeconds(_httpTimeoutDefault); - HttpTimeout = timeout.Value; + timeout ??= TimeSpan.FromSeconds(HttpTimeoutDefault); + HttpTimeout = timeout.Value; return this; } diff --git a/CollapseLauncher/Program.cs b/CollapseLauncher/Program.cs index 35f079d1a..d91f39fc6 100644 --- a/CollapseLauncher/Program.cs +++ b/CollapseLauncher/Program.cs @@ -6,7 +6,6 @@ using Hi3Helper.Http.Legacy; using Hi3Helper.SentryHelper; using Hi3Helper.Shared.ClassStruct; -using Hi3Helper.Shared.Region; using Hi3Helper.Win32.Native.LibraryImport; using Hi3Helper.Win32.Native.ManagedTools; using Hi3Helper.Win32.ShellLinkCOM; diff --git a/Hi3Helper.Core/Classes/Logger/Type/LoggerNull.cs b/Hi3Helper.Core/Classes/Logger/Type/LoggerNull.cs index 500562cfc..3b90eef4f 100644 --- a/Hi3Helper.Core/Classes/Logger/Type/LoggerNull.cs +++ b/Hi3Helper.Core/Classes/Logger/Type/LoggerNull.cs @@ -1,4 +1,5 @@ using System.Text; +// ReSharper disable MethodOverloadWithOptionalParameter namespace Hi3Helper { @@ -9,7 +10,7 @@ public class LoggerNull(string folderPath, Encoding encoding) : LoggerBase(folde #region Methods public void Dispose() => DisposeBase(); public override void LogWriteLine() { } - public override void LogWriteLine(string _ = null) { } + public override void LogWriteLine(string line = null) { } public override void LogWriteLine(string line, LogType type) { } public override void LogWriteLine(string line, LogType type, bool writeToLog) {