I'm using a memory reader to read a file and put it in a MemoryStream. The MemoryStream is populated, and I'm trying to read with the BinaryReader because the endianness of the file change, so I use a Binary reader that can detect the endianness.
When I use BinaryReader.Read or BinaryReader.ReadString or BinaryReader.ReadByte, it reads the correct data, but when I use ReadInt16 or the other like that, I don't get the correct data. Is it possible to use those, I made a mistake, or should I make something to use Read() instead?
The code:
MemoryStream ms = new MemoryStream();
object[] binMakerNoteObj = exif.findTag(37500).data;
byte[] binMakerNote = binMakerNoteObj.Cast<byte>().ToArray();
ms.Write(binMakerNote, 0, binMakerNote.Length);
ms.Position = 0;
// Read the header
string t = "";
for(int i = 0; i < 6; i ++)
t += fileStream.ReadChar();
version = fileStream.ReadUInt16();
unknow = fileStream.ReadUInt16();
byteOrder = fileStream.ReadUInt16();