I've got a fairly simple binary file format I wish to create an editor for:
- Able to load the files
- Able to save the files
- Allow the user to change the value of the various fields etc
- Able to convert a file using an older version of the format to a new version
Obviously I could just write the thing in C#, Python, etc. etc...However I was wondering if there are easier options for creating a basic edi开发者_StackOverflow中文版tor like this which would just allow me to describe the contents of the file and any conditions/validation, without having to write all the IO and editing code myself?
The easiest way to handle this is to write software to convert the binary to and from a text file. Then you can edit the data using any text editor. After editing you run the tool to convert it back to binary.
This also makes it easy to convert to and from different versions.
Some of the problems with this approach are the loss of accuracy in floating point numbers, the time it takes to do the conversion if the binary is very large and the fact the sometimes people will forget to run the conversion tool to update the actual binary copy.
精彩评论