private void CopyThroughOneEntry(Stream outStream)
{
// Just read the entry from the existing input zipfile and write to the output.
// But, if metadata has changed (like file times or attributes), or if the ZIP64
// option has changed, we can re-stream the entry data but must recompute the
// metadata.
if (this.LengthOfHeader == 0)
throw new BadStateException("Bad header length.");
// is it necessary to re-constitute new metadata for this entry?
bool needRecompute = _metadataChanged ||
(this.ArchiveStream is ZipSegmentedStream) ||
(outStream is ZipSegmentedStream) ||
(_InputUsesZip64 && _container.UseZip64WhenSaving == Zip64Option.Never) ||
(!_InputUsesZip64 && _container.UseZip64WhenSaving == Zip64Option.Always);
if (needRecompute)
CopyThroughWithRecompute(outStream);
else
CopyThroughWithNoChange(outStream);
// zip64 housekeeping
_entryRequiresZip64 = new Nullable<bool>
(_CompressedSize >= 0xFFFFFFFF || _UncompressedSize >= 0xFFFFFFFF ||
_RelativeOffsetOfLocalHeader >= 0xFFFFFFFF
);
_OutputUsesZip64 = new Nullable<bool>(_container.Zip64 == Zip64Option.Always || _entryRequiresZip64.Value);
}