private static string GetRegistryValue(RegistryKey root, string subkey, string key)
{
string value = null;
try
{
RegistryKey registryKey = root.OpenSubKey(subkey, false);
if (registryKey != null)
{
using (registryKey)
{
value = registryKey.GetValue(key) as string;
}
}
}
catch (UnauthorizedAccessException)
{
MessageBox.Show("GitExtensions has insufficient permisions to check the registry.");
}
return value ?? string.Empty;
}