Beispiel #1
0
        public static MixCastData ReadData()
        {
            RegistryKey reg = Registry.CurrentUser.CreateSubKey(MixCastPath.REGISTRY_PATH);

            Assert.IsNotNull(reg);
            string dataStr = reg.GetValue(SETTINGS_REGISTRY_KEY, null) as string;

#if UNITY_EDITOR
            string myDocsPath       = System.Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
            string settingsFilePath = myDocsPath + "\\MixCastSettings.json";

            if (File.Exists(settingsFilePath))
            {
                dataStr = File.ReadAllText(settingsFilePath);
            }
#endif

            MixCastData data = string.IsNullOrEmpty(dataStr) ? new MixCastData() : JsonUtility.FromJson <MixCastData>(dataStr);

            if (!string.IsNullOrEmpty(data.sourceVersion) && data.sourceVersion != MixCast.VERSION_STRING)
            {
                shouldShowRegistryMismatchWarning = true;
                Debug.LogWarning(string.Format("settings version mis-match detected: {0} instead of {1}", data.sourceVersion, MixCast.VERSION_STRING));
                MixCastDataUtility.UpdateForBackwardCompatibility(data, dataStr);
            }

            return(data);
        }
        void ApplyName(MixCastData.CameraCalibrationData data)
        {
            if (data != null)
            {
                text.text = MixCastDataUtility.CalculateCameraName(data);

                lastCustomName = data.displayName;
                lastCamDevice  = data.deviceName;
            }
            else
            {
                text.text = "";

                lastCustomName = null;
                lastCamDevice  = null;
            }
        }
        public static MixCastData ReadData()
        {
            RegistryKey reg     = Registry.CurrentUser.CreateSubKey(REGISTRY_NAME);
            string      dataStr = reg.GetValue(REGISTRY_KEY, null) as string;

            if (!string.IsNullOrEmpty(dataStr))
            {
                MixCastData data = JsonUtility.FromJson <MixCastData>(dataStr);
                if (data.sourceVersion != MixCast.VERSION_STRING)
                {
                    MixCastDataUtility.UpdateForBackwardCompatibility(data, dataStr);
                }
                return(data);
            }
            else
            {
                return(new MixCastData());
            }
        }