創建,讀取,和更新zip文件的.NET開源庫:DotnetZip
DotnetZip是一個開源類庫,支持.NET的任何語言,可很方便的創建,讀取,和更新zip文件。而且還可以使用在.NETCompact Framework中。
以下是創建一個zip文件的C#代碼。
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"); }
本文由用戶 jopen 自行上傳分享,僅供網友學習交流。所有權歸原作者,若您的權利被侵害,請聯系管理員。
轉載本站原創文章,請注明出處,并保留原始鏈接、圖片水印。
本站是一個以用戶分享為主的開源技術平臺,歡迎各類分享!