From 8419ecdd09a48af102afcb8e3ee06f74ef001867 Mon Sep 17 00:00:00 2001 From: K35 Date: Mon, 10 Jan 2022 14:08:38 +0000 Subject: [PATCH] Make sending packet events possible --- examples/CSharp/Example/Program.cs | 6 +++--- package.json | 2 +- templates/CSharp/JRpcTransport.cs | 3 ++- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/examples/CSharp/Example/Program.cs b/examples/CSharp/Example/Program.cs index fcdfe32..34edf5b 100644 --- a/examples/CSharp/Example/Program.cs +++ b/examples/CSharp/Example/Program.cs @@ -46,7 +46,7 @@ class CopyTransportS2 : Example.JRpcTransport { public override Task Write(string data) { Console.WriteLine("--> " + data); - this.tr1.DevSendPacket(data); + this.tr1.SendPacketEvent(data); return Task.CompletedTask; } @@ -63,7 +63,7 @@ class CopyTransportS1 : Example.JRpcTransport { public override Task Write(string data) { Console.WriteLine("<-- " + data); - this.tr2.DevSendPacket(data); + this.tr2.SendPacketEvent(data); return Task.CompletedTask; } } @@ -77,8 +77,8 @@ class Program { var server = new Example.JRpcServer(); server.AddService(new TestSrvimpl()); var transport = new CopyTransportS1(); - var sess = server.GetSession(transport, 0); + var client = new Example.JRpcClient(transport.tr2); var testService = new Example.TestServiceClient(client); diff --git a/package.json b/package.json index ab3f7a9..be3b473 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hibas123/jrpcgen", - "version": "1.0.16", + "version": "1.0.18", "main": "lib/index.js", "license": "MIT", "packageManager": "yarn@3.1.1", diff --git a/templates/CSharp/JRpcTransport.cs b/templates/CSharp/JRpcTransport.cs index ee9709a..90e6e07 100644 --- a/templates/CSharp/JRpcTransport.cs +++ b/templates/CSharp/JRpcTransport.cs @@ -8,7 +8,8 @@ public abstract class JRpcTransport { public event NotifyPacket OnPacket; public abstract Task Write(string data); - public void DevSendPacket(string data) { + // TODO: Spend some time finding a better permission, but it is fine for now + public void SendPacketEvent(string data) { this.OnPacket.Invoke(data); } }