Beispiel #1
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 #2
0
 // Token: 0x0600062F RID: 1583 RVA: 0x0001DA94 File Offset: 0x0001BC94
 public static global::VRGIN.Helpers.JSONClass AnalyzeComponent(global::UnityEngine.Component c)
 {
     global::VRGIN.Helpers.JSONClass jsonclass = new global::VRGIN.Helpers.JSONClass();
     foreach (global::System.Reflection.FieldInfo fieldInfo in c.GetType().GetFields(20))
     {
         try
         {
             string text = global::EscalationVR.UnityHelper.FieldToString(fieldInfo.Name, fieldInfo.GetValue(c));
             bool   flag = text != null;
             if (flag)
             {
                 jsonclass[fieldInfo.Name] = text;
             }
         }
         catch (global::System.Exception ex)
         {
             global::UnityEngine.Debug.LogWarningFormat("Failed to get field {0}", new object[]
             {
                 fieldInfo.Name
             });
         }
     }
     foreach (global::System.Reflection.PropertyInfo propertyInfo in c.GetType().GetProperties(20))
     {
         try
         {
             bool flag2 = propertyInfo.GetIndexParameters().Length == 0;
             if (flag2)
             {
                 string text2 = global::EscalationVR.UnityHelper.FieldToString(propertyInfo.Name, propertyInfo.GetValue(c, null));
                 bool   flag3 = text2 != null;
                 if (flag3)
                 {
                     jsonclass[propertyInfo.Name] = text2;
                 }
             }
         }
         catch (global::System.Exception ex2)
         {
             global::UnityEngine.Debug.LogWarningFormat("Failed to get prop {0}", new object[]
             {
                 propertyInfo.Name
             });
         }
     }
     return(jsonclass);
 }
Beispiel #3
0
 // Token: 0x06000631 RID: 1585 RVA: 0x0001DCE4 File Offset: 0x0001BEE4
 public static global::VRGIN.Helpers.JSONClass AnalyzeNode(global::UnityEngine.GameObject go, bool onlyActive = false)
 {
     global::VRGIN.Helpers.JSONClass jsonclass = new global::VRGIN.Helpers.JSONClass();
     jsonclass["name"]   = go.name;
     jsonclass["active"] = go.activeSelf.ToString();
     jsonclass["tag"]    = go.tag;
     jsonclass["layer"]  = global::UnityEngine.LayerMask.LayerToName(go.gameObject.layer);
     jsonclass["pos"]    = go.transform.localPosition.ToString();
     jsonclass["rot"]    = go.transform.localEulerAngles.ToString();
     jsonclass["scale"]  = go.transform.localScale.ToString();
     global::VRGIN.Helpers.JSONClass jsonclass2 = new global::VRGIN.Helpers.JSONClass();
     foreach (global::UnityEngine.Component component in go.GetComponents <global::UnityEngine.Component>())
     {
         bool flag = component == null;
         if (flag)
         {
             string text = "NULL component: ";
             global::UnityEngine.Component component2 = component;
             global::UnityEngine.Debug.LogWarningFormat(text + ((component2 != null) ? component2.ToString() : null), global::System.Array.Empty <object>());
         }
         else
         {
             jsonclass2[component.GetType().Name] = global::EscalationVR.UnityHelper.AnalyzeComponent(component);
         }
     }
     global::VRGIN.Helpers.JSONArray jsonarray = new global::VRGIN.Helpers.JSONArray();
     foreach (global::UnityEngine.GameObject gameObject in go.Children())
     {
         bool flag2 = !onlyActive || gameObject.activeInHierarchy;
         if (flag2)
         {
             jsonarray.Add(global::EscalationVR.UnityHelper.AnalyzeNode(gameObject, onlyActive));
         }
     }
     jsonclass["Components"] = jsonclass2;
     jsonclass["Children"]   = jsonarray;
     return(jsonclass);
 }