开发者

How to find ZipEntry in zip file programmatically in C#?

I cannot use third party software/libraries and have a zip file that I have to read in WPF application and get the binary data (that represents the image). That zip file contains about 7000 images and I have to find the right one by its name. How can I get the ZipEntry (analog in Java)?

http://download.oracle.com/javase/1.4.2/d开发者_StackOverflowocs/api/java/util/zip/ZipEntry.html

Sincerely,

Roman


I cannot use third party software/libraries

Sorry to say it but that's a ridiculous constraint. If that's the case, you will have to struggle with whatever there is in the BCL to handle zips. And believe me, there isn't much. The System.IO.Packaging namespace could be a good start. And if you are not using .NET 4.0, well, my condolences to you. The zip specification might be a good read (for me it wouldn't be a good read as a matter of fact).

I'd probably use dotnetzip or SharpZipLib or something and have plenty of time solving some real world problems, not ones that have already been solved.


The question is quite old and so the answer.

Best answer since end of 2012 is: Use .NET 4.5 and the contained System.IO.Compression and System.IO.Compression.ZipArchive namespace classes.

One of many example links you receive if you search in the internet: http://www.codeproject.com/Articles/381661/Creating-Zip-Files-Easily-in-NET

With Roslyn the whole framework library was published as Open Source, so AFAI understand it, you are free to extract the code from the 4.5 classes (as it should be not really system specific) and use it as a library for the earlier .NET frameworks. Maybe this would give some license advantages over using the other classes- but this has to be analyzed by you.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜