internal RegistryKey GetRegistryKey(
string subKey,
bool writeable)
{
RegistryKey softwareKey = Registry.CurrentUser.OpenSubKey("Software");
RegistryKey scorchioKey = softwareKey?.OpenSubKey("Scorchio Limited");
//// need to create the registry key if not there!
if (scorchioKey == null)
{
softwareKey = Registry.CurrentUser.OpenSubKey("Software", true);
if (softwareKey != null)
{
scorchioKey = softwareKey.CreateSubKey("Scorchio Limited");
}
}
if (scorchioKey != null)
{
//// will need to create registry key if not there!
RegistryKey ninjaKey = scorchioKey.OpenSubKey("Ninja Coder for MvvmCross", writeable) ??
scorchioKey.CreateSubKey("Ninja Coder for MvvmCross");
if (ninjaKey != null)
{
if (string.IsNullOrEmpty(subKey) == false)
{
RegistryKey registryKey = ninjaKey.OpenSubKey(subKey, writeable);
return registryKey ?? ninjaKey.CreateSubKey(subKey);
}
}
return ninjaKey;
}
return null;
}