Guest User

Untitled

a guest
Nov 23rd, 2017
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 0.73 KB | None | 0 0
  1.     Public Function Decompress() As Boolean
  2.                 'Dim str As New String(Microsoft.VisualBasic.CompilerServices.Conversions.ToCharArrayRankOne(OFD.FileName & "\Extracted"))
  3.                 Dim stream2 As New MemoryStream(File.ReadAllBytes(filepath))
  4.                 Dim stream As New GZipStream(stream2, CompressionMode.Decompress)
  5.                 Dim buffer As Byte() = New Byte(3) {}
  6.                 stream2.Position = stream2.Length - 4L
  7.                 stream2.Read(buffer, 0, 4)
  8.                 Dim count As Integer = CInt(BitConverter.ToUInt32(buffer, 0))
  9.                 stream2.Position = 0L
  10.                 Dim array As Byte() = New Byte((count - 1)) {}
  11.                 stream.Read(array, 0, count)
  12.                 stream.Dispose()
  13.                 stream2.Dispose()
  14.                 File.WriteAllBytes(Application.StartupPath + "\" + "extracted", array)
  15.     End Function
Add Comment
Please, Sign In to add comment