Skip to content

Commit 2d1ad71

Browse files
committed
Make CodeQA happy
1 parent 5663c80 commit 2d1ad71

File tree

3 files changed

+12
-13
lines changed

3 files changed

+12
-13
lines changed

CollapseLauncher/Classes/Helper/HttpClientBuilder.cs

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
using Hi3Helper.Shared.Region;
33
using System;
44
using System.Collections.Generic;
5-
using System.Diagnostics;
65
using System.Net;
76
using System.Net.Http;
87
using System.Net.Security;
@@ -15,23 +14,23 @@ public class HttpClientBuilder : HttpClientBuilder<SocketsHttpHandler>;
1514

1615
public class HttpClientBuilder<THandler> where THandler : HttpMessageHandler, new()
1716
{
18-
private const int _maxConnectionsDefault = 32;
19-
private const double _httpTimeoutDefault = 90; // in Seconds
17+
private const int MaxConnectionsDefault = 32;
18+
private const double HttpTimeoutDefault = 90; // in Seconds
2019

2120
private bool IsUseProxy { get; set; } = true;
2221
private bool IsUseSystemProxy { get; set; } = true;
2322
private bool IsAllowHttpRedirections { get; set; }
2423
private bool IsAllowHttpCookies { get; set; }
2524
private bool IsAllowUntrustedCert { get; set; }
2625

27-
private int MaxConnections { get; set; } = _maxConnectionsDefault;
26+
private int MaxConnections { get; set; } = MaxConnectionsDefault;
2827
private DecompressionMethods DecompressionMethod { get; set; } = DecompressionMethods.All;
2928
private WebProxy? ExternalProxy { get; set; }
3029
private Version HttpProtocolVersion { get; set; } = HttpVersion.Version30;
3130
private string? HttpUserAgent { get; set; } = GetDefaultUserAgent();
3231
private string? HttpAuthHeader { get; set; }
3332
private HttpVersionPolicy HttpProtocolVersionPolicy { get; set; } = HttpVersionPolicy.RequestVersionOrLower;
34-
private TimeSpan HttpTimeout { get; set; } = TimeSpan.FromSeconds(_httpTimeoutDefault);
33+
private TimeSpan HttpTimeout { get; set; } = TimeSpan.FromSeconds(HttpTimeoutDefault);
3534
private Uri? HttpBaseUri { get; set; }
3635
private Dictionary<string, string?> HttpHeaders { get; set; } = new(StringComparer.OrdinalIgnoreCase);
3736

@@ -80,7 +79,7 @@ public HttpClientBuilder<THandler> UseExternalProxy(Uri hostUri, string? usernam
8079
return this;
8180
}
8281

83-
public HttpClientBuilder<THandler> UseLauncherConfig(int maxConnections = _maxConnectionsDefault)
82+
public HttpClientBuilder<THandler> UseLauncherConfig(int maxConnections = MaxConnectionsDefault)
8483
{
8584
bool lIsUseProxy = LauncherConfig.GetAppConfigValue("IsUseProxy").ToBool();
8685
bool lIsAllowHttpRedirections = LauncherConfig.GetAppConfigValue("IsAllowHttpRedirections").ToBool();
@@ -111,7 +110,7 @@ public HttpClientBuilder<THandler> UseLauncherConfig(int maxConnections = _maxCo
111110
return this;
112111
}
113112

114-
public HttpClientBuilder<THandler> SetMaxConnection(int maxConnections = _maxConnectionsDefault)
113+
public HttpClientBuilder<THandler> SetMaxConnection(int maxConnections = MaxConnectionsDefault)
115114
{
116115
if (maxConnections < 2)
117116
maxConnections = 2;
@@ -159,18 +158,18 @@ public HttpClientBuilder<THandler> SetHttpVersion(Version? version = null, HttpV
159158
return this;
160159
}
161160

162-
public HttpClientBuilder<THandler> SetTimeout(double fromSeconds = _httpTimeoutDefault)
161+
public HttpClientBuilder<THandler> SetTimeout(double fromSeconds = HttpTimeoutDefault)
163162
{
164163
if (double.IsNaN(fromSeconds) || double.IsInfinity(fromSeconds))
165-
fromSeconds = _httpTimeoutDefault;
164+
fromSeconds = HttpTimeoutDefault;
166165

167166
return SetTimeout(TimeSpan.FromSeconds(fromSeconds));
168167
}
169168

170169
public HttpClientBuilder<THandler> SetTimeout(TimeSpan? timeout = null)
171170
{
172-
timeout ??= TimeSpan.FromSeconds(_httpTimeoutDefault);
173-
HttpTimeout = timeout.Value;
171+
timeout ??= TimeSpan.FromSeconds(HttpTimeoutDefault);
172+
HttpTimeout = timeout.Value;
174173
return this;
175174
}
176175

CollapseLauncher/Program.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
using Hi3Helper.Http.Legacy;
77
using Hi3Helper.SentryHelper;
88
using Hi3Helper.Shared.ClassStruct;
9-
using Hi3Helper.Shared.Region;
109
using Hi3Helper.Win32.Native.LibraryImport;
1110
using Hi3Helper.Win32.Native.ManagedTools;
1211
using Hi3Helper.Win32.ShellLinkCOM;

Hi3Helper.Core/Classes/Logger/Type/LoggerNull.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
using System.Text;
2+
// ReSharper disable MethodOverloadWithOptionalParameter
23

34
namespace Hi3Helper
45
{
@@ -9,7 +10,7 @@ public class LoggerNull(string folderPath, Encoding encoding) : LoggerBase(folde
910
#region Methods
1011
public void Dispose() => DisposeBase();
1112
public override void LogWriteLine() { }
12-
public override void LogWriteLine(string _ = null) { }
13+
public override void LogWriteLine(string line = null) { }
1314
public override void LogWriteLine(string line, LogType type) { }
1415
public override void LogWriteLine(string line, LogType type, bool writeToLog)
1516
{

0 commit comments

Comments
 (0)