Although Microsoft has integrated zip decompression support in. NET 4.5, it is still weak. If we want to let the program like 7zip support Universal decompression, sharpcompress can help you achieve this goal, it is a C # write compression/decompression tool, although not yet able to do like 7Zip so NB, when the supported format is also quite a lot, the following is the current support situation:
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 is 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 isn't seekable, then an exception would be thrown.
(4) The 7ZIP format doesn ' t allow to reading as a forward-only stream so 7Zip are only supported through the Archive API
And this library is a portable,. net/mono/silverlight/wp7 and other frameworks can be used, but also what, hurriedly installed it:
Pm> Install-package sharpcompress
And it also provides some examples on NuGet:
Pm> Install-package p3-sharpcompress
If you want to know more about it, you can refer to its Project homepage:
- codeplex:https://sharpcompress.codeplex.com/
- Github:https://github.com/adamhathcock/sharpcompress
. NET in the 7zip--sharpcompress