Correct GZip code to work on v2
parent
22e4230e14
commit
d352a8e6e7
|
@ -58,9 +58,25 @@ param(
|
||||||
[System.IO.MemoryStream] $output = New-Object System.IO.MemoryStream(45000)
|
[System.IO.MemoryStream] $output = New-Object System.IO.MemoryStream(45000)
|
||||||
[System.IO.MemoryStream] $gzdll = New-Object System.IO.MemoryStream(,[System.Convert]::FromBase64String($ps))
|
[System.IO.MemoryStream] $gzdll = New-Object System.IO.MemoryStream(,[System.Convert]::FromBase64String($ps))
|
||||||
$gzipStream = New-Object System.IO.Compression.GzipStream $gzdll, ([IO.Compression.CompressionMode]::Decompress)
|
$gzipStream = New-Object System.IO.Compression.GzipStream $gzdll, ([IO.Compression.CompressionMode]::Decompress)
|
||||||
$gzipStream.CopyTo($output)
|
try {
|
||||||
$gzipStream.Close()
|
$buffer = New-Object byte[](32000);
|
||||||
$gzdll.Close()
|
while ($true)
|
||||||
|
{
|
||||||
|
$read = $gzipStream.Read($buffer, 0, 32000)
|
||||||
|
if ($read -le 0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
$output.Write($buffer, 0, $read)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
Write-Verbose "Closing streams and newly decompressed file"
|
||||||
|
$gzipStream.Close();
|
||||||
|
$output.Close();
|
||||||
|
$gzdll.Close();
|
||||||
|
}
|
||||||
$assembly = [System.Reflection.Assembly]::Load($output.ToArray())
|
$assembly = [System.Reflection.Assembly]::Load($output.ToArray())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue