2020-08-10 06:58:51 +02:00
|
|
|
|
using System;
|
|
|
|
|
using Microsoft.Win32;
|
|
|
|
|
|
|
|
|
|
namespace Giants.Launcher
|
|
|
|
|
{
|
2020-08-10 09:22:33 +02:00
|
|
|
|
public static class RegistryExtensions
|
2020-08-13 06:58:53 +02:00
|
|
|
|
{
|
|
|
|
|
// Extension to Registry.GetValue() that returns the default value if the returned object does not
|
|
|
|
|
// match the type specified.
|
|
|
|
|
public static object GetValue(string keyName, string valueName, object defaultValue, Type type)
|
|
|
|
|
{
|
|
|
|
|
object retVal = Registry.GetValue(keyName, valueName, defaultValue);
|
|
|
|
|
|
|
|
|
|
if (retVal.GetType() != type)
|
|
|
|
|
return defaultValue;
|
|
|
|
|
else
|
|
|
|
|
return retVal;
|
|
|
|
|
}
|
|
|
|
|
}
|
2020-08-10 06:58:51 +02:00
|
|
|
|
|
|
|
|
|
}
|