mirror of
https://github.com/JustArchiNET/ArchiSteamFarm
synced 2024-11-10 07:04:27 +00:00
Document all the pragmas, final code corrections
This commit is contained in:
parent
8605c71f81
commit
daf37c723c
15 changed files with 85 additions and 79 deletions
|
@ -52,7 +52,7 @@ namespace ArchiSteamFarm.CustomPlugins.ExamplePlugin {
|
|||
return Uri.EscapeUriString(response.Content!.Link!);
|
||||
}
|
||||
|
||||
#pragma warning disable CA1812 // False positive
|
||||
#pragma warning disable CA1812 // False positive, the class is used during json deserialization
|
||||
[SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
|
||||
private sealed class MeowResponse {
|
||||
[JsonProperty(PropertyName = "file", Required = Required.Always)]
|
||||
|
@ -61,6 +61,6 @@ namespace ArchiSteamFarm.CustomPlugins.ExamplePlugin {
|
|||
[JsonConstructor]
|
||||
private MeowResponse() { }
|
||||
}
|
||||
#pragma warning restore CA1812 // False positive
|
||||
#pragma warning restore CA1812 // False positive, the class is used during json deserialization
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,41 +23,41 @@ using System.Diagnostics.CodeAnalysis;
|
|||
using Newtonsoft.Json;
|
||||
|
||||
namespace ArchiSteamFarm.OfficialPlugins.SteamTokenDumper {
|
||||
#pragma warning disable CA1812 // False positive
|
||||
#pragma warning disable CA1812 // False positive, the class is used during json deserialization
|
||||
[SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
|
||||
internal sealed class ResponseData {
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // False positive, the field is used during json deserialization
|
||||
[JsonProperty(PropertyName = "data", Required = Required.DisallowNull)]
|
||||
internal readonly InternalData? Data;
|
||||
#pragma warning restore CS0649
|
||||
#pragma warning restore CS0649 // False positive, the field is used during json deserialization
|
||||
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // False positive, the field is used during json deserialization
|
||||
[JsonProperty(PropertyName = "success", Required = Required.Always)]
|
||||
internal readonly bool Success;
|
||||
#pragma warning restore CS0649
|
||||
#pragma warning restore CS0649 // False positive, the field is used during json deserialization
|
||||
|
||||
[JsonConstructor]
|
||||
private ResponseData() { }
|
||||
|
||||
internal sealed class InternalData {
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // False positive, the field is used during json deserialization
|
||||
[JsonProperty(PropertyName = "new_apps", Required = Required.Always)]
|
||||
internal readonly uint NewAppsCount;
|
||||
#pragma warning restore CS0649
|
||||
#pragma warning restore CS0649 // False positive, the field is used during json deserialization
|
||||
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // False positive, the field is used during json deserialization
|
||||
[JsonProperty(PropertyName = "new_depots", Required = Required.Always)]
|
||||
internal readonly uint NewDepotsCount;
|
||||
#pragma warning restore CS0649
|
||||
#pragma warning restore CS0649 // False positive, the field is used during json deserialization
|
||||
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // False positive, the field is used during json deserialization
|
||||
[JsonProperty(PropertyName = "new_subs", Required = Required.Always)]
|
||||
internal readonly uint NewSubsCount;
|
||||
#pragma warning restore CS0649
|
||||
#pragma warning restore CS0649 // False positive, the field is used during json deserialization
|
||||
|
||||
[JsonConstructor]
|
||||
private InternalData() { }
|
||||
}
|
||||
}
|
||||
#pragma warning restore CA1812 // False positive
|
||||
#pragma warning restore CA1812 // False positive, the class is used during json deserialization
|
||||
}
|
||||
|
|
|
@ -351,17 +351,17 @@ namespace ArchiSteamFarm {
|
|||
ArchiLogger.LogGenericWarningException(e);
|
||||
}
|
||||
|
||||
MemoryStream memoryStream = new(response.Content as byte[] ?? response.Content.ToArray());
|
||||
MemoryStream ms = new(response.Content as byte[] ?? response.Content.ToArray());
|
||||
|
||||
try {
|
||||
#if NETFRAMEWORK
|
||||
#pragma warning disable CA1508 // False positive
|
||||
using (memoryStream) {
|
||||
#pragma warning restore CA1508 // False positive
|
||||
#pragma warning disable CA1508 // False positive, ms is not null here indeed, but using clause is needed for dispose
|
||||
using (ms) {
|
||||
#pragma warning restore CA1508 // False positive, ms is not null here indeed, but using clause is needed for dispose
|
||||
#else
|
||||
await using (memoryStream.ConfigureAwait(false)) {
|
||||
await using (ms.ConfigureAwait(false)) {
|
||||
#endif
|
||||
using ZipArchive zipArchive = new(memoryStream);
|
||||
using ZipArchive zipArchive = new(ms);
|
||||
|
||||
if (!UpdateFromArchive(zipArchive, SharedInfo.HomeDirectory)) {
|
||||
ArchiLogger.LogGenericError(Strings.WarningFailed);
|
||||
|
|
|
@ -2608,9 +2608,9 @@ namespace ArchiSteamFarm {
|
|||
// Extra entry for sessionID
|
||||
Dictionary<string, string> data = new(4, StringComparer.Ordinal) {
|
||||
{ "agreeToTerms", "agreed" },
|
||||
#pragma warning disable CA1308
|
||||
#pragma warning disable CA1308 // False positive, we're intentionally converting this part to lowercase and it's not used for any security decisions based on the result of the normalization
|
||||
{ "domain", "generated.by." + SharedInfo.AssemblyName.ToLowerInvariant() + ".localhost" },
|
||||
#pragma warning restore CA1308
|
||||
#pragma warning restore CA1308 // False positive, we're intentionally converting this part to lowercase and it's not used for any security decisions based on the result of the normalization
|
||||
{ "Submit", "Register" }
|
||||
};
|
||||
|
||||
|
|
|
@ -720,9 +720,9 @@ namespace ArchiSteamFarm {
|
|||
throw new ArgumentNullException(nameof(appIDs));
|
||||
}
|
||||
|
||||
#pragma warning disable CA1508 // False positive
|
||||
#pragma warning disable CA1508 // False positive, not every IReadOnlyCollection is ISet, and this is public API
|
||||
ISet<uint> uniqueAppIDs = appIDs as ISet<uint> ?? appIDs.ToHashSet();
|
||||
#pragma warning restore CA1508 // False positive
|
||||
#pragma warning restore CA1508 // False positive, not every IReadOnlyCollection is ISet, and this is public API
|
||||
|
||||
switch (ASF.GlobalConfig?.OptimizationMode) {
|
||||
case GlobalConfig.EOptimizationMode.MinMemoryUsage:
|
||||
|
@ -2197,15 +2197,15 @@ namespace ArchiSteamFarm {
|
|||
throw new ArgumentNullException(nameof(paymentMethod));
|
||||
}
|
||||
|
||||
#pragma warning disable CA2248
|
||||
#pragma warning disable CA2248 // This is actually a fair warning, EPaymentMethod is not a flags enum on itself, but there is nothing we can do about Steam using it like that here
|
||||
return paymentMethod switch {
|
||||
EPaymentMethod.ActivationCode => false,
|
||||
EPaymentMethod.Complimentary => false,
|
||||
EPaymentMethod.GuestPass => false,
|
||||
EPaymentMethod.HardwarePromo => false,
|
||||
_ => !paymentMethod.HasFlag(EPaymentMethod.Complimentary) // Complimentary is also a flag, for fuck sake
|
||||
_ => !paymentMethod.HasFlag(EPaymentMethod.Complimentary) // Complimentary can also be a flag
|
||||
};
|
||||
#pragma warning restore CA2248
|
||||
#pragma warning restore CA2248 // This is actually a fair warning, EPaymentMethod is not a flags enum on itself, but there is nothing we can do about Steam using it like that here
|
||||
}
|
||||
|
||||
private async Task JoinMasterChatGroupID() {
|
||||
|
@ -3025,14 +3025,14 @@ namespace ArchiSteamFarm {
|
|||
byte[] sentryHash;
|
||||
|
||||
try {
|
||||
FileStream fileStream;
|
||||
#pragma warning disable CA2000 // False positive, we're actually wrapping it in the using clause below exactly for that purpose
|
||||
FileStream fileStream = File.Open(sentryFilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite);
|
||||
#pragma warning restore CA2000 // False positive, we're actually wrapping it in the using clause below exactly for that purpose
|
||||
|
||||
#if NETFRAMEWORK
|
||||
using (fileStream = File.Open(sentryFilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite)) {
|
||||
using (fileStream) {
|
||||
#else
|
||||
#pragma warning disable CA2000 // False positive
|
||||
await using ((fileStream = File.Open(sentryFilePath, FileMode.OpenOrCreate, FileAccess.ReadWrite)).ConfigureAwait(false)) {
|
||||
#pragma warning restore CA2000 // False positive
|
||||
await using (fileStream.ConfigureAwait(false)) {
|
||||
#endif
|
||||
fileStream.Seek(callback.Offset, SeekOrigin.Begin);
|
||||
|
||||
|
@ -3045,11 +3045,11 @@ namespace ArchiSteamFarm {
|
|||
fileSize = fileStream.Length;
|
||||
fileStream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
#pragma warning disable CA5350
|
||||
#pragma warning disable CA5350 // This is actually a fair warning, but there is nothing we can do about Steam using weak cryptographic algorithms
|
||||
using SHA1CryptoServiceProvider sha = new();
|
||||
|
||||
sentryHash = await sha.ComputeHashAsync(fileStream).ConfigureAwait(false);
|
||||
#pragma warning restore CA5350
|
||||
#pragma warning restore CA5350 // This is actually a fair warning, but there is nothing we can do about Steam using weak cryptographic algorithms
|
||||
}
|
||||
} catch (Exception e) {
|
||||
ArchiLogger.LogGenericException(e);
|
||||
|
@ -3091,9 +3091,9 @@ namespace ArchiSteamFarm {
|
|||
string? avatarHash = null;
|
||||
|
||||
if ((callback.AvatarHash.Length > 0) && callback.AvatarHash.Any(singleByte => singleByte != 0)) {
|
||||
#pragma warning disable CA1308
|
||||
#pragma warning disable CA1308 // False positive, we're intentionally converting this part to lowercase and it's not used for any security decisions based on the result of the normalization
|
||||
avatarHash = BitConverter.ToString(callback.AvatarHash).Replace("-", "", StringComparison.Ordinal).ToLowerInvariant();
|
||||
#pragma warning restore CA1308
|
||||
#pragma warning restore CA1308 // False positive, we're intentionally converting this part to lowercase and it's not used for any security decisions based on the result of the normalization
|
||||
|
||||
if (string.IsNullOrEmpty(avatarHash) || avatarHash.All(singleChar => singleChar == '0')) {
|
||||
avatarHash = null;
|
||||
|
|
|
@ -179,9 +179,9 @@ namespace ArchiSteamFarm.Helpers {
|
|||
}
|
||||
|
||||
try {
|
||||
#pragma warning disable CA1508 // False positive
|
||||
#pragma warning disable CA1508 // False positive, FileStream is not null here indeed, but using clause is needed for dispose
|
||||
using (new FileStream(FilePath, FileMode.CreateNew)) { }
|
||||
#pragma warning restore CA1508 // False positive
|
||||
#pragma warning restore CA1508 // False positive, FileStream is not null here indeed, but using clause is needed for dispose
|
||||
|
||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) {
|
||||
FileInfo fileInfo = new(FilePath);
|
||||
|
|
|
@ -152,9 +152,9 @@ namespace ArchiSteamFarm.IPC.Controllers.Api {
|
|||
}
|
||||
|
||||
try {
|
||||
#pragma warning disable CA1508 // False positive
|
||||
#pragma warning disable CA1508 // False positive, webSocket state could change between our previous check and this one due to semaphore wait
|
||||
if (cancellationToken.IsCancellationRequested || (webSocket.State != WebSocketState.Open)) {
|
||||
#pragma warning restore CA1508 // False positive
|
||||
#pragma warning restore CA1508 // False positive, webSocket state could change between our previous check and this one due to semaphore wait
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -315,11 +315,11 @@ namespace ArchiSteamFarm {
|
|||
|
||||
byte[] hash;
|
||||
|
||||
#pragma warning disable CA5350
|
||||
#pragma warning disable CA5350 // This is actually a fair warning, but there is nothing we can do about Steam using weak cryptographic algorithms
|
||||
using (HMACSHA1 hmac = new(identitySecret)) {
|
||||
hash = hmac.ComputeHash(buffer);
|
||||
}
|
||||
#pragma warning restore CA5350
|
||||
#pragma warning restore CA5350 // This is actually a fair warning, but there is nothing we can do about Steam using weak cryptographic algorithms
|
||||
|
||||
return Convert.ToBase64String(hash);
|
||||
}
|
||||
|
@ -356,11 +356,11 @@ namespace ArchiSteamFarm {
|
|||
|
||||
byte[] hash;
|
||||
|
||||
#pragma warning disable CA5350
|
||||
#pragma warning disable CA5350 // This is actually a fair warning, but there is nothing we can do about Steam using weak cryptographic algorithms
|
||||
using (HMACSHA1 hmac = new(sharedSecret)) {
|
||||
hash = hmac.ComputeHash(timeArray);
|
||||
}
|
||||
#pragma warning restore CA5350
|
||||
#pragma warning restore CA5350 // This is actually a fair warning, but there is nothing we can do about Steam using weak cryptographic algorithms
|
||||
|
||||
// The last 4 bits of the mac say where the code starts
|
||||
int start = hash[^1] & 0x0f;
|
||||
|
|
|
@ -160,9 +160,9 @@ namespace ArchiSteamFarm.NLog {
|
|||
ConfigurationItemFactory.Default.ParseMessageTemplates = false;
|
||||
LoggingConfiguration config = new();
|
||||
|
||||
#pragma warning disable CA2000 // False positive
|
||||
#pragma warning disable CA2000 // False positive, we're adding this disposable object to the global scope, so we can't dispose it
|
||||
ColoredConsoleTarget coloredConsoleTarget = new("ColoredConsole") { Layout = GeneralLayout };
|
||||
#pragma warning restore CA2000 // False positive
|
||||
#pragma warning restore CA2000 // False positive, we're adding this disposable object to the global scope, so we can't dispose it
|
||||
|
||||
config.AddTarget(coloredConsoleTarget);
|
||||
config.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, coloredConsoleTarget));
|
||||
|
@ -176,7 +176,7 @@ namespace ArchiSteamFarm.NLog {
|
|||
ASF.ArchiLogger.LogGenericException(e);
|
||||
}
|
||||
|
||||
#pragma warning disable CA2000 // False positive
|
||||
#pragma warning disable CA2000 // False positive, we're adding this disposable object to the global scope, so we can't dispose it
|
||||
FileTarget fileTarget = new("File") {
|
||||
ArchiveFileName = Path.Combine("${currentdir}", SharedInfo.ArchivalLogsDirectory, SharedInfo.ArchivalLogFile),
|
||||
ArchiveNumbering = ArchiveNumberingMode.Rolling,
|
||||
|
@ -188,7 +188,7 @@ namespace ArchiSteamFarm.NLog {
|
|||
Layout = GeneralLayout,
|
||||
MaxArchiveFiles = 10
|
||||
};
|
||||
#pragma warning restore CA2000 // False positive
|
||||
#pragma warning restore CA2000 // False positive, we're adding this disposable object to the global scope, so we can't dispose it
|
||||
|
||||
config.AddTarget(fileTarget);
|
||||
config.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, fileTarget));
|
||||
|
|
|
@ -254,11 +254,11 @@ namespace ArchiSteamFarm {
|
|||
internal const uint EnableQuickEditMode = 0x0040;
|
||||
internal const sbyte StandardInputHandle = -10;
|
||||
|
||||
#pragma warning disable CA2101
|
||||
#pragma warning disable CA2101 // False positive, we can't use unicode charset on Unix, and it uses UTF-8 by default anyway
|
||||
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
|
||||
[DllImport("libc", EntryPoint = "chmod", SetLastError = true)]
|
||||
internal static extern int Chmod(string path, int mode);
|
||||
#pragma warning restore CA2101
|
||||
#pragma warning restore CA2101 // False positive, we can't use unicode charset on Unix, and it uses UTF-8 by default anyway
|
||||
|
||||
[DefaultDllImportSearchPaths(DllImportSearchPath.System32)]
|
||||
[DllImport("kernel32.dll")]
|
||||
|
|
|
@ -22,16 +22,18 @@
|
|||
using System.Threading.Tasks;
|
||||
using JetBrains.Annotations;
|
||||
|
||||
#pragma warning disable CS1998
|
||||
namespace ArchiSteamFarm.RuntimeCompatibility {
|
||||
[PublicAPI]
|
||||
public static class File {
|
||||
public static async Task AppendAllTextAsync(string path, string contents) =>
|
||||
public static Task AppendAllTextAsync(string path, string contents) {
|
||||
#if NETFRAMEWORK
|
||||
System.IO.File.AppendAllText(path, contents);
|
||||
|
||||
return Task.CompletedTask;
|
||||
#else
|
||||
await System.IO.File.AppendAllTextAsync(path, contents).ConfigureAwait(false);
|
||||
return System.IO.File.AppendAllTextAsync(path, contents);
|
||||
#endif
|
||||
}
|
||||
|
||||
public static void Move(string sourceFileName, string destFileName, bool overwrite) {
|
||||
#if NETFRAMEWORK
|
||||
|
@ -45,26 +47,28 @@ namespace ArchiSteamFarm.RuntimeCompatibility {
|
|||
#endif
|
||||
}
|
||||
|
||||
public static async Task<byte[]> ReadAllBytesAsync(string path) =>
|
||||
public static Task<byte[]> ReadAllBytesAsync(string path) =>
|
||||
#if NETFRAMEWORK
|
||||
System.IO.File.ReadAllBytes(path);
|
||||
Task.FromResult(System.IO.File.ReadAllBytes(path));
|
||||
#else
|
||||
await System.IO.File.ReadAllBytesAsync(path).ConfigureAwait(false);
|
||||
System.IO.File.ReadAllBytesAsync(path);
|
||||
#endif
|
||||
|
||||
public static async Task<string> ReadAllTextAsync(string path) =>
|
||||
public static Task<string> ReadAllTextAsync(string path) =>
|
||||
#if NETFRAMEWORK
|
||||
System.IO.File.ReadAllText(path);
|
||||
Task.FromResult(System.IO.File.ReadAllText(path));
|
||||
#else
|
||||
await System.IO.File.ReadAllTextAsync(path).ConfigureAwait(false);
|
||||
System.IO.File.ReadAllTextAsync(path);
|
||||
#endif
|
||||
|
||||
public static async Task WriteAllTextAsync(string path, string contents) =>
|
||||
public static Task WriteAllTextAsync(string path, string contents) {
|
||||
#if NETFRAMEWORK
|
||||
System.IO.File.WriteAllText(path, contents);
|
||||
|
||||
return Task.CompletedTask;
|
||||
#else
|
||||
await System.IO.File.WriteAllTextAsync(path, contents).ConfigureAwait(false);
|
||||
return System.IO.File.WriteAllTextAsync(path, contents);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
#pragma warning restore CS1998
|
||||
|
|
|
@ -345,9 +345,9 @@ namespace ArchiSteamFarm {
|
|||
break;
|
||||
}
|
||||
|
||||
#pragma warning disable CA2000 // False positive
|
||||
#pragma warning disable CA2000 // False positive, we're actually wrapping it in the using clause below exactly for that purpose
|
||||
using (await Bot.Actions.GetTradingLock().ConfigureAwait(false)) {
|
||||
#pragma warning restore CA2000 // False positive
|
||||
#pragma warning restore CA2000 // False positive, we're actually wrapping it in the using clause below exactly for that purpose
|
||||
Bot.ArchiLogger.LogGenericInfo(string.Format(CultureInfo.CurrentCulture, Strings.ActivelyMatchingItems, i));
|
||||
(shouldContinueMatching, tradedSomething) = await MatchActivelyRound(acceptedMatchableTypes, triedSteamIDs).ConfigureAwait(false);
|
||||
Bot.ArchiLogger.LogGenericInfo(string.Format(CultureInfo.CurrentCulture, Strings.DoneActivelyMatchingItems, i));
|
||||
|
@ -708,27 +708,27 @@ namespace ArchiSteamFarm {
|
|||
|
||||
[SuppressMessage("ReSharper", "ClassCannotBeInstantiated")]
|
||||
private sealed class ListedUser {
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // False positive, it's a field set during json deserialization
|
||||
[JsonProperty(PropertyName = "items_count", Required = Required.Always)]
|
||||
internal readonly ushort ItemsCount;
|
||||
#pragma warning restore CS0649
|
||||
#pragma warning restore CS0649 // False positive, it's a field set during json deserialization
|
||||
|
||||
internal readonly HashSet<Asset.EType> MatchableTypes = new();
|
||||
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // False positive, it's a field set during json deserialization
|
||||
[JsonProperty(PropertyName = "steam_id", Required = Required.Always)]
|
||||
internal readonly ulong SteamID;
|
||||
#pragma warning restore CS0649
|
||||
#pragma warning restore CS0649 // False positive, it's a field set during json deserialization
|
||||
|
||||
[JsonProperty(PropertyName = "trade_token", Required = Required.Always)]
|
||||
internal readonly string TradeToken = "";
|
||||
|
||||
internal float Score => GamesCount / (float) ItemsCount;
|
||||
|
||||
#pragma warning disable CS0649
|
||||
#pragma warning disable CS0649 // False positive, it's a field set during json deserialization
|
||||
[JsonProperty(PropertyName = "games_count", Required = Required.Always)]
|
||||
private readonly ushort GamesCount;
|
||||
#pragma warning restore CS0649
|
||||
#pragma warning restore CS0649 // False positive, it's a field set during json deserialization
|
||||
|
||||
internal bool MatchEverything { get; private set; }
|
||||
|
||||
|
|
|
@ -96,9 +96,9 @@ namespace ArchiSteamFarm {
|
|||
|
||||
LastChangeNumber = picsChanges.CurrentChangeNumber;
|
||||
|
||||
#pragma warning disable CA1508 // False positive
|
||||
#pragma warning disable CA1508 // False positive, PackageChanges are not always empty
|
||||
if (picsChanges.RequiresFullAppUpdate || picsChanges.RequiresFullPackageUpdate || ((picsChanges.AppChanges.Count == 0) && (picsChanges.PackageChanges.Count == 0))) {
|
||||
#pragma warning restore CA1508 // False positive
|
||||
#pragma warning restore CA1508 // False positive, PackageChanges are not always empty
|
||||
if (ASF.GlobalDatabase != null) {
|
||||
await ASF.GlobalDatabase.OnPICSChangesRestart(picsChanges.CurrentChangeNumber).ConfigureAwait(false);
|
||||
}
|
||||
|
|
|
@ -318,9 +318,9 @@ namespace ArchiSteamFarm {
|
|||
throw new ArgumentNullException(nameof(directory));
|
||||
}
|
||||
|
||||
#pragma warning disable CA1508 // False positive
|
||||
#pragma warning disable CA1508 // False positive, params could be null when explicitly set
|
||||
if ((prefixes == null) || (prefixes.Length == 0)) {
|
||||
#pragma warning restore CA1508 // False positive
|
||||
#pragma warning restore CA1508 // False positive, params could be null when explicitly set
|
||||
throw new ArgumentNullException(nameof(prefixes));
|
||||
}
|
||||
|
||||
|
|
|
@ -140,14 +140,16 @@ namespace ArchiSteamFarm.Web {
|
|||
|
||||
progressReporter?.Report(0);
|
||||
|
||||
MemoryStream ms;
|
||||
#pragma warning disable CA2000 // False positive, we're actually wrapping it in the using clause below exactly for that purpose
|
||||
MemoryStream ms = new((int) response.Length);
|
||||
#pragma warning restore CA2000 // False positive, we're actually wrapping it in the using clause below exactly for that purpose
|
||||
|
||||
#if NETFRAMEWORK
|
||||
using (ms = new MemoryStream((int) response.Length)) {
|
||||
#pragma warning disable CA1508 // False positive, ms is not null here indeed, but using clause is needed for dispose
|
||||
using (ms) {
|
||||
#pragma warning restore CA1508 // False positive, ms is not null here indeed, but using clause is needed for dispose
|
||||
#else
|
||||
#pragma warning disable CA2000 // False positive
|
||||
await using ((ms = new MemoryStream((int) response.Length)).ConfigureAwait(false)) {
|
||||
#pragma warning restore CA2000 // False positive
|
||||
await using (ms.ConfigureAwait(false)) {
|
||||
#endif
|
||||
try {
|
||||
byte batch = 0;
|
||||
|
|
Loading…
Reference in a new issue