- 分享
- 0
- 人气
- 0
- 主题
- 62
- 帖子
- 6367
- UID
- 51295
- 积分
- 3715
- 阅读权限
- 21
- 注册时间
- 2006-11-21
- 最后登录
- 2022-1-19
- 在线时间
- 3699 小时
 
|
- 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的 |
|