Csung uses the system unzip system.shell.folder.copyhereto decompress the. ZIP file.

Source: Internet
Author: User
CEN decompress the. ZIP file and search a lot of methods on the Internet, using System. IO. compression. GZipStream uses the J # library function and the Java-based library function. However, many of them are not very good. In the end, it is still the System function System. shell. folder. copyHere ( OItem [ , IntOptions. The specific method is as follows:

1. Add the reference Shell32.dll, which can be found in Windows \ system32.
2. Add the method. Static void UnZip (string zipFile, string destFolder)
{
Shell32.ShellClass SC = new Shell32.ShellClass ();
Shell32.Folder SrcFolder = SC. NameSpace (zipFile );
Shell32.Folder DestFolder = SC. NameSpace (destFolder );
Shell32.FolderItems items = SrcFolder. Items ();
DestFolder. CopyHere (items, 20 );
}

(Note that destFolder must exist in advance. This method will not automatically create a folder)

DestFolder. in CopyHere (items, 20), 20 is actually an intOptions flags (4 | 16). 4 indicates that the processing window is not displayed, 16. If the processing window is displayed, select "yes to all ". For more information about intOptions, visit http://msdn2.microsoft.com/en-us/library/ms723207.aspx.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.