static void MergeRecur(KJSON left, KJSON right) { if(right.type == KJSON.Type.OBJECT) { for(int i = 0; i < right.list.Count; i++) { if(right.keys[i] != null) { string key = (string)right.keys[i]; KJSON val = (KJSON)right.list[i]; if(val.type == KJSON.Type.ARRAY || val.type == KJSON.Type.OBJECT) { if(left.HasField(key)) MergeRecur(left[key], val); else left.AddField(key, val); } else { if(left.HasField(key)) left.SetField(key, val); else left.AddField(key, val); } } } }// else left.list.Add(right.list); }
private static KJSON getExtra() { KJSON extra = new KJSON(KJSON.Type.OBJECT); try { KJSON system = new KJSON(KJSON.Type.OBJECT); system.AddField("Device Model",SystemInfo.deviceModel); system.AddField("Device Name",SystemInfo.deviceName); system.AddField("Device Type",SystemInfo.deviceType.ToString()); system.AddField("Device Unique Identifier",SystemInfo.deviceUniqueIdentifier); system.AddField("Graphics Device ID",SystemInfo.graphicsDeviceID); system.AddField("Graphics Device Name",SystemInfo.graphicsDeviceName); system.AddField("Graphics Device Vendor",SystemInfo.graphicsDeviceVendor); system.AddField("Graphics Device Vendor ID",SystemInfo.graphicsDeviceVendorID); system.AddField("Graphics Device Version",SystemInfo.graphicsDeviceVersion); system.AddField("Graphics Memory Size",SystemInfo.graphicsMemorySize); system.AddField("Graphics Pixel Fill-rate",SystemInfo.graphicsPixelFillrate); system.AddField("Graphics Shader Level",SystemInfo.graphicsShaderLevel); system.AddField("Operating System",SystemInfo.operatingSystem); system.AddField("Processor Count",SystemInfo.processorCount); system.AddField("Processor Type",SystemInfo.processorType); system.AddField("Render Target Count",SystemInfo.supportedRenderTargetCount); system.AddField("Supports Accelerometer",SystemInfo.supportsAccelerometer); system.AddField("Supports Gyroscope",SystemInfo.supportsGyroscope); system.AddField("Supports Image Effects",SystemInfo.supportsImageEffects); system.AddField("Supports Location Service",SystemInfo.supportsLocationService); system.AddField("Supports Render Textures",SystemInfo.supportsRenderTextures); system.AddField("Supports Shadows",SystemInfo.supportsShadows); system.AddField("Supports Vertex Programs",SystemInfo.supportsVertexPrograms); system.AddField("Supports Vibration",SystemInfo.supportsVibration); system.AddField("System Memory Size",SystemInfo.systemMemorySize); if(Application.platform == RuntimePlatform.IPhonePlayer) { // TODO: system.AddField("iOS Generation",iPhone.generation.ToString()); } extra.AddField("System",system); KJSON application = new KJSON(KJSON.Type.OBJECT); application.AddField("Is Editor",Application.isEditor); application.AddField("Is Playing",Application.isPlaying); application.AddField("Is Web Player",Application.isWebPlayer); application.AddField("Platform",Application.platform.ToString()); application.AddField("Data Path",Application.dataPath); application.AddField("Streaming Assets Path",Application.streamingAssetsPath); application.AddField("Persistent Data Path",Application.persistentDataPath); application.AddField("Temporary Cache Path",Application.temporaryCachePath); application.AddField("Unity Verstion",Application.unityVersion); application.AddField("Target Frame Rate",Application.targetFrameRate); application.AddField("System Language",Application.systemLanguage.ToString()); application.AddField("Internet Reachability",Application.internetReachability.ToString()); //application.AddField("Is Genuine Check Available",Application.genuineCheckAvailable); //if(Application.genuineCheckAvailable) application.AddField("Is Genuine Application",Application.genuine); extra.AddField("Application",application); KJSON debug = new KJSON(KJSON.Type.OBJECT); debug.AddField("Is Debug Build",Debug.isDebugBuild); extra.AddField("Debug",debug); KJSON input = new KJSON(KJSON.Type.OBJECT); input.AddField("Device Orientation",Input.deviceOrientation.ToString()); input.AddField("Supports Multi Touch",Input.multiTouchEnabled); if(SystemInfo.supportsAccelerometer) input.AddField("Acceleration",Input.acceleration.ToString()); extra.AddField("Input",input); if(Input.compass.enabled) { KJSON compass = new KJSON(KJSON.Type.OBJECT); compass.AddField("Enabled",Input.compass.enabled); if(Input.compass.enabled) { compass.AddField("Geographic Heading",Input.compass.trueHeading); if(SystemInfo.supportsLocationService && Input.location.status == LocationServiceStatus.Running) compass.AddField("Magnetic Heading",Input.compass.magneticHeading); compass.AddField("Raw Vector",Input.compass.rawVector.ToString()); } input.AddField("Compass",compass); } if(SystemInfo.supportsGyroscope) { KJSON gyroscope = new KJSON(KJSON.Type.OBJECT); gyroscope.AddField("Enabled",Input.gyro.enabled); if(Input.gyro.enabled) { gyroscope.AddField("Attitude",Input.gyro.attitude.ToString()); gyroscope.AddField("Gravity",Input.gyro.gravity.ToString()); gyroscope.AddField("Rotation Rate",Input.gyro.rotationRate.ToString()); gyroscope.AddField("Unbiased Rotation Rate",Input.gyro.rotationRateUnbiased.ToString()); gyroscope.AddField("Update Interval",Input.gyro.updateInterval); gyroscope.AddField("User Acceleration",Input.gyro.userAcceleration.ToString()); } input.AddField("Gyroscope",gyroscope); } if(SystemInfo.supportsLocationService) { KJSON location = new KJSON(KJSON.Type.OBJECT); location.AddField("Status",Input.location.status.ToString()); if(Input.location.status == LocationServiceStatus.Running) { LocationInfo l = Input.location.lastData; location.AddField("Latitude",l.latitude); location.AddField("Longitude",l.longitude); location.AddField("Altitude",l.altitude); location.AddField("Horizontal Accuracy",l.horizontalAccuracy); location.AddField("Vertical Accuracy",l.verticalAccuracy); } input.AddField("Location",location); } KJSON screen = new KJSON(KJSON.Type.OBJECT); screen.AddField("Autorotate to Landscape Left",Screen.autorotateToLandscapeLeft); screen.AddField("Autorotate to Landscape Right",Screen.autorotateToLandscapeRight); screen.AddField("Autorotate to Portrait",Screen.autorotateToPortrait); screen.AddField("Autorotate to Portrait Upside Down",Screen.autorotateToPortraitUpsideDown); screen.AddField("Current Orientation",Screen.orientation.ToString()); screen.AddField("Current Resolution",Screen.currentResolution.width + "x" + Screen.currentResolution.height + "@" + Screen.currentResolution.refreshRate + "Hz"); screen.AddField("DPI",Screen.dpi); screen.AddField("Is Fullscreen",Screen.fullScreen); screen.AddField("Sleep Timeout",Screen.sleepTimeout); extra.AddField("Screen",screen); } finally{} return extra; }