0

If using a BinaryFormatter to serialize a two dimensional float[,] array:

 var bf = new BinaryFormatter();
 using var (fs = new FileStream(filePath, FileMode.Create, FileAccess.Write))
 {
     bf.Serialize(fs, data);
 }

This worked just fine as long as I could use the reverse (float[,])bf.Deserialize(fs); to deserialize the data. Unfortunatley, I now need to access the previously generated serialized files without the comfort of C#, therefore I'd need to know the information stored in the header of the files.

This header is, at least for my files, 37bytes long and for example contains the following information in this bytes:

  • 25-28: Array.Length(0) (aka. "Width")
  • 39-32: Array.Length(1) (aka. "Height")

I'd like to know what else is stored in the default header of the serialized data - is there any documentation on this? I alread checked the according page on MSDN and found the source, but that did not clarify anything for me.

Update:

Community
  • 1
  • 1
DIF
  • 2,470
  • 6
  • 35
  • 49
  • 1
    Is it possible to convert the files to a new format instead? `BinaryFormatter` isn't really designed for interoperability. Part of the header is the definition of the exact (managed) types used in the serialization etc., not something you'd like to interpret outside of .NET. – Luaan Jun 29 '15 at 08:11
  • @Luaan Good point. If I were him, I would use a text file for that array –  Jun 29 '15 at 08:17

0 Answers0