1
0
mirror of https://github.com/ncblakely/GiantsTools synced 2024-11-21 21:55:38 +01:00
GiantsTools/Giants.Launcher/Extensions.cs
2020-08-12 21:58:53 -07:00

21 lines
603 B
C#

using System;
using Microsoft.Win32;
namespace Giants.Launcher
{
public static class RegistryExtensions
{
// 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;
}
}
}