private void SetFdpLoh()
{
// The value for FileDataPosition has not yet been set.
// Therefore, seek to the local header, and figure the start of file data.
// workitem 8098: ok (restore)
long origPosition = this.ArchiveStream.Position;
try
{
this.ArchiveStream.Seek(this._RelativeOffsetOfLocalHeader, SeekOrigin.Begin);
// workitem 10178
Crisis.Ionic.Zip.SharedUtilities.Workaround_Ladybug318918(this.ArchiveStream);
}
catch (System.IO.IOException exc1)
{
string description = String.Format("Exception seeking entry({0}) offset(0x{1:X8}) len(0x{2:X8})",
this.FileName, this._RelativeOffsetOfLocalHeader,
this.ArchiveStream.Length);
throw new BadStateException(description, exc1);
}
byte[] block = new byte[30];
this.ArchiveStream.Read(block, 0, block.Length);
// At this point we could verify the contents read from the local header
// with the contents read from the central header. We could, but don't need to.
// So we won't.
Int16 filenameLength = (short)(block[26] + block[27] * 256);
Int16 extraFieldLength = (short)(block[28] + block[29] * 256);
// Console.WriteLine(" pos 0x{0:X8} ({0})", this.ArchiveStream.Position);
// Console.WriteLine(" seek 0x{0:X8} ({0})", filenameLength + extraFieldLength);
this.ArchiveStream.Seek(filenameLength + extraFieldLength, SeekOrigin.Current);
// workitem 10178
Crisis.Ionic.Zip.SharedUtilities.Workaround_Ladybug318918(this.ArchiveStream);
this._LengthOfHeader = 30 + extraFieldLength + filenameLength +
GetLengthOfCryptoHeaderBytes(_Encryption_FromZipFile);
// Console.WriteLine(" ROLH 0x{0:X8} ({0})", _RelativeOffsetOfLocalHeader);
// Console.WriteLine(" LOH 0x{0:X8} ({0})", _LengthOfHeader);
// workitem 8098: ok (arithmetic)
this.__FileDataPosition = _RelativeOffsetOfLocalHeader + _LengthOfHeader;
// Console.WriteLine(" FDP 0x{0:X8} ({0})", __FileDataPosition);
// restore file position:
// workitem 8098: ok (restore)
this.ArchiveStream.Seek(origPosition, SeekOrigin.Begin);
// workitem 10178
Crisis.Ionic.Zip.SharedUtilities.Workaround_Ladybug318918(this.ArchiveStream);
}