private object GetSettingFromRegistry(string name)
{
using (RegistryKey key = Registry.LocalMachine.OpenSubKey(m_rootKey, RegistryKeyPermissionCheck.ReadWriteSubTree, System.Security.AccessControl.RegistryRights.FullControl))
{
if (key != null)
{
// Make sure key exists before requesting it
foreach (string valueName in key.GetValueNames())
{
if (String.Compare(valueName, name, true) == 0)
{
return key.GetValue(name);
}
}
throw new KeyNotFoundException(string.Format("Unable to find value for: {0}", name));
}
else
{
throw new KeyNotFoundException(string.Format("Unable to open registry key"));
}
}
}