private object decodeProp(string type, int len) { switch (type) { case "uint32": return(Decoder.decodeUInt32(getBytes())); case "int32": case "sint32": return(Decoder.decodeSInt32(getBytes())); case "uint64": return(Decoder.decodeUInt64(getBytes())); case "int64": case "sint64": return(Decoder.decodeSInt64(getBytes())); case "float": return(decodeFloat()); case "double": return(decodeDouble()); case "string": return(decodeString()); case "bool": return(decodeBool()); default: return(decodeObject(type, protos, len)); } }
/// <summary> /// Decode each simple type in message. /// </summary> private JsonNode decodeProp(string type, JsonNode proto) { switch (type) { case "uInt32": // TODO: DZÔڵĴíÎó return(new JsonData((int)Decoder.decodeUInt32(this.getBytes()))); case "int32": case "sInt32": return(new JsonData(Decoder.decodeSInt32(this.getBytes()))); case "float": return(new JsonData(this.decodeFloat())); case "double": return(new JsonData(this.decodeDouble())); case "string": return(new JsonData(this.decodeString())); default: return(this.decodeObject(type, proto)); } }
/// <summary> /// Decode array in message. /// </summary> //private void decodeArray(List<object> list, string type, JsonData proto){ // if (this.util.isSimpleType(type)) { // int length = (int)Decoder.decodeUInt32(this.getBytes()); // for(int i = 0; i < length; i++) { // list.Add(this.decodeProp(type, null)); // } // } else { // list.Add(this.decodeProp(type, proto)); // } // } /// <summary> /// Decode each simple type in message. /// </summary> private object decodeProp(string type, JsonData proto) { switch (type) { case "uInt32": return(Decoder.decodeUInt32(this.getBytes())); case "int32": case "sInt32": return(Decoder.decodeSInt32(this.getBytes())); case "float": //object xx = this.decodeFloat(); //return System.Convert.ToDouble(xx); return(this.decodeFloat()); case "double": return(this.decodeDouble()); case "string": return(this.decodeString()); default: return(this.decodeObject(type, proto)); } }
private int decodeSInt32() { int length; int ret = Decoder.decodeSInt32(this.offset, this.buffer, out length); this.offset += length; return(ret); }
/// <summary> /// Decode each simple type in message. /// </summary> private object decodeProp(string type, JSONNode proto) { switch (type) { case "uInt32": return(Decoder.decodeUInt32(this.getBytes())); case "int32": case "sInt32": return(Decoder.decodeSInt32(this.getBytes())); case "float": return(this.decodeFloat()); case "double": return(this.decodeDouble()); case "string": return(this.decodeString()); default: return(this.decodeObject(type, proto)); } }