views:

51

answers:

1

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 editor 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?

+2  A: 

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.

Zan Lynx
A normal text editor won't do because users are free to insert or delete characters in text editor, which effectively destroys the binary format.
Codism
@Codism: I don't think you understood my idea. My suggestion is to write a program that converts from text to binary. Think of it as an assembler and disassembler. Any characters inserted or deleted in the editor are either handled by the compiler or the program makes an error message and they go back to fix it.
Zan Lynx