protobuf转cs和java文件(一键生成)

上传者: a303159963 | 上传时间: 2021-09-07 11:11:36 | 文件大小: 2.17MB | 文件类型: ZIP
通过脚本把protobuf文件一键生成.cs和java文件 1.目录介绍 bean:中间目录 code:生成的代码存放路径 tools:编译工具 gen_proto.bat:一键生成C#和java代码 Mid.proto:测试用的protobuf文件 2.使用方法 运行gen_proto.bat后在code目录下可以找到生成的代码 附bat脚本代码: @echo off setlocal enabledelayedexpansion echo 开始生成proto代码... set "currPath=%~dp0" ::编译cs_proto的指令 set CSHARP_COMPILER_PATH="%currPath%\\tools\\ProtoGen\\CSharp\\protogen.exe" -output_directory=%currPath%\code\C# ::编译java_proto的指令 set JAVA_COMPILER_PATH="%currPath%\\tools\\ProtoGen\\Java\\protoc.exe" ::存放编译后的java文件 set JAVA_TARGET_PATH=%currPath%\code\java ::存放protobin目录 ::set PROTOBIN_PATH=bean ::遍历所有proto文件 echo --------JAVA---------------- for /f "delims=" %%i in ('dir /b ".\*.proto"') do ( echo %%i %JAVA_COMPILER_PATH% --java_out=%JAVA_TARGET_PATH% %%i %JAVA_COMPILER_PATH% --descriptor_set_out=bean/%%~ni.protobin --include_imports %%i ) echo ---------C#---------------- ::遍历所有protobin文件 for /f "delims=" %%j in ('dir /b "bean\*.protobin"') do ( echo %%j %CSHARP_COMPILER_PATH% bean/%%j ) echo. echo 执行完成... echo. PAUSE

文件下载

资源详情

[{"title":"( 51 个子文件 2.17MB ) protobuf转cs和java文件(一键生成)","children":[{"title":"proto-gen-tools","children":[{"title":"Mid.proto <span style='color:#111;'> 142B </span>","children":null,"spread":false},{"title":"tools","children":[{"title":"protogen.exe.config <span style='color:#111;'> 69B </span>","children":null,"spread":false},{"title":"ProtoGen","children":[{"title":"CSharp","children":[{"title":"protogen.exe.config <span style='color:#111;'> 282B </span>","children":null,"spread":false},{"title":"ProtoGen","children":[{"title":".vs","children":[{"title":"ProtoGen","children":[{"title":"v15","children":[{"title":"sqlite3","children":[{"title":"storage.ide <span style='color:#111;'> 420.00KB </span>","children":null,"spread":false}],"spread":true},{"title":".suo <span style='color:#111;'> 24.50KB </span>","children":null,"spread":false}],"spread":true}],"spread":true}],"spread":true},{"title":"UmbrellaClassGenerator.cs <span style='color:#111;'> 12.67KB </span>","children":null,"spread":false},{"title":"bin","children":[{"title":"NET35","children":[{"title":"Debug","children":null,"spread":false}],"spread":true}],"spread":true},{"title":"MessageFieldGenerator.cs <span style='color:#111;'> 8.06KB </span>","children":null,"spread":false},{"title":"SourceGeneratorBase.cs <span style='color:#111;'> 6.40KB </span>","children":null,"spread":false},{"title":"Program.cs <span style='color:#111;'> 3.22KB </span>","children":null,"spread":false},{"title":"EnumGenerator.cs <span style='color:#111;'> 2.65KB </span>","children":null,"spread":false},{"title":"obj","children":[{"title":"NET35","children":[{"title":"Debug","children":[{"title":"ProtoGen.csproj.CoreCompileInputs.cache <span style='color:#111;'> 42B </span>","children":null,"spread":false},{"title":"DesignTimeResolveAssemblyReferencesInput.cache <span style='color:#111;'> 6.63KB </span>","children":null,"spread":false},{"title":"TempPE","children":null,"spread":false}],"spread":false}],"spread":false}],"spread":false},{"title":"Helpers.cs <span style='color:#111;'> 1.95KB </span>","children":null,"spread":false},{"title":"ISourceGenerator.cs <span style='color:#111;'> 1.92KB </span>","children":null,"spread":false},{"title":"ExtensionGenerator.cs <span style='color:#111;'> 7.97KB </span>","children":null,"spread":false},{"title":"RepeatedMessageFieldGenerator.cs <span style='color:#111;'> 8.80KB </span>","children":null,"spread":false},{"title":"RepeatedPrimitiveFieldGenerator.cs <span style='color:#111;'> 9.44KB </span>","children":null,"spread":false},{"title":"Generator.cs <span style='color:#111;'> 11.80KB </span>","children":null,"spread":false},{"title":"GeneratorOptions.cs <span style='color:#111;'> 12.24KB </span>","children":null,"spread":false},{"title":"DescriptorUtil.cs <span style='color:#111;'> 4.25KB </span>","children":null,"spread":false},{"title":"ProgramPreprocess.cs <span style='color:#111;'> 10.82KB </span>","children":null,"spread":false},{"title":"ProtoGen.csproj <span style='color:#111;'> 5.44KB </span>","children":null,"spread":false},{"title":"SourceGenerators.cs <span style='color:#111;'> 4.28KB </span>","children":null,"spread":false},{"title":"app.config <span style='color:#111;'> 282B </span>","children":null,"spread":false},{"title":"ServiceInterfaceGenerator.cs <span style='color:#111;'> 15.37KB </span>","children":null,"spread":false},{"title":"ServiceGenerator.cs <span style='color:#111;'> 9.20KB </span>","children":null,"spread":false},{"title":"IFieldSourceGenerator.cs <span style='color:#111;'> 2.42KB </span>","children":null,"spread":false},{"title":"lib","children":[{"title":"Google.ProtocolBuffers.Serialization.dll <span style='color:#111;'> 56.00KB </span>","children":null,"spread":false},{"title":"Google.ProtocolBuffers.dll <span style='color:#111;'> 311.00KB </span>","children":null,"spread":false}],"spread":false},{"title":"MessageGenerator.cs <span style='color:#111;'> 43.06KB </span>","children":null,"spread":false},{"title":"InvalidOptionsException.cs <span style='color:#111;'> 2.96KB </span>","children":null,"spread":false},{"title":"DependencyResolutionException.cs <span style='color:#111;'> 2.29KB </span>","children":null,"spread":false},{"title":"ProtoGen.sln <span style='color:#111;'> 905B </span>","children":null,"spread":false},{"title":"FieldGeneratorBase.cs <span style='color:#111;'> 15.64KB </span>","children":null,"spread":false},{"title":"RepeatedEnumFieldGenerator.cs <span style='color:#111;'> 10.08KB </span>","children":null,"spread":false},{"title":"PrimitiveFieldGenerator.cs <span style='color:#111;'> 6.26KB </span>","children":null,"spread":false},{"title":"Properties","children":[{"title":"AssemblyInfo.cs <span style='color:#111;'> 1002B </span>","children":null,"spread":false}],"spread":false},{"title":"EnumFieldGenerator.cs <span style='color:#111;'> 7.07KB </span>","children":null,"spread":false}],"spread":false},{"title":"protoc.exe <span style='color:#111;'> 868.00KB </span>","children":null,"spread":false},{"title":"protogen.exe <span style='color:#111;'> 99.00KB </span>","children":null,"spread":false},{"title":"Google.ProtocolBuffers.Serialization.dll <span style='color:#111;'> 56.00KB </span>","children":null,"spread":false},{"title":"ReadMe - 90km.txt <span style='color:#111;'> 682B </span>","children":null,"spread":false},{"title":"Google.ProtocolBuffers.dll <span style='color:#111;'> 311.00KB </span>","children":null,"spread":false}],"spread":true},{"title":"Java","children":[{"title":"protoc.exe <span style='color:#111;'> 2.21MB </span>","children":null,"spread":false}],"spread":true}],"spread":true},{"title":"protoc.exe <span style='color:#111;'> 2.21MB </span>","children":null,"spread":false},{"title":"protogen.exe <span style='color:#111;'> 69.50KB </span>","children":null,"spread":false},{"title":"Google.ProtocolBuffers.dll <span style='color:#111;'> 273.50KB </span>","children":null,"spread":false}],"spread":true},{"title":"bean","children":[{"title":"Mid.protobin <span style='color:#111;'> 73B </span>","children":null,"spread":false}],"spread":true},{"title":"code","children":[{"title":"C#","children":[{"title":"Mid.cs <span style='color:#111;'> 870B </span>","children":null,"spread":false}],"spread":true},{"title":"java","children":[{"title":"com","children":[{"title":"dx","children":[{"title":"game","children":[{"title":"message","children":[{"title":"Mid.java <span style='color:#111;'> 3.58KB </span>","children":null,"spread":false}],"spread":true}],"spread":true}],"spread":true}],"spread":true}],"spread":true}],"spread":true},{"title":"gen_proto.bat <span style='color:#111;'> 969B </span>","children":null,"spread":false}],"spread":true}],"spread":true}]

评论信息

免责申明

【只为小站】的资源来自网友分享,仅供学习研究,请务必在下载后24小时内给予删除,不得用于其他任何用途,否则后果自负。基于互联网的特殊性,【只为小站】 无法对用户传输的作品、信息、内容的权属或合法性、合规性、真实性、科学性、完整权、有效性等进行实质审查;无论 【只为小站】 经营者是否已进行审查,用户均应自行承担因其传输的作品、信息、内容而可能或已经产生的侵权或权属纠纷等法律责任。
本站所有资源不代表本站的观点或立场,基于网友分享,根据中国法律《信息网络传播权保护条例》第二十二条之规定,若资源存在侵权或相关问题请联系本站客服人员,zhiweidada#qq.com,请把#换成@,本站将给予最大的支持与配合,做到及时反馈和处理。关于更多版权及免责申明参见 版权及免责申明