当前位置: 代码迷 >> Windows Mobile >> WP7下怎么将数据用zip压缩和解压缩
  详细解决方案

WP7下怎么将数据用zip压缩和解压缩

热度:63   发布时间:2016-04-25 07:27:18.0
WP7上如何将数据用zip压缩和解压缩
SharpZipLib中的zip压缩都是将文件进行压缩和解压缩(文件在压缩包中有一个entry),如何直接将内存中的数据进行zip压缩呢(不需要entry)?

------解决方案--------------------
直接流操作的吧,没用过sharpXXX,能移植个zlib更好
------解决方案--------------------
 public static bool UnZip(Stream zipfilestren, string directoryName, string password,string strTotal)
         {
             bool ret = true;
             try
             {
                 IsolatedStorageFile file = IsolatedStorageFile.GetUserStoreForApplication();
 
             {
                     ZipInputStream s = new ZipInputStream(zipfilestren);
 
                                   if (password != null && password.Length > 0)
                         s.Password = password;
 
                    BinaryReader reader = new BinaryReader(s);
                     ZipEntry theEntry;
                     long sizezip = 0;
 
                    while ((theEntry = s.GetNextEntry()) != null)
                     {
                         string fileName = theEntry.Name;
                         if (fileName != String.Empty)
                         {
                             if (theEntry.CompressedSize == 0)
                                 continue;
                             if (!theEntry.IsFile)
                             {
  相关解决方案