• C# .NET 使用第三方类库DotNetZip解压/压缩Zip文件 (ZT)


    DotNetZip on CodePlex: http://dotnetzip.codeplex.com/

    详细的可以看源代码……总之感觉比SharpZipLib好用。而且DotNetZip支持VB,C#以及任何.NET语言。

    加压:(从CodePlex上偷过来的)

    复制代码
     using (ZipFile zip = new ZipFile())
     {
         // add this map file into the "images" directory in the zip archive 把这个PNG文件添加到zip档案的"images"目录下
         zip.AddFile("c:\images\personal\7440-N49th.png", "images");
         // add the report into a different directory in the archive 然后把PDF文件添加到zip档案的"files"目录下,把ReadMe.txt放到根目录
         zip.AddFile("c:\Reports\2008-Regional-Sales-Report.pdf", "files");
         zip.AddFile("ReadMe.txt");
       // 把zip档案保存为MyZipFile.zip
         zip.Save("MyZipFile.zip");
     }
    复制代码

    解压更简单:

    using (ZipFile zip = new ZipFile("MyZipFile.zip"))
    {
      zip.ExtractAll("c:\myfolder", ExtractExistingFileAction.OverwriteSilently);
    }

    这就可以了!什么问题都木有,是不是比SharpZipLib方便多了!

  • 相关阅读:
    Java I/O
    iOS AppsFlyer的使用注意事项
    Star Schema and Snowflake Schema
    SSB基准测试
    ES Route
    CPS(Cyber-Physical Systems)白皮书-摘选
    蓄电池放电容量与环境温度的关系
    时间序列分析(二)
    时间序列分析(一)
    IndexR
  • 原文地址:https://www.cnblogs.com/aswordok/p/3754096.html
Copyright © 2020-2023  润新知