예제 #1
0
 public static T RetrieveDefaultUserRegistryValue <T>(string subkeyName, string valueName)
 {
     return(RegistryHelper.RetrieveRegistryValue <T>(Registry.Users, ".DEFAULT\\" + subkeyName, valueName));
 }
예제 #2
0
 public static T RetrieveCurrentUserRegistryValue <T>(string subkeyName, string valueName)
 {
     return(RegistryHelper.RetrieveRegistryValue <T>(Registry.CurrentUser, subkeyName, valueName));
 }
예제 #3
0
 public static T RetrieveLocalMachineRegistryValue <T>(string subkeyName, string valueName)
 {
     return(RegistryHelper.RetrieveRegistryValue <T>(Registry.LocalMachine, subkeyName, valueName));
 }
예제 #4
0
 public static bool SetCurrentUserRegistryValue <T>(string subkeyName, string valueName, T value, RegistryValueKind valueKind)
 {
     return(RegistryHelper.SetRegistryValue <T>(Registry.CurrentUser, subkeyName, valueName, value, valueKind));
 }
예제 #5
0
 public static bool SetCurrentUserRegistryValue <T>(string subkeyName, string valueName, T value)
 {
     return(RegistryHelper.SetCurrentUserRegistryValue <T>(subkeyName, valueName, value, RegistryValueKind.Unknown));
 }
예제 #6
0
        public static bool SetRegistryValue <T>(RegistryKey registryKey, string subkeyName, string valueName, T value, RegistryValueKind valueKind)
        {
            RegistryKey registrySubkey = RegistryHelper.OpenSubkey(registryKey, subkeyName, true);

            if (registrySubkey == null)
            {
                if ((object)value == null)
                {
                    return(true);
                }
                if (RegistryHelper.RegistryExceptionWrapper((Action)(() => registrySubkey = registryKey.CreateSubKey(subkeyName))) != null)
                {
                    return(false);
                }
            }
            if (registrySubkey == null)
            {
                return(false);
            }
            try
            {
                return(((object)value != null ? RegistryHelper.RegistryExceptionWrapper((Action)(() => registrySubkey.SetValue(valueName, (object)(T)value, valueKind))) : RegistryHelper.RegistryExceptionWrapper((Action)(() => registrySubkey.DeleteValue(valueName, false)))) == null);
            }
            finally
            {
                registrySubkey.Close();
            }
        }
예제 #7
0
 public static bool SetRegistryValue <T>(RegistryKey registryKey, string subkeyName, string valueName, T value)
 {
     return(RegistryHelper.SetRegistryValue <T>(registryKey, subkeyName, valueName, value, RegistryValueKind.Unknown));
 }
예제 #8
0
 public static T RetrieveVisualStudioRegistryValue <T>(VisualStudioRegistryLocation primaryKey, string subkeyName, string valueName)
 {
     return(Enumerable.FirstOrDefault <T>(RegistryHelper.RetrieveAllVisualStudioRegistryValues <T>(primaryKey, subkeyName, valueName)));
 }