I would like to read a binary file from a zip file without unzipping it .
The zip file structure:
zipFolderName/subFolder/BinFile
In the BinFile, I have:
Id1, id2, value1 // id1, id2 are string, value1 is int
In C#:
ZipEntry binFileName = …; // it has been got from zipFile entries
MemoryStream ms = new MemoryStream();
binFileName.Extract(ms);
using (BinaryReader reader = new BinaryReader(ms))
{
string id1 = reader.ReadString(); // error popped here
string id2 = reader.ReadString();
int value1 = reader.ReadInt32();
}
I got error: Unable to read beyond the end of the stream. It seems that BinaryReader cannnot read MemoryStream ?