From 5285539ee828313619e43e55df09f67e334554fe Mon Sep 17 00:00:00 2001 From: stavroskasidis Date: Mon, 4 Apr 2022 15:24:02 +0300 Subject: [PATCH] Fix for cleaning regression #13 --- .../Client/BlazorHostedSampleApp.Client.csproj | 2 +- .../Server/BlazorHostedSampleApp.Server.csproj | 2 +- .../Client/BlazorHostedSamplePwa.Client.csproj | 2 +- .../Server/BlazorHostedSamplePwa.Server.csproj | 2 +- src/BlazorWasmAntivirusProtection.Tasks/CleanOldDlls.cs | 6 +++--- .../BlazorWasmAntivirusProtection.csproj | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/sampleapps/BlazorHostedSampleApp/Client/BlazorHostedSampleApp.Client.csproj b/sampleapps/BlazorHostedSampleApp/Client/BlazorHostedSampleApp.Client.csproj index 3c5ac61..eca9c5b 100644 --- a/sampleapps/BlazorHostedSampleApp/Client/BlazorHostedSampleApp.Client.csproj +++ b/sampleapps/BlazorHostedSampleApp/Client/BlazorHostedSampleApp.Client.csproj @@ -17,7 +17,7 @@ - + diff --git a/sampleapps/BlazorHostedSampleApp/Server/BlazorHostedSampleApp.Server.csproj b/sampleapps/BlazorHostedSampleApp/Server/BlazorHostedSampleApp.Server.csproj index b0a2789..1a05b19 100644 --- a/sampleapps/BlazorHostedSampleApp/Server/BlazorHostedSampleApp.Server.csproj +++ b/sampleapps/BlazorHostedSampleApp/Server/BlazorHostedSampleApp.Server.csproj @@ -15,7 +15,7 @@ - + diff --git a/sampleapps/BlazorHostedSamplePwa/Client/BlazorHostedSamplePwa.Client.csproj b/sampleapps/BlazorHostedSamplePwa/Client/BlazorHostedSamplePwa.Client.csproj index 03a6b7d..0bcae3d 100644 --- a/sampleapps/BlazorHostedSamplePwa/Client/BlazorHostedSamplePwa.Client.csproj +++ b/sampleapps/BlazorHostedSamplePwa/Client/BlazorHostedSamplePwa.Client.csproj @@ -14,7 +14,7 @@ - + diff --git a/sampleapps/BlazorHostedSamplePwa/Server/BlazorHostedSamplePwa.Server.csproj b/sampleapps/BlazorHostedSamplePwa/Server/BlazorHostedSamplePwa.Server.csproj index 4bf63ea..4c2842f 100644 --- a/sampleapps/BlazorHostedSamplePwa/Server/BlazorHostedSamplePwa.Server.csproj +++ b/sampleapps/BlazorHostedSamplePwa/Server/BlazorHostedSamplePwa.Server.csproj @@ -12,7 +12,7 @@ - + diff --git a/src/BlazorWasmAntivirusProtection.Tasks/CleanOldDlls.cs b/src/BlazorWasmAntivirusProtection.Tasks/CleanOldDlls.cs index 219a89d..e0be109 100644 --- a/src/BlazorWasmAntivirusProtection.Tasks/CleanOldDlls.cs +++ b/src/BlazorWasmAntivirusProtection.Tasks/CleanOldDlls.cs @@ -23,7 +23,7 @@ public override bool Execute() var linkSemaphore = Path.Combine(IntermediateLinkDir, "Link.semaphore"); var existingDll = Directory.GetFiles(IntermediateLinkDir, "*.dll").FirstOrDefault(); - if (File.Exists(linkSemaphore) && existingDll != null && IsDllHeaderBz(existingDll)) + if (File.Exists(linkSemaphore) && existingDll != null && !IsDllHeaderMz(existingDll)) { Log.LogMessage(MessageImportance.High, $"BlazorWasmAntivirusProtection: Cleaning old .dll files in \"{IntermediateLinkDir}\""); //We delete the Link.semaphore file to force a regeneration of objs in the IntermediateLinkDir @@ -34,14 +34,14 @@ public override bool Execute() return true; } - bool IsDllHeaderBz(string fn) + bool IsDllHeaderMz(string fn) { using var fs = File.Open(fn, FileMode.Open, FileAccess.ReadWrite); using var reader = new BinaryReader(fs); var buffer = new byte[2]; reader.Read(buffer, 0 , buffer.Length); - var bz = Encoding.ASCII.GetBytes("BZ"); + var bz = Encoding.ASCII.GetBytes("MZ"); return bz[0] == buffer[0] && bz[1] == buffer[1]; } } diff --git a/src/BlazorWasmAntivirusProtection/BlazorWasmAntivirusProtection.csproj b/src/BlazorWasmAntivirusProtection/BlazorWasmAntivirusProtection.csproj index b87354c..baedaa7 100644 --- a/src/BlazorWasmAntivirusProtection/BlazorWasmAntivirusProtection.csproj +++ b/src/BlazorWasmAntivirusProtection/BlazorWasmAntivirusProtection.csproj @@ -11,7 +11,7 @@ https://github.com/stavroskasidis/BlazorWasmAntivirusProtection This package attempts to guard against false positives from antiviruses that flag Blazor Wasm as malware $(VersionSuffix) - 1.5.0 + 1.6.0 $(Version)-$(VersionSuffix)