0

我正在使用 framework 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 文件。现在我的问题是:是否可以直接从 Bits 中提取 zip 文件并仅保存提取的文件。

4

0 回答 0