Random rnd = new Random();
int important = rnd.Next ();
string finalpath = To + "/" + important + "/";
var archive = ArchiveFactory.Open (path);
foreach (var entry in archive.Entries)
{
if (!entry.IsDirectory)
{
entry.WriteToDirectory(finalpath, SharpCompress.Common.ExtractOptions.ExtractFullPath | SharpCompress.Common.ExtractOptions.Overwrite);
}
}
这是我的代码,这是不断弹出的错误消息:
未处理的异常:SharpCompress.Compressor.Deflate.ZlibException: 错误状态(无效距离代码)at SharpCompress.Compressor.Deflate.InflateManager.Inflate(FlushType flush)< 0x40dc0850 + 0x009a3> in:0 at SharpCompress.Compressor.Deflate.ZlibCodec.Inflate(FlushType flush) < 0x40dc07a0 + 0x0002f> in:0 at SharpCompress.Compressor.Deflate.ZlibBaseStream.Read(System.Byte [] buffer,Int32 offset,Int32 count)< 0x40dbf3c0 + 0x002b3> in:在SharpCompress.Compressor.Deflate.DeflateStream.Read中为0 (System.Byte [] buffer,Int32 offset,Int32 count)< 0x40dbf340 + 0x00047> in:0 at SharpCompress.IO.ListeningStream.Read(System.Byte [] buffer,Int32 offset,Int32 count)< 0x40dbf110 + 0x0003c> in:0
在SharpCompress.Utility.TransferTo(System.IO.Stream源码, System.IO.Stream destination)&lt; 0x40dbf070 + 0x0006f&gt;在:SharpCompress.Utility.Extract中的0:[TEntry,TVolume] (SharpCompress.TEntry条目,SharpCompress.Archive.AbstractArchive2 archive, System.IO.Stream streamToWriteTo) <0x40dbd1c0 + 0x00127> in <filename unknown>:0 at SharpCompress.Archive.Zip.ZipArchiveEntry.WriteTo (System.IO.Stream streamToWriteTo) <0x40dbd170 + 0x0002b> in <filename unknown>:0 at SharpCompress.Archive.IArchiveEntryExtensions.WriteToFile (IArchiveEntry entry, System.String destinationFileName, ExtractOptions options) <0x40dbd040 + 0x000dc> in <filename unknown>:0 at SharpCompress.Archive.IArchiveEntryExtensions.WriteToDirectory (IArchiveEntry entry, System.String destinationDirectory, ExtractOptions options) <0x40dbcd20 + 0x0016b> in <filename unknown>:0 at MainWindow.unpack (System.String path) [0x00070] in /home/jan/Plocha/AUDIT2/AUDIT2/MainWindow.cs:52 at MainWindow.<OnButton4Clicked>m__0 () [0x00259] in /home/jan/Plocha/AUDIT2/AUDIT2/MainWindow.cs:459 at System.Threading.ThreadHelper.ThreadStart_Context (System.Object state) <0x7f99d04b11e0 + 0x00099> in <filename unknown>:0 at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, Boolean preserveSyncCtx) <0x7f99d04afa20 + 0x0016e> in <filename unknown>:0 at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, Boolean preserveSyncCtx) <0x7f99d04af9f0 + 0x00020> in <filename unknown>:0 at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state) <0x7f99d04af940 + 0x00059> in <filename unknown>:0 at System.Threading.ThreadHelper.ThreadStart () <0x7f99d04b13a0 + 0x0002e> in <filename unknown>:0 [ERROR] FATAL UNHANDLED EXCEPTION: SharpCompress.Compressor.Deflate.ZlibException: Bad state (invalid distance code) at SharpCompress.Compressor.Deflate.InflateManager.Inflate (FlushType flush) <0x40dc0850 + 0x009a3> in <filename unknown>:0 at SharpCompress.Compressor.Deflate.ZlibCodec.Inflate (FlushType flush) <0x40dc07a0 + 0x0002f> in <filename unknown>:0 at SharpCompress.Compressor.Deflate.ZlibBaseStream.Read (System.Byte[] buffer, Int32 offset, Int32 count) <0x40dbf3c0 + 0x002b3> in <filename unknown>:0 at SharpCompress.Compressor.Deflate.DeflateStream.Read (System.Byte[] buffer, Int32 offset, Int32 count) <0x40dbf340 + 0x00047> in <filename unknown>:0 at SharpCompress.IO.ListeningStream.Read (System.Byte[] buffer, Int32 offset, Int32 count) <0x40dbf110 + 0x0003c> in <filename unknown>:0
2 archive,System.IO.Stream streamToWriteTo)&lt; 0x40dbd1c0 + 0x00127&gt;在 :0点 SharpCompress.Archive.Zip.ZipArchiveEntry.WriteTo(System.IO.Stream) streamToWriteTo)&lt; 0x40dbd170 + 0x0002b&gt; in:0 at SharpCompress.Archive.IArchiveEntryExtensions.WriteToFile (IArchiveEntry条目,System.String destinationFileName, ExtractOptions选项)&lt; 0x40dbd040 + 0x000dc&gt; in:0 在SharpCompress.Archive.IArchiveEntryExtensions.WriteToDirectory (IArchiveEntry条目,System.String destinationDirectory, ExtractOptions选项)&lt; 0x40dbcd20 + 0x0016b&gt; in:0 在MainWindow.unpack(System.String path)[0x00070]中 /home/jan/Plocha/AUDIT2/AUDIT2/MainWindow.cs:52 at MainWindow.m__0()[0x00259] in /home/jan/Plocha/AUDIT2/AUDIT2/MainWindow.cs:459 at System.Threading.ThreadHelper.ThreadStart_Context(System.Object 状态)&lt; 0x7f99d04b11e0 + 0x00099&gt; in:0 at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback回调,System.Object状态, Boolean preserveSyncCtx)&lt; 0x7f99d04afa20 + 0x0016e&gt; in:在System.Threading.ExecutionContext.Run中为0 (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback回调,System.Object状态, Boolean preserveSyncCtx)&lt; 0x7f99d04af9f0 + 0x00020&gt; in:在System.Threading.ExecutionContext.Run中为0 (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback回调,System.Object状态) &lt; 0x7f99d04af940 + 0x00059&gt; in:0 at System.Threading.ThreadHelper.ThreadStart()&lt; 0x7f99d04b13a0 + 0x0002e&GT;在:0 Aplikacebylaunočenaignálem: SIGHUP
at SharpCompress.Utility.TransferTo (System.IO.Stream source, System.IO.Stream destination) <0x40dbf070 + 0x0006f> in <filename unknown>:0 at SharpCompress.Utility.Extract[TEntry,TVolume] (SharpCompress.TEntry entry, SharpCompress.Archive.AbstractArchive
你能帮帮我吗?