Beispiel #1
0
 // Token: 0x060004E8 RID: 1256 RVA: 0x00018FC0 File Offset: 0x000171C0
 private static void AddElement(global::VRGIN.Helpers.JSONNode ctx, string token, string tokenName, bool tokenIsString)
 {
     if (tokenIsString)
     {
         bool flag = ctx is global::VRGIN.Helpers.JSONArray;
         if (flag)
         {
             ctx.Add(token);
         }
         else
         {
             ctx.Add(tokenName, token);
         }
     }
     else
     {
         global::VRGIN.Helpers.JSONData aItem = global::VRGIN.Helpers.JSONNode.Numberize(token);
         bool flag2 = ctx is global::VRGIN.Helpers.JSONArray;
         if (flag2)
         {
             ctx.Add(aItem);
         }
         else
         {
             ctx.Add(tokenName, aItem);
         }
     }
 }
Beispiel #2
0
        // Token: 0x060004E7 RID: 1255 RVA: 0x00018F50 File Offset: 0x00017150
        private static global::VRGIN.Helpers.JSONData Numberize(string token)
        {
            bool   aData  = false;
            int    aData2 = 0;
            double aData3 = 0.0;
            bool   flag   = int.TryParse(token, ref aData2);

            global::VRGIN.Helpers.JSONData result;
            if (flag)
            {
                result = new global::VRGIN.Helpers.JSONData(aData2);
            }
            else
            {
                bool flag2 = double.TryParse(token, ref aData3);
                if (flag2)
                {
                    result = new global::VRGIN.Helpers.JSONData(aData3);
                }
                else
                {
                    bool flag3 = bool.TryParse(token, ref aData);
                    if (!flag3)
                    {
                        throw new global::System.NotImplementedException(token);
                    }
                    result = new global::VRGIN.Helpers.JSONData(aData);
                }
            }
            return(result);
        }
Beispiel #3
0
        // Token: 0x060004F1 RID: 1265 RVA: 0x00019588 File Offset: 0x00017788
        public static global::VRGIN.Helpers.JSONNode Deserialize(global::System.IO.BinaryReader aReader)
        {
            global::VRGIN.Helpers.JSONBinaryTag jsonbinaryTag = (global::VRGIN.Helpers.JSONBinaryTag)aReader.ReadByte();
            global::VRGIN.Helpers.JSONNode      result;
            switch (jsonbinaryTag)
            {
            case global::VRGIN.Helpers.JSONBinaryTag.Array:
            {
                int num = aReader.ReadInt32();
                global::VRGIN.Helpers.JSONArray jsonarray = new global::VRGIN.Helpers.JSONArray();
                for (int i = 0; i < num; i++)
                {
                    jsonarray.Add(global::VRGIN.Helpers.JSONNode.Deserialize(aReader));
                }
                result = jsonarray;
                break;
            }

            case global::VRGIN.Helpers.JSONBinaryTag.Class:
            {
                int num2 = aReader.ReadInt32();
                global::VRGIN.Helpers.JSONClass jsonclass = new global::VRGIN.Helpers.JSONClass();
                for (int j = 0; j < num2; j++)
                {
                    string aKey = aReader.ReadString();
                    global::VRGIN.Helpers.JSONNode aItem = global::VRGIN.Helpers.JSONNode.Deserialize(aReader);
                    jsonclass.Add(aKey, aItem);
                }
                result = jsonclass;
                break;
            }

            case global::VRGIN.Helpers.JSONBinaryTag.Value:
                result = new global::VRGIN.Helpers.JSONData(aReader.ReadString());
                break;

            case global::VRGIN.Helpers.JSONBinaryTag.IntValue:
                result = new global::VRGIN.Helpers.JSONData(aReader.ReadInt32());
                break;

            case global::VRGIN.Helpers.JSONBinaryTag.DoubleValue:
                result = new global::VRGIN.Helpers.JSONData(aReader.ReadDouble());
                break;

            case global::VRGIN.Helpers.JSONBinaryTag.BoolValue:
                result = new global::VRGIN.Helpers.JSONData(aReader.ReadBoolean());
                break;

            case global::VRGIN.Helpers.JSONBinaryTag.FloatValue:
                result = new global::VRGIN.Helpers.JSONData(aReader.ReadSingle());
                break;

            default:
                throw new global::System.Exception("Error deserializing JSON. Unknown tag: " + jsonbinaryTag.ToString());
            }
            return(result);
        }
Beispiel #4
0
        // Token: 0x06000522 RID: 1314 RVA: 0x0001A2A8 File Offset: 0x000184A8
        public override void Serialize(global::System.IO.BinaryWriter aWriter)
        {
            global::VRGIN.Helpers.JSONData jsondata = new global::VRGIN.Helpers.JSONData("");
            jsondata.AsInt = this.AsInt;
            bool flag = jsondata.m_Data == this.m_Data;

            if (flag)
            {
                aWriter.Write(4);
                aWriter.Write(this.AsInt);
            }
            else
            {
                jsondata.AsFloat = this.AsFloat;
                bool flag2 = jsondata.m_Data == this.m_Data;
                if (flag2)
                {
                    aWriter.Write(7);
                    aWriter.Write(this.AsFloat);
                }
                else
                {
                    jsondata.AsDouble = this.AsDouble;
                    bool flag3 = jsondata.m_Data == this.m_Data;
                    if (flag3)
                    {
                        aWriter.Write(5);
                        aWriter.Write(this.AsDouble);
                    }
                    else
                    {
                        jsondata.AsBool = this.AsBool;
                        bool flag4 = jsondata.m_Data == this.m_Data;
                        if (flag4)
                        {
                            aWriter.Write(6);
                            aWriter.Write(this.AsBool);
                        }
                        else
                        {
                            aWriter.Write(3);
                            aWriter.Write(this.m_Data);
                        }
                    }
                }
            }
        }