开发者

Creating an editor for binary files

开发者 https://www.devze.com 2022-12-19 15:52 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号