perf[protocol]: 使用模板生成协议

This commit is contained in:
jaysunxiao
2022-05-18 18:35:12 +08:00
parent 5eb2530eae
commit d4ded2dd19
15 changed files with 99 additions and 144 deletions
+2 -2
View File
@@ -13,7 +13,7 @@ namespace csharp
ProtocolManager.InitProtocol();
// 获取复杂对象的字节流
var complexObjectBytes = File.ReadAllBytes("C:\\zfoo\\protocol\\src\\test\\resources\\ComplexObject.bytes");
var complexObjectBytes = File.ReadAllBytes("../resources/ComplexObject.bytes");
var buffer = ByteBuffer.ValueOf();
buffer.WriteBytes(complexObjectBytes);
var packet = ProtocolManager.Read(buffer);
@@ -187,4 +187,4 @@ namespace csharp
throw new Exception("a is not equals b");
}
}
}
}
@@ -1,6 +1,7 @@
using System.IO;
using System.Text;
using NUnit.Framework;
using Spring.Util;
using XLua;
namespace Test.Editor.LuaTest
@@ -18,7 +19,7 @@ namespace Test.Editor.LuaTest
var luaEnv = new LuaEnv();
var luaDebugBuilder = new StringBuilder();
// Rider的断点调试
// luaDebugBuilder.Append("package.cpath = package.cpath .. ';C:/Users/jm/AppData/Roaming/JetBrains/Rider2020.1/plugins/intellij-emmylua/classes/debugger/emmy/windows/x64/?.dll'").Append(FileUtils.LS);
// luaDebugBuilder.Append("package.cpath = package.cpath .. ';C:/Users/jaysunxiao/AppData/Roaming/JetBrains/Rider2021.1/plugins/EmmyLua/classes/debugger/emmy/windows/x64/?.dll'").Append(FileUtils.LS);
// luaDebugBuilder.Append("local dbg = require('emmy_core')").Append(FileUtils.LS);
// luaDebugBuilder.Append("dbg.tcpListen('localhost', 9966)").Append(FileUtils.LS);
// luaDebugBuilder.Append("dbg.waitIDE()").Append(FileUtils.LS);
@@ -27,8 +28,8 @@ namespace Test.Editor.LuaTest
luaEnv.AddLoader(CustomLoader);
var luaProtocolTestStr = File.ReadAllText(TEST_PATH + "LuaProtocolTest.lua");
luaEnv.DoString(luaProtocolTestStr, "LuaProtocolTest");
var luaProtocolTestStr = File.ReadAllText(TEST_PATH + "main.lua");
luaEnv.DoString(luaProtocolTestStr, "main");
LuaFunction byteBufferTestFunction = luaEnv.Global.Get<LuaFunction>("byteBufferTest");
byteBufferTestFunction.Call();
@@ -44,4 +45,4 @@ namespace Test.Editor.LuaTest
return File.ReadAllBytes(TEST_PATH + filepath);
}
}
}
}