Jump to content
  • Advertisement
Sign in to follow this  
fread

C# - create/read/list/view/modify ZIP files library

This topic is 2075 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello guys

What is the best library to C# so i can create/read/list/view/modify ZIP files library?

What are your recommendations?

updating a single file inside big zip archive is important for me.

Big thanks in advance. : )

Share this post


Link to post
Share on other sites
Advertisement

DotNetZip (on CodePlex) is pretty much the only one that's relevant. Updating a file inside a .zip is going to be an absolutely horrible idea no matter what library you use though.

 

Edit:

 

There is also SharpSevenZip released under the LGPL. It supports more formats and is possibly faster, but a less nice license and messier if you want to support mono and/or both 32 and 64 bits since it relies on an unmanaged library.

 

Then there's the older SharpZipLib which I don't want to go anywhere near due to licensing. It's licensed under the GPL with some exception that you may link to it without being infected by it's license. Which is wierd, since that's kindof the point of the GPL.

Edited by DvDmanDT

Share this post


Link to post
Share on other sites


updating a single file inside big zip archive is important for me.


Updating a file inside a .zip is going to be an absolutely horrible idea no matter what library you use though.

Yup. 

 

Zip doesn't support directly modifying a file. The format is basically a collection of files along with a table showing the contents given at the end of a file. You can append a new table to the end and it supersedes any other table that was there before it.

 

The easiest way to delete a file is to simply rewrite the table and exclude the file. Many early zip utilities did this. The data is still present in the archive but it no longer appears in the central directory listing.

 

You can append a new file to the archive and then update the central directory. This can be done in place easily.

 

You can rewrite the entire archive, omitting the old file and adding the new file. This cannot be done in place.

 


with .NET 4.5, ZIP archive support is now baked into the class library

The ZipArchive (and helper classes) gives you all the support to find entries from the central directory, extract entries, add entries, and delete entries (although I don't know if this is an in-place removal by updating the central directory or a rewrite of the file by removing the content, I suspect the former). 

 

To make modifications one would need to extract the content you need, delete the old entry, and add a new entry. It is not as simple as just overwriting bits in the middle. And of course, since you don't want to lose the data in case of an error, you should completely create the new archive first, then delete the old archive and rename the new archive to the original name.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!