简体   繁体   English

将 BIN 文件解码为 JSON 文件、协议缓冲区、Visual Studio 代码

[英]Decode BIN File to JSON File, Protocol buffer, Visual Studio Code

I have to decode BIN file downloaded from a company server to.txt or JSON File format using protocol buffer/compiler (which I have installed).我必须使用协议缓冲区/编译器(我已经安装)解码从公司服务器下载的 BIN 文件 to.txt 或 JSON 文件格式。 I am using the following decode command in VS Code terminal for the purpose but do not able to deduce the error.为此,我在 VS Code 终端中使用以下解码命令,但无法推断出错误。 I am an automotive systems engineer with no knowledge of coding language and have to decode the BIN file to complete my graduation thesis, so any help will be great full.我是一名汽车系统工程师,对编码语言一无所知,必须对 BIN 文件进行解码才能完成我的毕业论文,所以任何帮助都会非常充分。

Windows Powershell error: Windows Powershell 错误:

PS C:\Users\user\Desktop\MyPrograms> C:\protoc-3.14.0-win64\bin\protoc --decode=se.niradynamics.ncs.protobuf.output.RoadLayerTile roadlayertile.proto "< road_roughness_aggregation_23602633.bin >" output.txt
Could not make proto path relative: < road_roughness_aggregation_23602633.bin >: No such file or directory

It's just that it can't find the bin file, you have to search for it with the Windows file manager .只是找不到bin文件,只能用Windows文件管理器搜索。

You should not have quotes around the pipe ( < and > ) operations, otherwise instead of redirecting stdin / stdout, you are looking for the literal file with > and < in the path, which isn't a thing that can exist.您不应该在 pipe ( < 和 > )操作周围加上引号,否则不是重定向标准输入/标准输出,而是在路径中寻找带有 > 和 < 的文字文件,这不是可以存在的东西。 Take away the double quotes entirely.完全去掉双引号。

To be honest though: using protoc here is very much doing this the hard way.不过说实话:在这里使用 protoc 非常困难。 If this was me, I'd run the.proto through either protoc or protogen to get a code model that represents the schema in my language of choice, and deserialize into that , then run that model through any JSON serializer.如果这是我,我会通过 protoc 或 protogen 运行 .proto 以获得一个代码 model ,它代表我选择的语言中的架构,然后反序列化为代码,然后通过任何 Z0ECD11C1D7A2BDD7A20 运行 model。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM