I'm trying to parse a binary file, and I can't quite figure out how to use BinData properly.
The way the binary is set up is like such:
- first 4 bytes (UINT32) represent the length of the property name.
- next 8 * length represent the property name (as a string).
- next 4 bytes (UINT32) represent the length of the property type.
- next 8 * length represent the property type (as a string).
- next 8 bytes (UINT64) represent the length of the data.
- after this the data could be any number of bytes (depending on what type of data it is, could be int (4), string (4 * len), float (4), or an array).
After this the process repeats with the next property.
I guess my questions are:
When I call MyBinDataClass.read() how do I feed it the correct portion to read and not the whole file, and since I don't know how long each property really is (they vary by type), how could I divide it properly?
How do I make a single BinData handle the different property types?