Globals.RegistryAccess.removeKey C# (CSharp) Method

removeKey() public static method

public static removeKey ( RegistryKey mainKey, string subKey ) : bool
mainKey Microsoft.Win32.RegistryKey
subKey string
return bool
        public static bool removeKey(RegistryKey mainKey, string subKey)
        {
            try
            {
                mainKey.DeleteSubKeyTree(subKey);
            }
            catch (Exception e)
            {
                return false;
            }

            return true;
        }

Usage Example

示例#1
0
 private void PluginSetSelector_FormClosed(object sender, FormClosedEventArgs e)
 {
     // Clear any old plugin listings
     RegistryAccess.removeKey(Microsoft.Win32.Registry.CurrentUser,
                              RegistryAccess.RegPaths.Halo2 + "PluginSets\\");
     // We must always have at least a Default plugin
     if (pluginInfo.Names.Count == 0)
     {
         pluginInfo.Names.Add("Default");
         pluginInfo.Paths.Add(Prefs.pathPluginsFolder);
     }
     // Write all the plugins back to the registry
     for (int i = 0; i < pluginInfo.Names.Count; i++)
     {
         RegistryAccess.setValue(Microsoft.Win32.Registry.CurrentUser,
                                 RegistryAccess.RegPaths.Halo2 + "PluginSets\\",
                                 pluginInfo.Names[i],
                                 pluginInfo.Paths[i]);
     }
 }