Esempio n. 1
0
 /// <summary>
 /// Gets the raw data from entry.
 /// </summary>
 /// <param name="zipEntry">The zip entry.</param>
 /// <returns>IEnumerable with the zip entry content.</returns>
 private IEnumerable <string> GetRawDataStreamFromEntry(ZipEntry zipEntry)
 {
     using (var outerStream = new StreamReader(zipEntry.OpenReader()))
         using (var innerStream = new GZipStream(outerStream.BaseStream, CompressionMode.Decompress))
             using (var outputStream = new StreamReader(innerStream))
             {
                 string line;
                 while ((line = outputStream.ReadLine()) != null)
                 {
                     yield return(line);
                 }
             }
 }
Esempio n. 2
0
        public ZipSubfileReader_DotNetZip(string zipPath, string subPath)
        {
            var zipfile = new Ionic.Zip.ZipFile(zipPath);

            try {
                Ionic.Zip.ZipEntry entry = zipfile[subPath];
                if (entry == null)
                {
                    throw new System.IO.FileNotFoundException("Cannot find subfile");
                }

                SetWrapped(entry.OpenReader(), true);
                m_file  = zipfile;
                zipfile = null;
            } finally {
                if (zipfile != null)
                {
                    zipfile.Dispose();
                }
            }
        }