/// <summary> /// Check the correct path on the Registry. /// </summary> /// <param name="strGameMode">The selected game mode.</param> /// <param name="strMods">The selected Mods path.</param> /// <param name="strInstallInfo">The selected Install Info path.</param> public void SaveRegistry(string p_strGameMode, string p_strMods, string p_strInstallInfo, string p_strVirtual, string p_strHDLink, bool p_booMultiHDInstall) { try { var strGameKey = RegistryLocation + p_strGameMode; RegistryKey rkKey = null; if (RegistryUtil.CanReadKey(RegistryLocation) && RegistryUtil.CanWriteKey(RegistryLocation)) { //This will create the key if it doesn't exist, if it does exist it opens it rkKey = Registry.LocalMachine.CreateSubKey(RegistryLocation); } if (rkKey == null) { return; } if (RegistryUtil.CanCreateKey(strGameKey)) { Registry.LocalMachine.CreateSubKey(strGameKey); } if (!RegistryUtil.CanReadKey(strGameKey) || !RegistryUtil.CanWriteKey(strGameKey)) { return; } rkKey = Registry.LocalMachine.OpenSubKey(strGameKey, true); rkKey.SetValue("Mods", p_strMods); rkKey.SetValue("InstallInfo", p_strInstallInfo); rkKey.SetValue("Virtual", p_strVirtual); rkKey.SetValue("MultiHDInstall", p_booMultiHDInstall); //This parameter can actually be null sometimes if (!string.IsNullOrWhiteSpace(p_strHDLink)) { rkKey.SetValue("HDLink", p_strHDLink); } } catch { //Why is this not being logged? return; } }
/// <summary> /// Check the correct path on the Registry. /// </summary> /// <param name="strGameMode">The selected game mode.</param> /// <param name="strMods">The selected Mods path.</param> /// <param name="strInstallInfo">The selected Install Info path.</param> public void SaveRegistry(string p_strGameMode, string p_strMods, string p_strInstallInfo, string p_strVirtual, string p_strHDLink, bool p_booMultiHDInstall) { try { RegistryKey rkKey = null; string strNMMKey = @"HKEY_LOCAL_MACHINE\SOFTWARE\NexusModManager\"; string strGameKey = @"HKEY_LOCAL_MACHINE\SOFTWARE\NexusModManager\" + p_strGameMode; if (RegistryUtil.CanReadKey(strNMMKey) && RegistryUtil.CanWriteKey(strNMMKey)) { rkKey = Registry.LocalMachine.OpenSubKey(strNMMKey, true); if (rkKey == null) { if (RegistryUtil.CanCreateKey(strNMMKey)) { Registry.LocalMachine.CreateSubKey(strNMMKey); } } } if (rkKey != null) { if (RegistryUtil.CanCreateKey(strGameKey)) { Registry.LocalMachine.CreateSubKey(strGameKey); } if (RegistryUtil.CanReadKey(strGameKey) && RegistryUtil.CanWriteKey(strGameKey)) { rkKey = Registry.LocalMachine.OpenSubKey(strGameKey, true); rkKey.SetValue("Mods", p_strMods); rkKey.SetValue("InstallInfo", p_strInstallInfo); rkKey.SetValue("Virtual", p_strVirtual); rkKey.SetValue("HDLink", p_strHDLink); rkKey.SetValue("MultiHDInstall", p_booMultiHDInstall); } } } catch { return; } }
/// <summary> /// Check the correct path on the Registry. /// </summary> /// <param name="strGameMode">The selected game mode.</param> /// <param name="strMods">The selected Mods path.</param> /// <param name="strInstallInfo">The selected Install Info path.</param> public void SaveRegistry(string strGameMode, string strMods, string strInstallInfo) { try { RegistryKey rkKey = null; string strNMMKey = @"SOFTWARE\NexusModManager\"; string strGameKey = @"SOFTWARE\NexusModManager\" + strGameMode; if (RegistryUtil.CanReadKey(strNMMKey) && RegistryUtil.CanWriteKey(strNMMKey)) { rkKey = Registry.LocalMachine.OpenSubKey(strNMMKey, true); if (rkKey == null) { if (RegistryUtil.CanCreateKey(strNMMKey)) { Registry.LocalMachine.CreateSubKey(strNMMKey); } } } if (rkKey != null) { if (RegistryUtil.CanCreateKey(strGameKey)) { Registry.LocalMachine.CreateSubKey(strGameKey); } if (RegistryUtil.CanReadKey(strGameKey) && RegistryUtil.CanWriteKey(strGameKey)) { rkKey = Registry.LocalMachine.OpenSubKey(strGameKey, true); rkKey.SetValue("Mods", strMods); rkKey.SetValue("InstallInfo", strInstallInfo); } } } catch { return; } }