简体   繁体   中英

Decompress a .rar file using ZipFile in c#

I have an application of upload directories: when I upload a directory it must be .zip et .rar . when I decompress a .zip file there is no problem but in the case of .rar I have an exception here:

FileStream fs = File.OpenRead(path);
zf = new ZipFile(fs); 

I have this exception :

Cannot find central directory.

What is the reason of this exception? How can i fix this code?

.rar is a different compression format then .zip

You could use http://www.chilkatsoft.com/rar-dotnet.asp instead.

Sample: http://www.example-code.com/csharp/rar_list.asp

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM