Pregunta

What I'm trying to achive is to enable an application to extract a large remote file (from ftp or http), without fully downloading it and with the possibility to resume the extraction in case of network failure.

Following this example

http://wiki.sharpdevelop.net/SharpZipLib-Zip-Samples.ashx#Unpack_a_zip_using_ZipInputStream_eg_for_Unseekable_input_streams_5

I'm able to extract the file but I'm unable to resume the extraction in case of network failure. I've tried to use ZipInputStream.Skip(length) where "length" is the size of the local donloaded/unzipped file but it seems not to work. It throws exception like:

A first chance exception of type 'ICSharpCode.SharpZipLib.SharpZipBaseException' occurred in ICSharpCode.SharpZipLib.dll broken uncompressed block

Any Idea? Is it possibile to achive this?

¿Fue útil?

Solución

Got the answer from the Sharpzlib team on their forums.

It is possibile to do this. It's simple. When instancing a new ZipInputStream you need to pass a "specialized" Stream which will wrap a FTP connection and a stream obtained by a FtpWebResponse.

The sharpzlib team have added this as an example on thei wiki site. Take a look on the last tutorial

https://github.com/icsharpcode/SharpZipLib/wiki/Zip-Samples

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top