aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKarsten Heimrich <karsten.heimrich@qt.io>2022-07-05 14:57:50 +0200
committerKarsten Heimrich <karsten.heimrich@qt.io>2022-07-08 11:34:45 +0000
commitdbedfd46e4ebd377d0d9394af9850fde60407e11 (patch)
tree4c313172dada775c8018f0d25c25587d84cb0a93
parente6ad6aeb07476759593b79f5768ab26bb5cdb12f (diff)
Introduce string constant for registry path
Change-Id: I9458540105c248a6d0ca30c5b2d8d1fbcd6ee496 Reviewed-by: Miguel Costa <miguel.costa@qt.io>
-rw-r--r--QtVsTools.Core/Common/QtVSIPSettingsShared.cs10
1 files changed, 6 insertions, 4 deletions
diff --git a/QtVsTools.Core/Common/QtVSIPSettingsShared.cs b/QtVsTools.Core/Common/QtVSIPSettingsShared.cs
index c14b5c6c..1e4115df 100644
--- a/QtVsTools.Core/Common/QtVSIPSettingsShared.cs
+++ b/QtVsTools.Core/Common/QtVSIPSettingsShared.cs
@@ -126,10 +126,12 @@ namespace QtVsTools.Common
return GetDirectory(type);
}
+ private const string registryPath = "SOFTWARE\\" + Resources.registryPackagePath;
+
public static string GetDirectory(string type)
{
try {
- var key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\" + Resources.registryPackagePath);
+ var key = Registry.CurrentUser.OpenSubKey(registryPath);
if (key != null) {
var path = (string)key.GetValue(type, null);
if (path != null)
@@ -157,7 +159,7 @@ namespace QtVsTools.Common
public static string GetOption(string type)
{
try {
- var key = Registry.CurrentUser.OpenSubKey("SOFTWARE\\" + Resources.registryPackagePath);
+ var key = Registry.CurrentUser.OpenSubKey(registryPath);
if (key != null) {
var opt = (string)key.GetValue(type, null);
if (opt != null)
@@ -182,7 +184,7 @@ namespace QtVsTools.Common
public static bool GetBoolValue(string key, bool defaultValue)
{
- var regKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\" + Resources.registryPackagePath);
+ var regKey = Registry.CurrentUser.OpenSubKey(registryPath);
if (regKey == null)
return defaultValue;
return ((int)regKey.GetValue(key, defaultValue ? 1 : 0)) > 0;
@@ -190,7 +192,7 @@ namespace QtVsTools.Common
public static bool ValueExists(string key)
{
- var regKey = Registry.CurrentUser.OpenSubKey("SOFTWARE\\" + Resources.registryPackagePath);
+ var regKey = Registry.CurrentUser.OpenSubKey(registryPath);
if (regKey != null) {
foreach (var s in regKey.GetValueNames()) {
if (s == key)