示例#1
0
        public override void Add(string aKey, WitResponseNode aItem)
        {
            var tmp = new WitResponseClass();

            tmp.Add(aKey, aItem);
            Set(tmp);
        }
示例#2
0
 public override WitResponseNode this[string aKey]
 {
     get { return(new WitResponseLazyCreator(this, aKey)); }
     set
     {
         var tmp = new WitResponseClass();
         tmp.Add(aKey, value);
         Set(tmp);
     }
 }
示例#3
0
        public static WitResponseNode Deserialize(System.IO.BinaryReader aReader)
        {
            JSONBinaryTag type = (JSONBinaryTag)aReader.ReadByte();

            switch (type)
            {
            case JSONBinaryTag.Array:
            {
                int count            = aReader.ReadInt32();
                WitResponseArray tmp = new WitResponseArray();
                for (int i = 0; i < count; i++)
                {
                    tmp.Add(Deserialize(aReader));
                }
                return(tmp);
            }

            case JSONBinaryTag.Class:
            {
                int count            = aReader.ReadInt32();
                WitResponseClass tmp = new WitResponseClass();
                for (int i = 0; i < count; i++)
                {
                    string key = aReader.ReadString();
                    var    val = Deserialize(aReader);
                    tmp.Add(key, val);
                }

                return(tmp);
            }

            case JSONBinaryTag.Value:
            {
                return(new WitResponseData(aReader.ReadString()));
            }

            case JSONBinaryTag.IntValue:
            {
                return(new WitResponseData(aReader.ReadInt32()));
            }

            case JSONBinaryTag.DoubleValue:
            {
                return(new WitResponseData(aReader.ReadDouble()));
            }

            case JSONBinaryTag.BoolValue:
            {
                return(new WitResponseData(aReader.ReadBoolean()));
            }

            case JSONBinaryTag.FloatValue:
            {
                return(new WitResponseData(aReader.ReadSingle()));
            }

            default:
            {
                throw new JSONParseException("Error deserializing JSON. Unknown tag: " + type);
            }
            }
        }