From 6ea540dc4fb42e8da7092de50fe9001a65cc8ce3 Mon Sep 17 00:00:00 2001 From: Peter Tsuprun Date: Fri, 23 Feb 2024 12:07:41 +0200 Subject: [PATCH 1/2] upgrade nuget packages --- src/ClamAV.Net/ClamAV.Net.csproj | 2 +- tests/ClamAV.Net.Tests/ClamAV.Net.Tests.csproj | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ClamAV.Net/ClamAV.Net.csproj b/src/ClamAV.Net/ClamAV.Net.csproj index f13ec6d..b232cf3 100644 --- a/src/ClamAV.Net/ClamAV.Net.csproj +++ b/src/ClamAV.Net/ClamAV.Net.csproj @@ -25,6 +25,6 @@ Off - + \ No newline at end of file diff --git a/tests/ClamAV.Net.Tests/ClamAV.Net.Tests.csproj b/tests/ClamAV.Net.Tests/ClamAV.Net.Tests.csproj index 4c6a9d3..7c33bd2 100644 --- a/tests/ClamAV.Net.Tests/ClamAV.Net.Tests.csproj +++ b/tests/ClamAV.Net.Tests/ClamAV.Net.Tests.csproj @@ -7,19 +7,19 @@ - + all runtime; build; native; contentfiles; analyzers; buildtransitive - - - - - + + + + + all runtime; build; native; contentfiles; analyzers; buildtransitive - + all runtime; build; native; contentfiles; analyzers; buildtransitive From 3709e125ae3b2b41276c93bac8e2e032bc10a01b Mon Sep 17 00:00:00 2001 From: Peter Tsuprun Date: Fri, 23 Feb 2024 19:52:36 +0200 Subject: [PATCH 2/2] upgrade fixes --- src/ClamAV.Net/ClamAV.Net.csproj | 3 ++- src/ClamAV.Net/Commands/InStreamCommand.cs | 4 ++++ src/ClamAV.Net/Socket/TcpSocketClient.cs | 2 +- tests/ClamAV.Net.Tests/ClamAV.Net.Tests.csproj | 2 +- .../Exceptions/ClamAvExceptionTests.cs | 18 ------------------ 5 files changed, 8 insertions(+), 21 deletions(-) diff --git a/src/ClamAV.Net/ClamAV.Net.csproj b/src/ClamAV.Net/ClamAV.Net.csproj index b232cf3..c97251b 100644 --- a/src/ClamAV.Net/ClamAV.Net.csproj +++ b/src/ClamAV.Net/ClamAV.Net.csproj @@ -1,6 +1,6 @@  - netstandard2.1 + netstandard2.1;netstandard2.0; true petertsu@github ClamAV.Net @@ -19,6 +19,7 @@ Copyright 2020 petertsu@github The ClamAV server .NETStandard client 4E284927-EFC1-443E-BC27-D598404ACE71 + 12.0 ClamAV.Net.xml diff --git a/src/ClamAV.Net/Commands/InStreamCommand.cs b/src/ClamAV.Net/Commands/InStreamCommand.cs index 2f3e066..8082f19 100644 --- a/src/ClamAV.Net/Commands/InStreamCommand.cs +++ b/src/ClamAV.Net/Commands/InStreamCommand.cs @@ -69,7 +69,11 @@ public ScanResult ProcessRawResponse(byte[] rawResponse) new ClamAvException($"Invalid raw response '{actualResponse}'"); } +#if NETSTANDARD2_0 + return new ScanResult(true, responseParts[responseParts.Length - 2]); +#else return new ScanResult(true, responseParts[^2]); +#endif } } } \ No newline at end of file diff --git a/src/ClamAV.Net/Socket/TcpSocketClient.cs b/src/ClamAV.Net/Socket/TcpSocketClient.cs index 7b37cac..cffac9e 100644 --- a/src/ClamAV.Net/Socket/TcpSocketClient.cs +++ b/src/ClamAV.Net/Socket/TcpSocketClient.cs @@ -44,7 +44,7 @@ public async Task ConnectAsync(CancellationToken cancellationToken = default) private async Task ReadResponse(CancellationToken cancellationToken) { - await using MemoryStream memoryStream = new MemoryStream(); + using MemoryStream memoryStream = new MemoryStream(); do { diff --git a/tests/ClamAV.Net.Tests/ClamAV.Net.Tests.csproj b/tests/ClamAV.Net.Tests/ClamAV.Net.Tests.csproj index 7c33bd2..536c3d2 100644 --- a/tests/ClamAV.Net.Tests/ClamAV.Net.Tests.csproj +++ b/tests/ClamAV.Net.Tests/ClamAV.Net.Tests.csproj @@ -1,7 +1,7 @@  - netcoreapp3.1 + netcoreapp8.0 false diff --git a/tests/ClamAV.Net.Tests/Exceptions/ClamAvExceptionTests.cs b/tests/ClamAV.Net.Tests/Exceptions/ClamAvExceptionTests.cs index b321102..ab98fed 100644 --- a/tests/ClamAV.Net.Tests/Exceptions/ClamAvExceptionTests.cs +++ b/tests/ClamAV.Net.Tests/Exceptions/ClamAvExceptionTests.cs @@ -23,23 +23,5 @@ public void Ctor_Validation() clamAvException.Message.Should().Be(expectedMessage); clamAvException.InnerException.Should().NotBeNull(); } - - [Fact] - public void Serialization_Test() - { - const string expectedMessage = "Some error"; - ClamAvException clamAvException = new ClamAvException(expectedMessage, new Exception("Error")); - - BinaryFormatter binaryFormatter = new BinaryFormatter(); - - using MemoryStream memoryStream = new MemoryStream(); - binaryFormatter.Serialize(memoryStream, clamAvException); - memoryStream.Seek(0, SeekOrigin.Begin); - - ClamAvException actual = binaryFormatter.Deserialize(memoryStream) as ClamAvException; - - actual.Should().NotBeNull(); - actual.Should().BeEquivalentTo(clamAvException); - } } } \ No newline at end of file