Exemple #1
0
        // Token: 0x06000034 RID: 52 RVA: 0x00002ADC File Offset: 0x00000EDC
        public static JSONNode LoadFromStream(Stream aData)
        {
            JSONNode result;

            using (BinaryReader binaryReader = new BinaryReader(aData))
            {
                result = JSONNode.Deserialize(binaryReader);
            }
            return(result);
        }
Exemple #2
0
        // Token: 0x06000030 RID: 48 RVA: 0x000029B8 File Offset: 0x00000DB8
        public static JSONNode Deserialize(BinaryReader aReader)
        {
            JSONBinaryTag jsonbinaryTag = (JSONBinaryTag)aReader.ReadByte();

            switch (jsonbinaryTag)
            {
            case JSONBinaryTag.Array:
            {
                int       num       = aReader.ReadInt32();
                JSONArray jsonarray = new JSONArray();
                for (int i = 0; i < num; i++)
                {
                    jsonarray.Add(JSONNode.Deserialize(aReader));
                }
                return(jsonarray);
            }

            case JSONBinaryTag.Class:
            {
                int       num2      = aReader.ReadInt32();
                JSONClass jsonclass = new JSONClass();
                for (int 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);
            }
        }