mirror of
https://github.com/Tichau/FileConverter.git
synced 2026-11-19 17:12:22 +01:00
Add possibility to define a default value in registry.
This commit is contained in:
1 parent
155273ae65
commit
fec5591bcb
1 file changed
+4
-5
@@ -80,14 +80,13 @@ namespace FileConverter
|
||||
}
|
||||
}
|
||||
|
||||
public static T GetValue<T>(string key)
|
||||
public static T GetValue<T>(string key, T defaultValue = default(T))
|
||||
{
|
||||
Registry registry = Registry.Instance;
|
||||
|
||||
string stringValue;
|
||||
if (!registry.registryEntries.TryGetValue(key, out stringValue))
|
||||
if (!registry.registryEntries.TryGetValue(key, out string stringValue))
|
||||
{
|
||||
return default(T);
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
try
|
||||
@@ -100,7 +99,7 @@ namespace FileConverter
|
||||
Diagnostics.Debug.LogError("Can't convert registry value: {0}.", exception.Message);
|
||||
}
|
||||
|
||||
return default(T);
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
public static void SetValue<T>(string key, T value)
|
||||
|
||||
Reference in new issue
Block a user