# HG changeset patch # User riono # Date 1621931477 -32400 # Node ID 0cd765be9693489128eab19a167b3e05a2b75489 # Parent 7276e3429c992ddadf9d02a835f40b8dbc6f7922 update diff -r 7276e3429c99 -r 0cd765be9693 Test/RewritingTest/MessagepackTest.cs --- a/Test/RewritingTest/MessagepackTest.cs Tue May 25 03:02:38 2021 +0900 +++ b/Test/RewritingTest/MessagepackTest.cs Tue May 25 17:31:17 2021 +0900 @@ -1,4 +1,5 @@ using System; +using Christie_net.datagear; using Christie_net.datagear.dg; using MessagePack; @@ -25,12 +26,31 @@ message.foo = 10; message.data = MessagePackSerializer.Serialize(100); - byte[] bytes = MessagePackSerializer.Serialize(message); - MessagepackTest mes = MessagePackSerializer.Deserialize(bytes); + SerializeObj obj = new SerializeObj(); + byte[] slie = obj.SerializeFunc(message); + + var desli = obj.DeserializeFunc(slie); + MessagepackTest test = (MessagepackTest) desli; + Console.WriteLine("varl;" + test.foo); - int data = MessagePackSerializer.Deserialize(mes.data); - Console.WriteLine(data); + // byte[] bytes = MessagePackSerializer.Serialize(message); + // MessagepackTest mes = MessagePackSerializer.Deserialize(bytes); + // + // + // int data = MessagePackSerializer.Deserialize(mes.data); + //Console.WriteLine(data); } } + +public class SerializeObj { + + public byte[] SerializeFunc(T data) { + return MessagePackSerializer.Serialize(data); + } + + public object DeserializeFunc(byte[] data) { + return MessagePackSerializer.Deserialize(data); + } +} } \ No newline at end of file diff -r 7276e3429c99 -r 0cd765be9693 datagear/command/PutCommand.cs --- a/datagear/command/PutCommand.cs Tue May 25 03:02:38 2021 +0900 +++ b/datagear/command/PutCommand.cs Tue May 25 17:31:17 2021 +0900 @@ -5,7 +5,7 @@ using MessagePack; namespace Christie_net.datagear.command { -public class PutCommand : Command{ +public class PutCommand : Command { public PutCommand(CommandBuilder cb) : base(cb) { this.clazz = dg.GetClazz(); } @@ -26,7 +26,9 @@ // stream.Write(dataSize); // stream.Write(data); - byte[] data = new MessagePackDataGear(dg.GetData()).GetMessagePack(); + var dgData = dg.GetData(); + + byte[] data = new MessagePackDataGear(dg.GetData() as RTCommand).GetMessagePack(); byte[] command = MessagePackSerializer.Serialize(CreateRemoteMessage(data)); // Debug diff -r 7276e3429c99 -r 0cd765be9693 datagear/command/RemotePeedCommand.cs --- a/datagear/command/RemotePeedCommand.cs Tue May 25 03:02:38 2021 +0900 +++ b/datagear/command/RemotePeedCommand.cs Tue May 25 17:31:17 2021 +0900 @@ -1,7 +1,7 @@ using System.IO; namespace Christie_net.datagear.command { -public class RemotePeedCommand : Command{ +public class RemotePeedCommand : Command { public RemotePeedCommand(CommandBuilder cb) : base(cb) { } public override void Execute() { diff -r 7276e3429c99 -r 0cd765be9693 datagear/dg/DataGear.cs --- a/datagear/dg/DataGear.cs Tue May 25 03:02:38 2021 +0900 +++ b/datagear/dg/DataGear.cs Tue May 25 17:31:17 2021 +0900 @@ -8,6 +8,8 @@ public DataGear(T data) { SetClazz(data.GetType()); SetData(data); + + Console.WriteLine("type:" + data.GetType()); } public DataGear(Type clazz) { diff -r 7276e3429c99 -r 0cd765be9693 datagear/dg/MessagePackDataGear.cs --- a/datagear/dg/MessagePackDataGear.cs Tue May 25 03:02:38 2021 +0900 +++ b/datagear/dg/MessagePackDataGear.cs Tue May 25 17:31:17 2021 +0900 @@ -1,4 +1,5 @@ using System; +using Christie_net.Test.Example.RemoteTake; using MessagePack; namespace Christie_net.datagear.dg { @@ -14,6 +15,7 @@ public MessagePackDataGear(Type clazz) : base(clazz) { } public MessagePackDataGear(byte[] messagePack, Type clazz) : base(clazz) { + Console.WriteLine("call"); this.messagePack = messagePack; } @@ -22,7 +24,9 @@ return messagePack; try { // Debug - Console.WriteLine("data:" + data.GetType()); + Console.WriteLine("data:" + data); + Console.WriteLine(); + messagePack = MessagePackSerializer.Serialize(data); SetDataSize(messagePack.Length);