Easily get the decompression under the .NET using #developlip.
#Develop is an editor for making C # or VB.NET projects, while #ziplib is a powerful tool for decompressed software under its embedding .NET. About #develop this software, you can go to its Chinese website (http://www.aspx.cn/comm/dotnetbbs/forum.aspx?forum_id=14) Download the latest version.
Here is to introduce the decompression method under the .NET .NET.
1.Bzip2 Add ICSharpcode.sharpziplib.dll's reference, in the / sharpdevelop / bin directory in the #develop, installation directory. Then use the USING statement in the program to put BZIP2
The class library contains it. Compression: Use BZIP2 Static Method Compress. Its first parameter is the input stream represented by the file to be compressed, and the static method OpenRead of System.IO.FILE can be used. The second parameter is the output stream represented by the compressed file to be established. You can use system.IO.File's static method crete creation, and the compressed file name is the file name of the compressed file.
Plus the compressed suffix.bz (also you can also take other file names). The third parameter is the block size to be compressed (generally 2048 integers).
Unzip: Use the static method of BZIP2 Decompress. Its first parameter is the input stream represented by the compressed file to be decompressed, and the static method of System.IO.File can use OpenRead. The second parameter is the output stream represented by the decompressed file to be established. You can use system.IO.File's static method crete creation, because the file name of the decompressed file is removed.
The compressed file name of the file extension (you can also do different names of the decompressed file and the compressed file). Compile your program, then enter the BZIP2 file name under the command line mode (assuming that the created C # file is bzip2, you can generate a compressed file; enter the BZIP2 -D file name, will decompress
Out of the file (-d is used to refer to decompression, you can also use other symbols). Oh, it is so simple to do compression, and the compression effect is also possible. Using system; using iCsharpcode.sharpziplib.bzip2;
Class mainclass {public static void main (string [] args) {if (args [0] == "-d") {// Decompression Bzip2.decompress (file.openread (args [1]), file.create (Path .GETFILENAMEWITEXTENSITION (Args [1]))))));} else {// Compressed Bzip2.comPress (file.openread (args [0]), file.create (args [0] ".bz"), 4096) }} 2.Gzip joins the reference to ICSharpcode.sharpziplib.dll, in the / sharpdevelop / bin directory in the #develope installation directory. Then use the USING statement in the program to put the GZIP class
The library is included. Since Gzip does not have a simple decompression method of BZIP2, only the flow method can be used to decompress. Specific methods see the instructions for the program. Compile the program, then enter the Gzip file name in the command line mode (assuming that the created C # file is gzip, you can generate a compressed file; enter the Gzip -D file name, you will decompress the file (-D is used to indicate unfair, You can also use other symbols).
Using system; using system.io;
Using ICsharpcode.sharpziplib.gzip;