public FileEntities.FileHeader ReadFileHeader() { // // For some reason the DeflateStream used by ZlibStream will sometimes hit EOF prematurely if we read only // // small parts at a time. But apparently we can work around this by reading the full file header first into // // a buffer and proceed by reading from the buffer. using (var memoryReader = new BinaryReader(new MemoryStream(this.BaseReader.ReadBytes(560)))) { using (var memoryStructReader = new ContainerFileLoaderStructureReader(memoryReader, true)) { var result = new FileEntities.FileHeader() { Path = memoryStructReader.ReadUTF16String(520, FileFormatException.EntityType.FileHeader), DataOffset = memoryStructReader.ReadInt64(FileFormatException.EntityType.FileHeader), CompressedFileSize = memoryStructReader.ReadInt64(FileFormatException.EntityType.FileHeader), UncompressedFileSize = memoryStructReader.ReadInt64(FileFormatException.EntityType.FileHeader), ModificationTimestamp = memoryStructReader.ReadInt64(FileFormatException.EntityType.FileHeader), }; memoryStructReader.ReadInt64(FileFormatException.EntityType.FileHeader); // skipped return(result); } } }