mirror of
https://github.com/JustArchiNET/ArchiSteamFarm.git
synced 2026-01-16 08:25:28 +00:00
Code cleanups and improvements
- Make use of new UnixFileMode, always one native method we need to maintain less - Add madness support for it, because new feature of course - Add optional netstandard target and required compatibility for it, so I can test netf-oriented changes easier
This commit is contained in:
@@ -65,7 +65,7 @@ public sealed class WebBrowser : IDisposable {
|
||||
HttpClientHandler = new HttpClientHandler {
|
||||
AllowAutoRedirect = false, // This must be false if we want to handle custom redirection schemes such as "steammobile://"
|
||||
|
||||
#if NETFRAMEWORK
|
||||
#if NETFRAMEWORK || NETSTANDARD
|
||||
AutomaticDecompression = DecompressionMethods.Deflate | DecompressionMethods.GZip,
|
||||
#else
|
||||
AutomaticDecompression = DecompressionMethods.All,
|
||||
@@ -85,7 +85,7 @@ public sealed class WebBrowser : IDisposable {
|
||||
}
|
||||
}
|
||||
|
||||
#if NETFRAMEWORK
|
||||
#if NETFRAMEWORK || NETSTANDARD
|
||||
if (!RuntimeMadness.IsRunningOnMono) {
|
||||
HttpClientHandler.MaxConnectionsPerServer = MaxConnections;
|
||||
}
|
||||
@@ -106,7 +106,7 @@ public sealed class WebBrowser : IDisposable {
|
||||
byte connectionTimeout = ASF.GlobalConfig?.ConnectionTimeout ?? GlobalConfig.DefaultConnectionTimeout;
|
||||
|
||||
HttpClient result = new(HttpClientHandler, false) {
|
||||
#if !NETFRAMEWORK
|
||||
#if !NETFRAMEWORK && !NETSTANDARD
|
||||
DefaultRequestVersion = HttpVersion.Version30,
|
||||
#endif
|
||||
Timeout = TimeSpan.FromSeconds(extendedTimeout ? ExtendedTimeout : connectionTimeout)
|
||||
@@ -662,7 +662,7 @@ public sealed class WebBrowser : IDisposable {
|
||||
using StreamReader streamReader = new(response.Content);
|
||||
|
||||
#pragma warning disable CA2000 // False positive, we're actually wrapping it in the using clause below exactly for that purpose
|
||||
JsonReader jsonReader = new JsonTextReader(streamReader);
|
||||
JsonTextReader jsonReader = new(streamReader);
|
||||
#pragma warning restore CA2000 // False positive, we're actually wrapping it in the using clause below exactly for that purpose
|
||||
|
||||
await using (jsonReader.ConfigureAwait(false)) {
|
||||
@@ -766,7 +766,7 @@ public sealed class WebBrowser : IDisposable {
|
||||
ServicePointManager.Expect100Continue = false;
|
||||
|
||||
// Reuse ports if possible
|
||||
#if NETFRAMEWORK
|
||||
#if NETFRAMEWORK || NETSTANDARD
|
||||
if (!RuntimeMadness.IsRunningOnMono) {
|
||||
ServicePointManager.ReusePort = true;
|
||||
}
|
||||
@@ -801,7 +801,7 @@ public sealed class WebBrowser : IDisposable {
|
||||
|
||||
while (true) {
|
||||
using (HttpRequestMessage requestMessage = new(httpMethod, request)) {
|
||||
#if !NETFRAMEWORK
|
||||
#if !NETFRAMEWORK && !NETSTANDARD
|
||||
requestMessage.Version = HttpClient.DefaultRequestVersion;
|
||||
#endif
|
||||
|
||||
|
||||
@@ -59,7 +59,7 @@ internal static class WebBrowserUtilities {
|
||||
private static (Stream CompressionInput, string ContentEncoding) GetBestSupportedCompressionMethod(Stream output) {
|
||||
ArgumentNullException.ThrowIfNull(output);
|
||||
|
||||
#if NETFRAMEWORK
|
||||
#if NETFRAMEWORK || NETSTANDARD
|
||||
return (new GZipStream(output, CompressionLevel.Optimal, true), "gzip");
|
||||
#else
|
||||
return (new BrotliStream(output, CompressionLevel.SmallestSize, true), "br");
|
||||
|
||||
Reference in New Issue
Block a user