Sauberes Zip – File – Handling mit .NET

Eben hab ich bei Norbert im Blog gelesen, dass Microsoft auf Codeplex eine Library zum manipulieren von Zip – Dateien eingestellt hat.

Features:

DotNetZip works on PCs with the full .NET Framework, and also runs on mobile devices that use the .NET Compact Framework. Create and read zip files in VB, C#, or any .NET language, or any scripting environment. DotNetZip supports these scenarios:

C# – Codebeispiel

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
try
 {
 using (ZipFile zip = new ZipFile())
 {
 // add this map file into the "images" directory in the zip archive
 zip.AddFile("c:\\images\\personal\\7440-N49th.png", "images");
 // add the report into a different directory in the archive
 zip.AddFile("c:\\Reports\\2008-Regional-Sales-Report.pdf", "files");
 zip.AddFile("ReadMe.txt");
 zip.Save("MyZipFile.zip");
 }
 }
 catch (System.Exception ex1)
 {
 System.Console.Error.WriteLine("exception: " + ex1);
 }

Weitere Infos gibts bei Norbert oder Codeplex