// Token: 0x06000284 RID: 644 RVA: 0x0000B59C File Offset: 0x0000979C public static JSONNode LoadFromStream(Stream aData) { JSONNode result; using (BinaryReader binaryReader = new BinaryReader(aData)) { result = JSONNode.Deserialize(binaryReader); } return(result); }
public static JSONNode LoadFromStream(Stream aData) { JSONNode jSONNode; using (BinaryReader binaryReader = new BinaryReader(aData)) { jSONNode = JSONNode.Deserialize(binaryReader); } return(jSONNode); }
public static JSONNode Deserialize(BinaryReader aReader) { JSONBinaryTag jSONBinaryTag = (JSONBinaryTag)aReader.ReadByte(); switch (jSONBinaryTag) { case JSONBinaryTag.Array: { int num = aReader.ReadInt32(); JSONArray jSONArrays = new JSONArray(); for (int i = 0; i < num; i++) { jSONArrays.Add(JSONNode.Deserialize(aReader)); } return(jSONArrays); } case JSONBinaryTag.Class: { int num1 = aReader.ReadInt32(); JSONClass jSONClasses = new JSONClass(); for (int j = 0; j < num1; j++) { jSONClasses.Add(aReader.ReadString(), JSONNode.Deserialize(aReader)); } return(jSONClasses); } case JSONBinaryTag.Value: { return(new JSONData(aReader.ReadString())); } case JSONBinaryTag.IntValue: { return(new JSONData(aReader.ReadInt32())); } case JSONBinaryTag.DoubleValue: { return(new JSONData(aReader.ReadDouble())); } case JSONBinaryTag.BoolValue: { return(new JSONData(aReader.ReadBoolean())); } case JSONBinaryTag.FloatValue: { return(new JSONData(aReader.ReadSingle())); } } throw new Exception(string.Concat("Error deserializing JSON. Unknown tag: ", jSONBinaryTag)); }
public static JSONNode Deserialize(BinaryReader aReader) { JSONBinaryTag jsonbinaryTag = (JSONBinaryTag)aReader.ReadByte(); switch (jsonbinaryTag) { case JSONBinaryTag.Array: { Int32 num = aReader.ReadInt32(); JSONArray jsonarray = new JSONArray(); for (Int32 i = 0; i < num; i++) { jsonarray.Add(JSONNode.Deserialize(aReader)); } return(jsonarray); } case JSONBinaryTag.Class: { Int32 num2 = aReader.ReadInt32(); JSONClass jsonclass = new JSONClass(); for (Int32 j = 0; j < num2; j++) { String aKey = aReader.ReadString(); JSONNode aItem = JSONNode.Deserialize(aReader); jsonclass.Add(aKey, aItem); } return(jsonclass); } case JSONBinaryTag.Value: return(new JSONData(aReader.ReadString())); case JSONBinaryTag.IntValue: return(new JSONData(aReader.ReadInt32())); case JSONBinaryTag.DoubleValue: return(new JSONData(aReader.ReadDouble())); case JSONBinaryTag.BoolValue: return(new JSONData(aReader.ReadBoolean())); case JSONBinaryTag.FloatValue: return(new JSONData(aReader.ReadSingle())); default: throw new Exception("Error deserializing JSON. Unknown tag: " + jsonbinaryTag); } }
// Token: 0x06000280 RID: 640 RVA: 0x0000B4BC File Offset: 0x000096BC public static JSONNode Deserialize(BinaryReader aReader) { JSONNodeType jsonnodeType = (JSONNodeType)aReader.ReadByte(); switch (jsonnodeType) { case JSONNodeType.Array: { int num = aReader.ReadInt32(); JSONArray jsonarray = new JSONArray(); for (int i = 0; i < num; i++) { jsonarray.Add(JSONNode.Deserialize(aReader)); } return(jsonarray); } case JSONNodeType.Object: { int num2 = aReader.ReadInt32(); JSONObject jsonobject = new JSONObject(); for (int j = 0; j < num2; j++) { string aKey = aReader.ReadString(); JSONNode aItem = JSONNode.Deserialize(aReader); jsonobject.Add(aKey, aItem); } return(jsonobject); } case JSONNodeType.String: return(new JSONString(aReader.ReadString())); case JSONNodeType.Number: return(new JSONNumber(aReader.ReadDouble())); case JSONNodeType.NullValue: return(new JSONNull()); case JSONNodeType.Boolean: return(new JSONBool(aReader.ReadBoolean())); default: throw new Exception("Error deserializing JSON. Unknown tag: " + jsonnodeType); } }