- Dim bufferWrite As Byte()
- Dim fsSource As FileStream
- Dim fsDest As FileStream
- Dim gzDeCompressed As GZipStream
- fsSource = New FileStream("update.zip", FileMode.Open, FileAccess.Read, FileShare.Read)
- gzDeCompressed = New GZipStream(fsSource, CompressionMode.Decompress, True)
- 'bufferwrite = new byte[4];
- bufferWrite = New Byte(4) {}
- fsSource.Position = fsSource.Length - 4
- fsSource.Read(bufferWrite, 0, 4)
- fsSource.Position = 0
- Dim bufferLength As Integer = BitConverter.ToInt32(bufferWrite, 0)
- Dim buffer As Byte() = New Byte(bufferLength + 100) {}
- Dim readOffSet = 0
- Dim totalBytes = 0
- While True
- Dim bytesRead = gzDeCompressed.Read(buffer, readOffSet, 100)
- If bytesRead = 0 Then
- 'break;
- readOffSet += bytesRead
- totalBytes += bytesRead
- End If
- End While
- fsDest = New FileStream(My.Application.Info.DirectoryPath & "\file.cache", FileMode.Create)
- fsDest.Write(buffer, 0, totalBytes)
- fsSource.Close()
- gzDeCompressed.Close()
- fsDest.Close()
Exception : Magic Number
Google说是Header,可是……我使用7z Compress的



