From c901a307305d3ce7cb0adabe646bd58d0d797a48 Mon Sep 17 00:00:00 2001 From: Rayo Date: Tue, 17 Mar 2015 10:07:58 +0800 Subject: [PATCH] fix the bug, change 'List' to JsonArray if use List, you will use this way to get the data var jWeapons = json["weapons"] as List; but now you cant use: var jWeapons = json["weapons"] as JsonArray; that the right way to get array in json. --- pomelo-dotnetClient/src/protobuf/MsgDecoder.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/pomelo-dotnetClient/src/protobuf/MsgDecoder.cs b/pomelo-dotnetClient/src/protobuf/MsgDecoder.cs index 18a7b47..2d378b6 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; } @@ -114,7 +114,7 @@ private JsonObject decodeMsg(JsonObject msg, JsonObject proto, int length) /// /// Decode array in message. /// - private void decodeArray(List list, string type, JsonObject proto) + private void decodeArray(JsonArray list, string type, JsonObject proto) { if (this.util.isSimpleType(type)) { @@ -245,4 +245,4 @@ private byte[] getBytes() return bytes; } } -} \ No newline at end of file +}