Resolve CA1819

This commit is contained in:
JustArchi
2021-05-07 17:14:22 +02:00
parent 90ff43dc98
commit 804008a5d1
3 changed files with 7 additions and 5 deletions

View File

@@ -111,7 +111,6 @@ dotnet_diagnostic.ca1028.severity = silent
dotnet_diagnostic.ca1031.severity = silent dotnet_diagnostic.ca1031.severity = silent
# TODO - one at a time # TODO - one at a time
dotnet_diagnostic.ca1819.severity = silent
dotnet_diagnostic.ca1812.severity = silent dotnet_diagnostic.ca1812.severity = silent
dotnet_diagnostic.ca1823.severity = silent dotnet_diagnostic.ca1823.severity = silent
dotnet_diagnostic.ca2000.severity = silent dotnet_diagnostic.ca2000.severity = silent

View File

@@ -347,7 +347,7 @@ namespace ArchiSteamFarm {
ArchiLogger.LogGenericWarningException(e); ArchiLogger.LogGenericWarningException(e);
} }
MemoryStream memoryStream = new(response.Content); MemoryStream memoryStream = new(response.Content as byte[] ?? response.Content.ToArray());
try { try {
#if NETFRAMEWORK #if NETFRAMEWORK

View File

@@ -20,19 +20,22 @@
// limitations under the License. // limitations under the License.
using System; using System;
using System.Collections.Generic;
using JetBrains.Annotations; using JetBrains.Annotations;
namespace ArchiSteamFarm.Web { namespace ArchiSteamFarm.Web {
public sealed class BinaryResponse : BasicResponse { public sealed class BinaryResponse : BasicResponse {
[PublicAPI] [PublicAPI]
public byte[] Content { get; } public IReadOnlyCollection<byte> Content => Bytes;
public BinaryResponse(BasicResponse basicResponse, byte[] content) : base(basicResponse) { private readonly byte[] Bytes;
public BinaryResponse(BasicResponse basicResponse, byte[] bytes) : base(basicResponse) {
if (basicResponse == null) { if (basicResponse == null) {
throw new ArgumentNullException(nameof(basicResponse)); throw new ArgumentNullException(nameof(basicResponse));
} }
Content = content ?? throw new ArgumentNullException(nameof(content)); Bytes = bytes ?? throw new ArgumentNullException(nameof(bytes));
} }
} }
} }