|
@@ -2,7 +2,9 @@
|
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
|
using System.Diagnostics;
|
|
using System.Diagnostics;
|
|
|
using System.IO;
|
|
using System.IO;
|
|
|
|
|
+using System.Runtime.InteropServices;
|
|
|
using System.Text;
|
|
using System.Text;
|
|
|
|
|
+using ETModel;
|
|
|
|
|
|
|
|
namespace ETTools
|
|
namespace ETTools
|
|
|
{
|
|
{
|
|
@@ -16,8 +18,17 @@ namespace ETTools
|
|
|
{
|
|
{
|
|
|
public static void Main()
|
|
public static void Main()
|
|
|
{
|
|
{
|
|
|
- Run("protoc.exe", "--csharp_out=\"../Unity/Assets/Model/Module/Message/\" --proto_path=\"./\" OuterMessage.proto");
|
|
|
|
|
- Run("protoc.exe", "--csharp_out=\"../Unity/Assets/Hotfix/Module/Message/\" --proto_path=\"./\" HotfixMessage.proto");
|
|
|
|
|
|
|
+ string protoc = "";
|
|
|
|
|
+ if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
|
|
|
|
+ {
|
|
|
|
|
+ protoc = "protoc.exe";
|
|
|
|
|
+ }
|
|
|
|
|
+ else
|
|
|
|
|
+ {
|
|
|
|
|
+ protoc = "protoc";
|
|
|
|
|
+ }
|
|
|
|
|
+ ProcessHelper.Run(protoc, "--csharp_out=\"../Unity/Assets/Model/Module/Message/\" --proto_path=\"./\" OuterMessage.proto");
|
|
|
|
|
+ ProcessHelper.Run(protoc, "--csharp_out=\"../Unity/Assets/Hotfix/Module/Message/\" --proto_path=\"./\" HotfixMessage.proto");
|
|
|
|
|
|
|
|
// InnerMessage.proto生成cs代码
|
|
// InnerMessage.proto生成cs代码
|
|
|
InnerProto2CS.Proto2CS();
|
|
InnerProto2CS.Proto2CS();
|
|
@@ -37,28 +48,6 @@ namespace ETTools
|
|
|
private static readonly char[] splitChars = { ' ', '\t' };
|
|
private static readonly char[] splitChars = { ' ', '\t' };
|
|
|
private static readonly List<OpcodeInfo> msgOpcode = new List<OpcodeInfo>();
|
|
private static readonly List<OpcodeInfo> msgOpcode = new List<OpcodeInfo>();
|
|
|
|
|
|
|
|
- public static void Run(string exe, string arguments)
|
|
|
|
|
- {
|
|
|
|
|
- Console.WriteLine($"execute: {exe} {arguments}");
|
|
|
|
|
- ProcessStartInfo info = new ProcessStartInfo
|
|
|
|
|
- {
|
|
|
|
|
- FileName = exe,
|
|
|
|
|
- Arguments = arguments,
|
|
|
|
|
- CreateNoWindow = true,
|
|
|
|
|
- UseShellExecute = false,
|
|
|
|
|
- WorkingDirectory = ".",
|
|
|
|
|
- RedirectStandardOutput = true,
|
|
|
|
|
- RedirectStandardError = true,
|
|
|
|
|
- };
|
|
|
|
|
-
|
|
|
|
|
- Process process = Process.Start(info);
|
|
|
|
|
- process.WaitForExit();
|
|
|
|
|
- if (process.ExitCode != 0)
|
|
|
|
|
- {
|
|
|
|
|
- throw new Exception(process.StandardOutput.ReadToEnd() + process.StandardError.ReadToEnd());
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
public static void Proto2CS(string ns, string protoName, string outputPath, string opcodeClassName, int startOpcode, bool isClient = true)
|
|
public static void Proto2CS(string ns, string protoName, string outputPath, string opcodeClassName, int startOpcode, bool isClient = true)
|
|
|
{
|
|
{
|
|
|
msgOpcode.Clear();
|
|
msgOpcode.Clear();
|