mirror of
https://github.com/ncblakely/GiantsTools
synced 2024-11-04 22:35:37 +01:00
24 lines
586 B
C#
24 lines
586 B
C#
|
using System;
|
|||
|
using System.Collections.Generic;
|
|||
|
using System.Linq;
|
|||
|
using System.Text;
|
|||
|
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;
|
|||
|
}
|
|||
|
}
|
|||
|
|
|||
|
}
|