如何解压缩zip文件

时间:2013-10-09 05:48:47

标签: c# wpf-4.0

我正在使用框架4.0处理WPF应用程序。我正在使用以下代码下载Zip文件

 public void DownloadZip(string _URL, string zip_local_path)
    {

        try
        {

            WebClient webClient = new WebClient();
            webClient.Headers.Add(HttpRequestHeader.UserAgent, "blah");              
            webClient.DownloadDataCompleted += new DownloadDataCompletedEventHandler(webClient_DownloadDataCompleted);
            // Specify a progress notification handler.
            webClient.DownloadProgressChanged += new DownloadProgressChangedEventHandler(webClient_DownloadProgressChanged);
           // isDownloading = true;               
            this.zip_local_path = zip_local_path + "/" + _URL.Substring(_URL.LastIndexOf("/") + 1);              
            webClient.DownloadDataAsync(new Uri(_URL));

        }
        catch (WebException ex)
        {

        }
    }  



 void webClient_DownloadDataCompleted(object sender, DownloadDataCompletedEventArgs e)
    {           
      zipData=  e.Result;
   //Save Zip file in local drive.
      File.WriteAllBytes(this.zip_local_path, zipData);
      FileInfo fi = new FileInfo(this.zip_local_path);
      DirectoryPath=  Decompress(fi, this.img_isometric);
      //isDownloading = false;
      //isDownloaded = true;
     }

这里 zipData 变量hods包含所有的zip文件。       现在我的问题是:是否可以直接从bites&中提取zip文件。仅保存解压缩的文件。

0 个答案:

没有答案