private string detectBCSVersion() { RegistryKey[] keys = { Registry.CurrentUser.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall"), Registry.CurrentUser.OpenSubKey("Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall"), Registry.LocalMachine.OpenSubKey("Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall"), Registry.LocalMachine.OpenSubKey("Software\\Wow6432Node\\Microsoft\\Windows\\CurrentVersion\\Uninstall") }; foreach (RegistryKey key in keys) { if (key != null) { foreach (var subKey in key.GetSubKeyNames()) { RegistryKey appKey = key.OpenSubKey(subKey); if (appKey != null) { foreach (var value in appKey.GetValueNames()) { string keyValue = Convert.ToString(appKey.GetValue("Publisher")); if (!keyValue.Equals("Bridge Systems BV", StringComparison.OrdinalIgnoreCase)) { continue; } string productName = Convert.ToString(appKey.GetValue("DisplayName")); if (!productName.Equals("Bridgemate Control Software", StringComparison.OrdinalIgnoreCase) && !productName.Equals("Bridgemate Pro Control", StringComparison.OrdinalIgnoreCase)) { continue; } string appPath = Convert.ToString(appKey.GetValue("InstallLocation")); if (appPath != null) { Bws.setAppLocation(appPath); } string version = Convert.ToString(appKey.GetValue("DisplayVersion")); return(version); } } } } } return(null); }