在使用ICSharpCode.SharpZipLib进行目录压缩后,再解压缩是提示这个错误Size mismatch: 4294967295;126976 70202;126976
我已经重新编译过了,解决了该问题。
解决方法:在项目所引用库“ICSharpCode.SharpZipLib.dll”的ICSharpCode.SharpZipLib.Zip.Compression. ZipInputStream.cs类中找到抛出异常的代码段:
int BodyRead(byte[] buffer, int offset, int count)
{
...
if ((flags & 8) == 0 && (inf.TotalIn != csize || inf.TotalOut != size)) {
throw new ZipException("Size mismatch: " + csize + ";" + size + " " + inf.TotalIn + ";" + inf.TotalOut);
}
...
return count;
}
将
if ((flags & 8) == 0 && (inf.TotalIn != csize || inf.TotalOut != size)) {
throw new ZipException("Size mismatch: " + csize + ";" + size + " " + inf.TotalIn + ";" + inf.TotalOut);
}
注释掉即可,解压和压缩一切都正常。
1