Ejemplo n.º 1
0
        public virtual void CopyToStream(Stream fstgt)
        {
            FileStream fssrc = File.OpenRead(sourcePath);

            try
            {
                fssrc.Seek(this.Start, SeekOrigin.Begin);
                if (compressed)
                {
                    fstgt = new ComponentAce.Compression.Libs.zlib.ZOutputStream(fstgt);
                }
                StreamUtils.CopyFromStreamToStream(fssrc, fstgt, this.length);
            }
            finally
            {
                fssrc.Close();
            }
        }
Ejemplo n.º 2
0
 public override void CopyToStream(Stream fstgt)
 {
     using (FileStream fs = File.OpenRead(sourcePath))
     {
         fs.Seek(offset, SeekOrigin.Begin);
         ZipInputStream zs = new ZipInputStream(fs);
         ZipEntry       ze;
         int            index = 0;
         while ((ze = zs.GetNextEntry()) != null)
         {
             if (itemIndex == index)
             {
                 StreamUtils.CopyFromStreamToStream(zs, fstgt, ze.Size);
                 return;
             }
             index++;
         }
     }
 }