public void Load() { RegEdit options = new RegEdit(RegistryUtil.GetHKLMKey(@"SOFTWARE\Perspective Software\Blue Iris\Options")); HardwareAcceleration = (HWAccel)options.DWord("hwaccel"); ServiceMode = options.DWord("service") == 1; if (options.DWord("limitlive") == 0) { LivePreviewFPS = -2; } else { LivePreviewFPS = RegistryUtil.GetHKLMValue <int>(@"SOFTWARE\Perspective Software\Blue Iris\Options", "livefps", -1); // Custom failure value of -1 } }
private static bool ReadModState() { RegistryKey Performance = RegistryUtil.GetHKLMKey(@"SYSTEM\CurrentControlSet\Services\PerfProc\Performance"); if (Performance == null) { return(false); } if (!Performance.GetValueNames().Contains("ProcessNameFormat") || Performance.GetValueKind("ProcessNameFormat") != RegistryValueKind.DWord) { return(false); } int ProcessNameFormat = (int)Performance.GetValue("ProcessNameFormat"); return(ProcessNameFormat == 2); }
private static void AutoFixBad32BitSetting() { if (Environment.Is64BitOperatingSystem) { // This is a 64 bit OS, so it is possible that our bi32OnWin64 setting is wrong. if (RegistryUtil.GetHKLMKey(@"SOFTWARE\Perspective Software\Blue Iris") == null) { // No BI detected. Try the opposite setting. RegistryUtil.Force32BitRegistryAccess = !RegistryUtil.Force32BitRegistryAccess; if (RegistryUtil.GetHKLMKey(@"SOFTWARE\Perspective Software\Blue Iris") == null) { RegistryUtil.Force32BitRegistryAccess = !RegistryUtil.Force32BitRegistryAccess; // No BI detected. Revert setting. } else { // Found BI using the opposite setting. Save the setting. settings.bi32OnWin64 = RegistryUtil.Force32BitRegistryAccess; settings.Save(); } } } }
public void Load() { int version = RegistryUtil.GetHKLMValue <int>(@"SOFTWARE\Perspective Software\Blue Iris", "version", 0); ByteUtil.WriteInt32(version, BiVersionBytes, 0); BiVersionFromRegistry = string.Join(".", BiVersionBytes); OS = GetOsVersion(); AdvisorVersion = System.Reflection.Assembly.GetExecutingAssembly().GetName().Version.ToString(); RegistryKey camerasKey = RegistryUtil.GetHKLMKey(@"SOFTWARE\Perspective Software\Blue Iris\Cameras"); if (camerasKey != null) { global = new BIGlobalConfig(); global.Load(); SortedList <string, Camera> camerasByShortname = new SortedList <string, Camera>(); foreach (string camName in camerasKey.GetSubKeyNames()) { Camera cam = new Camera(camName, camerasKey.OpenSubKey(camName)); if (cam.shortname == null) { throw new Exception("Camera \"" + camName + "\" has null shortname field."); } cameras.Add(camName, cam); // Make a copy of [cam] to put into the second SortedList, because later we are going to be modifying Camera objects in the first SortedList. camerasByShortname.Add(cam.shortname, JsonConvert.DeserializeObject <Camera>(JsonConvert.SerializeObject(cam))); } { // Implement "sync" functionality where some cameras and some profiles can point at other cameras and/or profiles. // Blue Iris totally allows circular references when syncing between cameras, with undefined and unexplored behavior, so we'll only be implementing one iteration of syncing. // First sync the recordSettings foreach (Camera cam in cameras.Values) { Camera syncFrom = cam; if (cam.recordSettings[1].sync) { // Profile 1 says to sync. This means every profile with the sync flag set will be synced from a different camera. if (cam.recordSettings[1].camsync != null) { if (camerasByShortname.TryGetValue(cam.recordSettings[1].camsync, out Camera tmp)) { syncFrom = tmp; } } } for (int i = 1; i <= 7; i++) { if (cam.recordSettings[i].sync) { cam.recordSettings[i] = syncFrom.recordSettings[i]; } } } // Then sync the triggerSettings foreach (Camera cam in cameras.Values) { Camera syncFrom = cam; if (cam.triggerSettings[1].sync) { // Profile 1 says to sync. This means every profile with the sync flag set will be synced from a different camera. if (cam.triggerSettings[1].camsync != null) { if (camerasByShortname.TryGetValue(cam.triggerSettings[1].camsync, out Camera tmp)) { syncFrom = tmp; } } } for (int i = 1; i <= 7; i++) { if (cam.triggerSettings[i].sync) { cam.triggerSettings[i] = syncFrom.triggerSettings[i]; } } } } cpu = CpuInfo.GetCpuInfo(); gpus = GpuInfo.GetGpuInfo(); mem = RamInfo.GetRamInfo(); activeStats = new BIActiveStats(); activeStats.Load(); } }