Skip to content

Commit

Permalink
Take 2 of fixing the build script
Browse files Browse the repository at this point in the history
  • Loading branch information
CaiB committed Apr 22, 2023
1 parent 72a5748 commit c824837
Showing 1 changed file with 10 additions and 6 deletions.
16 changes: 10 additions & 6 deletions GenBuildInfo.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,16 @@ param($ConfigHashFile, $ConfigFile);

Write-Host "Putting default config hash into file '$ConfigHashFile'.";

[string] $Hash = (Get-FileHash $ConfigFile -Algorithm 'MD5').Hash;

$HashObj = New-Object -TypeName 'System.Security.Cryptography.MD5CryptoServiceProvider'
$FileStream = [System.IO.File]::Open((Resolve-Path $ConfigFile), [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite)
try { [System.BitConverter]::ToString($HashObj.ComputeHash($FileStream)) }
finally { $FileStream.Dispose() }
$HashObj = New-Object -TypeName 'System.Security.Cryptography.MD5CryptoServiceProvider';
$FileStream = [System.IO.File]::Open((Resolve-Path $ConfigFile), [System.IO.FileMode]::Open, [System.IO.FileAccess]::Read, [System.IO.FileShare]::ReadWrite);
try
{
[byte[]] $HashBytes = $HashObj.ComputeHash($FileStream);
$HexBuilder = [System.Text.StringBuilder]::new($HashBytes.Length * 2);
foreach($b in $HashBytes) { $HexBuilder.AppendFormat("{0:X2}", $b); }
[string] $Hash = $HexBuilder.ToString();
}
finally { $FileStream.Dispose(); }

$Class =
@"
Expand Down

0 comments on commit c824837

Please sign in to comment.