diff --git a/pomelo-dotnetClient/src/protobuf/MsgDecoder.cs b/pomelo-dotnetClient/src/protobuf/MsgDecoder.cs index 18a7b47..8d4e93f 100755 --- a/pomelo-dotnetClient/src/protobuf/MsgDecoder.cs +++ b/pomelo-dotnetClient/src/protobuf/MsgDecoder.cs @@ -93,12 +93,12 @@ private JsonObject decodeMsg(JsonObject msg, JsonObject proto, int length) object _name; if (!msg.TryGetValue(name.ToString(), out _name)) { - msg.Add(name.ToString(), new List()); + msg.Add(name.ToString(), new JsonArray()); } object value_type; if (msg.TryGetValue(name.ToString(), out _name) && ((JsonObject)(value)).TryGetValue("type", out value_type)) { - decodeArray((List)_name, value_type.ToString(), proto); + decodeArray((JsonArray)_name, value_type.ToString(), proto); } break; } @@ -148,6 +148,8 @@ private object decodeProp(string type, JsonObject proto) return this.decodeDouble(); case "string": return this.decodeString(); + case "object": + return SimpleJson.SimpleJson.DeserializeObject(this.decodeString()); default: return this.decodeObject(type, proto); } diff --git a/pomelo-dotnetClient/src/protobuf/MsgEncoder.cs b/pomelo-dotnetClient/src/protobuf/MsgEncoder.cs index 4bba9df..83cbe40 100755 --- a/pomelo-dotnetClient/src/protobuf/MsgEncoder.cs +++ b/pomelo-dotnetClient/src/protobuf/MsgEncoder.cs @@ -146,9 +146,9 @@ private int encodeMsg(byte[] buffer, int offset, JsonObject proto, JsonObject ms object msg_key; if (msg.TryGetValue(key, out msg_key)) { - if (((List)msg_key).Count > 0) + if (((JsonArray)msg_key).Count > 0) { - offset = encodeArray((List)msg_key, (JsonObject)value, offset, buffer, proto); + offset = encodeArray((JsonArray)msg_key, (JsonObject)value, offset, buffer, proto); } } break; @@ -163,7 +163,7 @@ private int encodeMsg(byte[] buffer, int offset, JsonObject proto, JsonObject ms /// /// Encode the array type. /// - private int encodeArray(List msg, JsonObject value, int offset, byte[] buffer, JsonObject proto) + private int encodeArray(JsonArray msg, JsonObject value, int offset, byte[] buffer, JsonObject proto) { object value_type, value_tag; if (value.TryGetValue("type", out value_type) && value.TryGetValue("tag", out value_tag)) @@ -209,6 +209,7 @@ private int encodeProp(object value, string type, int offset, byte[] buffer, Jso case "double": this.writeDouble(buffer, ref offset, value); break; + case "object": case "string": this.writeString(buffer, ref offset, value); break;