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); }
public static void WriteData(MixCastData data) { string dataStr = JsonUtility.ToJson(data); RegistryKey reg = Registry.CurrentUser.CreateSubKey(REGISTRY_NAME); reg.SetValue(REGISTRY_KEY, dataStr); }
public static void WriteData(MixCastData data) { string dataStr = JsonUtility.ToJson(data); RegistryKey reg = Registry.CurrentUser.CreateSubKey(MixCastPath.REGISTRY_PATH); reg.SetValue(MixCastRegistry.SETTINGS_REGISTRY_KEY, dataStr); }
/// <summary> /// Fills in camera device fields that were added in new versions of MixCast. /// </summary> static void AddMissingCameraInfo(MixCastData data) { foreach (var camera in data.cameras) { var device = FeedDeviceManager.FindDeviceFromName(camera.deviceName); if (device == null) { continue; } AddDeviceInfo(camera, device); } }
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()); } }
public static void UpdateForBackwardCompatibility(MixCastData data, string dataStr) { AddMissingCameraInfo(data); }
static MixCast() { Settings = MixCastRegistry.ReadData(); }
public static void UpdateForBackwardCompatibility(MixCastData data, string dataStr) { //Dictionary<string, object> dataTable = BlueprintReality.MiniJSON.Json.Deserialize(dataStr) as Dictionary<string, object>; }