Exemplo n.º 1
0
 private void FlushEntryData()
 {
     if (this.Archive.Mode == ZipArchiveMode.Create)
     {
         if (this.compressedData == null)
         {
             return;
         }
         this.FlushFinalBlockAndDataDescriptor();
     }
     else
     {
         if (this.Archive.Mode != ZipArchiveMode.Update)
         {
             return;
         }
         if (this.updatableData != null)
         {
             this.OpenForWriting();
             this.updatableData.Seek(0L, SeekOrigin.Begin);
             ZipFile.CopyStreamTo(this.updatableData, (Stream)this.compressedData);
             this.FlushFinalBlockAndDataDescriptor();
         }
         else
         {
             long compressedDataOffset = this.CompressedDataOffset;
             this.WriteLocalFileHeader();
             this.Archive.Reader.BaseStream.Seek(compressedDataOffset, SeekOrigin.Begin);
             ZipHelper.CopyStream(this.Archive.Reader.BaseStream, this.Archive.Writer.BaseStream, this.CompressedLength);
             this.WriteDataDescriptor();
         }
     }
 }