Mercurial > hg > Database > Christie-sharp
changeset 44:132f56edd10c
bug servey
author | riono <e165729@ie.u-ryukyu.ac.jp> |
---|---|
date | Tue, 21 Sep 2021 18:53:34 +0900 |
parents | 87d88bc28ac0 |
children | 98ee1ee1efb7 |
files | daemon/IncomingTcpConnection.cs datagear/command/PutCommand.cs datagear/dg/MessagePackDataGear.cs |
diffstat | 3 files changed, 26 insertions(+), 14 deletions(-) [+] |
line wrap: on
line diff
--- a/daemon/IncomingTcpConnection.cs Sun Sep 19 18:03:04 2021 +0900 +++ b/daemon/IncomingTcpConnection.cs Tue Sep 21 18:53:34 2021 +0900 @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Data; using System.IO; using System.Runtime.InteropServices; @@ -63,15 +64,22 @@ data = msg.data; try { - MessagePackDataGear<object> dg = - new MessagePackDataGear<object>(data, Type.GetType(msg.clazz)); + MessagePackDataGear<dynamic> dg = + new MessagePackDataGear<dynamic>(data, Type.GetType(msg.clazz)); // Debug - // Type t = Type.GetType(msg.clazz); - // object obj = MessagePackSerializer.Deserialize<object>(msg.data); - // RTCommand cmd = (RTCommand) obj; - //Console.WriteLine("***type:" + msg.type + " key:" + msg.key + " fromDgm:" + msg.fromDmgName + " class:" + msg.clazz); - // Console.WriteLine("data :" + cmd.line); + var ty = Type.GetType(msg.clazz); + var obj = MessagePackSerializer.Deserialize<dynamic>(msg.data); + + Console.WriteLine("obj type: "+ obj); + Dictionary<dynamic,dynamic> test = (Dictionary<dynamic, dynamic>) obj; + foreach (var VARIABLE in test) { + Console.WriteLine("key:" + VARIABLE.Key + " val:" + VARIABLE.Value); + } + + //RTCommand cmd = (RTCommand) obj; + Console.WriteLine("***type:" + msg.type + " key:" + msg.key + " fromDgm:" + msg.fromDmgName + " class:" + msg.clazz); + //Console.WriteLine("data :" + cmd.line); cgm.GetLocalDGM().Put(msg.key, dg); } catch (TypeLoadException e) {
--- a/datagear/command/PutCommand.cs Sun Sep 19 18:03:04 2021 +0900 +++ b/datagear/command/PutCommand.cs Tue Sep 21 18:53:34 2021 +0900 @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.IO; using Christie_net.datagear.dg; using Christie_net.Test.Example.RemoteTake; @@ -28,14 +29,17 @@ //var dgData = dg.GetData(); - byte[] data = new MessagePackDataGear<object>(dg.GetData()).GetMessagePack(); + byte[] data = new MessagePackDataGear<dynamic>(dg.GetData()).GetMessagePack(); byte[] command = MessagePackSerializer.Serialize(CreateRemoteMessage(data)); // Debug - //var ms = MessagePackSerializer.Deserialize<RemoteMessage>(command); - //Console.WriteLine("***type:" + ms.type + " key:" + ms.key + " fromDgm:" + ms.fromDmgName + " class:" + ms.clazz +" data: null"); - // RTCommand cmd = (RTCommand) MessagePackSerializer.Deserialize<object>(data); - // Console.WriteLine("data:" + cmd.line); + // var ms = MessagePackSerializer.Deserialize<RemoteMessage>(command); + // Console.WriteLine("**type:" + ms.type + " key:" + ms.key + " fromDgm:" + ms.fromDmgName + " class:" + ms.clazz +" data: null"); + // var cmd = MessagePackSerializer.Deserialize<object>(data); + // Dictionary<dynamic,dynamic> test = (Dictionary<dynamic, dynamic>) cmd; + // foreach (var VARIABLE in test) { + // Console.WriteLine("key:" + VARIABLE.Key + " val:" + VARIABLE.Value); + // } stream.Write(command);
--- a/datagear/dg/MessagePackDataGear.cs Sun Sep 19 18:03:04 2021 +0900 +++ b/datagear/dg/MessagePackDataGear.cs Tue Sep 21 18:53:34 2021 +0900 @@ -42,8 +42,8 @@ if (data == null) try { var dataObj = MessagePackSerializer.Deserialize<T>(messagePack); - ///var dataCast = Convert.ChangeType(dataObj, clazz); - Console.WriteLine("MSP data: " + dataObj); + var dataCast = Convert.ChangeType(dataObj, clazz); + Console.WriteLine("MSP data: " + dataCast); SetData(dataObj); } catch (Exception e) { Console.WriteLine(e.StackTrace);