2/8/2010 10:10 PM
The other day I needed to unzip a bunch of zip-archives, modify the unzipped content and zip them back again. Since I'm lazy (as every developer should be) I decided to write a tool that would do all the work for me.
After googling around I found several ways of handling zip archives. First of them I tried was the System.IO.Packaging namespace classes available in .NET 3.0. But disappointment came soon when it simply failed to unzip my archives probably due to some zip format incompatibility.
Well-known #ziplib turned out to be under GPL, and I also heard it's less usable than its main competitor DotNetZip.
With DotNetZip i did my job in several minutes:
private void ProcessMMCSECOfile(string mmcsecoFileName)
using (ZipFile mmcseco = ZipFile.Read(mmcsecoFileName))
mmcseco.CompressionLevel = CompressionLevel.None;
string newCodeModelContents = ChangeEncoding(
string newDiagramsContents = ChangeEncoding(
string GetContents(ZipFile zipFile, string archivedFileName)
using (Stream st = zipFile[archivedFileName].OpenReader())
using (StreamReader reader = new StreamReader(st,