在 Windows Phone 8 应用程序中下载并解压一个 zip 文件 [英] download and decompress a zip file in windows phone 8 application

查看:30
本文介绍了在 Windows Phone 8 应用程序中下载并解压一个 zip 文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个 Windows Phone 8 应用程序 (phonegap),它从我的服务器位置下载一个 zip 文件,我想在运行时在我的应用程序中解压缩这个文件以使用存档中的文件.

I am working on a windows phone 8 application (phonegap) which downloads a zip file from my server location, I want to unzip this file in my application at runtime to use the files in the archive.

推荐答案

您可以使用 3rd 方库来解压和提取 WP7/WP8 中的 ZIP 文件.最常见的是#ZipLib,您可以从@http://slsharpziplib.codeplex.com/

You can use 3rd party libraries in order to decompress and extract ZIP files in WP7/WP8. The most common one is #ZipLib which you can download the WP7 port from @ http://slsharpziplib.codeplex.com/

我个人最喜欢的库是 DotNetZip,它是#ZipLib 的超集,并且更稳定 IMO.这是一个快速代码示例:

My personal favourite library is DotNetZip which is a superset of #ZipLib and much more stable IMO. Here's a quick code sample:

  private void MyExtract()
  {
      string zipToUnpack = "C1P3SML.zip";
      string unpackDirectory = "Extracted Files";
      using (ZipFile zip1 = ZipFile.Read(zipToUnpack))
      {
          // here, we extract every entry, but we could extract conditionally
          // based on entry name, size, date, checkbox status, etc.  
          foreach (ZipEntry e in zip1)
          {
            e.Extract(unpackDirectory, ExtractExistingFileAction.OverwriteSilently);
          }
       }

这篇关于在 Windows Phone 8 应用程序中下载并解压一个 zip 文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆