zoukankan      html  css  js  c++  java
  • .Net中的7Zip——Sharpcompress

    虽然微软在.net 4.5中集成了对zip的解压支持,但还是比较弱。如果我们想让程序像7zip那样支持万能解压,Sharpcompress可以帮你实现这个目标,它是一个C#写的压缩/解压工具,虽然还没能做得像7Zip那么NB,当支持的格式也是相当多的,如下就是目前的支持情况:

    Archive Format

    Compression Format(s)

    Compress/Decompress

    Archive API

    Reader API

    Writer API

    Rar

    Rar

    Decompress(1)

    RarArchive

    RarReader

    N/A

    Zip(2)

    None, DEFLATE, BZip2, LZMA/LZMA2, PPMd

    Both

    ZipArchive

    ZipReader

    ZipWriter

    Tar

    None, BZip2, GZip

    Both

    TarArchive

    TarReader

    TarWriter(3)

    GZip (single file)

    GZip

    Both

    GZipArchive

    GZipReader

    GZipWriter

    7Zip(4)

    LZMA, LZMA2, BZip2, PPMd, BCJ, BCJ2

    Decompress

    SevenZipArchive

    N/A

    N/A

    (1) SOLID Rars are only supported in the RarReader API.
    (2) Zip format supports pkware and WinzipAES encryption. However, encrypted LZMA is not supported.
    (3) The Tar format requires a file size in the header. If no size is specified to the TarWriter and the stream is not seekable, then an exception will be thrown.
    (4) The 7Zip format doesn't allow for reading as a forward-only stream so 7Zip is only supported through the Archive API

    并且这个库是一个portable的,.NET/Mono/Silverlight/WP7等框架都可以用,还等什么,赶紧安装吧:

        PM> Install-Package sharpcompress

    并且它也在NUGET上提供了一些范例:

        PM> Install-Package p3-sharpcompress

    如果要更详细的了解它,可以参看它的项目主页1:

  • 相关阅读:
    Android smali 语法
    iOS 发布计费点测试
    how-to-stop-non-jailbroken-pirates-theory
    shell script
    文章收藏
    NB BAT批量读取图片文件属性
    JAVA LUHN
    MAC NDK 编译 Cocos2dx 问题
    Mac 下解压缩安装Android ndk bin 文件
    MVC Json输出调试信息
  • 原文地址:https://www.cnblogs.com/TianFang/p/4084874.html
Copyright © 2011-2022 走看看