Skip to content

Commit

Permalink
Fix for cleaning regression #13
Browse files Browse the repository at this point in the history
  • Loading branch information
stavroskasidis committed Apr 4, 2022
1 parent 3b7456d commit 5285539
Show file tree
Hide file tree
Showing 6 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.1" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.1" PrivateAssets="all" />
<PackageReference Include="BlazorWasmAntivirusProtection" Version="1.5.0-beta" />
<PackageReference Include="BlazorWasmAntivirusProtection" Version="1.6.0-beta" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="6.0.1" />
<PackageReference Include="BlazorWasmAntivirusProtection" Version="1.5.0-beta" />
<PackageReference Include="BlazorWasmAntivirusProtection" Version="1.6.0-beta" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="6.0.2" />
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="6.0.2" PrivateAssets="all" />
<PackageReference Include="BlazorWasmAntivirusProtection" Version="1.5.0-beta" />
<PackageReference Include="BlazorWasmAntivirusProtection" Version="1.6.0-beta" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

<ItemGroup>
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.Server" Version="6.0.2" />
<PackageReference Include="BlazorWasmAntivirusProtection" Version="1.5.0-beta" />
<PackageReference Include="BlazorWasmAntivirusProtection" Version="1.6.0-beta" />
</ItemGroup>

<ItemGroup>
Expand Down
6 changes: 3 additions & 3 deletions src/BlazorWasmAntivirusProtection.Tasks/CleanOldDlls.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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];
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<PackageProjectUrl>https://github.com/stavroskasidis/BlazorWasmAntivirusProtection</PackageProjectUrl>
<Description>This package attempts to guard against false positives from antiviruses that flag Blazor Wasm as malware</Description>
<VersionSuffix>$(VersionSuffix)</VersionSuffix>
<Version>1.5.0</Version>
<Version>1.6.0</Version>
<Version Condition=" '$(VersionSuffix)' != '' ">$(Version)-$(VersionSuffix)</Version>
</PropertyGroup>

Expand Down

0 comments on commit 5285539

Please sign in to comment.