创建二进制文件编辑器

发布于 2024-08-20 19:17:17 字数 227 浏览 5 评论 0原文

我有一个相当简单的二进制文件格式,我希望创建一个编辑器:

  • 能够加载文件
  • 能够保存文件
  • 允许用户更改各个字段的值等
  • 能够使用旧版本的文件转换文件 显然,

我可以用 C#、Python 等编写该内容...但是我想知道是否有更简单的选项来创建这样的基本编辑器,它只允许我描述文件和任何条件/验证,而不必自己编写所有 IO 和编辑代码?

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?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

停滞 2024-08-27 19:17:17

处理此问题的最简单方法是编写软件将二进制文件与文本文件相互转换。然后您可以使用任何文本编辑器编辑数据。编辑后,运行该工具将其转换回二进制文件。

这也使得不同版本之间的转换变得容易。

这种方法的一些问题是浮点数精度的损失,如果二进制文件非常大,则转换所需的时间以及有时人们会忘记运行转换工具来更新实际的二进制副本。

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文