CathalMF
CathalMF

Reputation: 10055

C# Reading a binary text file without knowing the format of the file

Ok so I have a Binary text file written using a BinaryWriter. The format of the file has been lost due to poor documentation.

Im using the BinaryReader to read the file but the only way I can do this is through trial and error by stepping through the file and guessing whether I should be using the ReadInt64(), ReadString() etc of the BinaryReader class.

Is there anyway to step through the file and automatically determine what the next value format is?

Upvotes: 2

Views: 824

Answers (1)

driis
driis

Reputation: 164281

No. The BinaryWriter does not pack any type information into the written file, so there is no way to reverse-engineering that - other than trial & error, as you have found out.

Upvotes: 2

Related Questions