Ejemplo n.º 1
0
        public static List <RegKey> GetChilds(RegistryKey key)
        {
            int subKeyCount = key.SubKeyCount;

            if (subKeyCount == 0)
            {
                return(new List <RegKey>());
            }

            List <RegKey> subKeys = new List <RegKey>(subKeyCount);

            String[] subKeyNames = key.GetSubKeyNames();
            for (int i = 0; i < subKeyNames.Length; i++)
            {
                try
                {
                    String keyName = subKeyNames[i];
                    RegKey item    = new RegKey(keyName, key.OpenSubKey(keyName));
                    subKeys.Add(item);
                }
                catch { }
            }

            return(subKeys);
        }
Ejemplo n.º 2
0
 public static Boolean DeleteValue(String key, String value)
 {
     try
     {
         RegKey regKey = RegKey.Parse(key, true);
         regKey.Key.DeleteValue(value, false);
     }
     catch
     {
         return(false);
     }
     return(true);
 }
Ejemplo n.º 3
0
 public static Boolean DeleteKey(String key)
 {
     try
     {
         RegKey child  = RegKey.Parse(key);
         RegKey parent = RegKey.Parse(child.Parent, true);
         parent.Key.DeleteSubKeyTree(child.Name);
     }
     catch
     {
         return(false);
     }
     return(true);
 }
Ejemplo n.º 4
0
        public static List<RegKey> GetChilds(RegistryKey key)
        {
            int subKeyCount = key.SubKeyCount;
            if (subKeyCount == 0)
                return new List<RegKey>();

            List<RegKey> subKeys = new List<RegKey>(subKeyCount);

            String[] subKeyNames = key.GetSubKeyNames();
            for (int i = 0; i < subKeyNames.Length; i++)
            {
                try
                {
                    String keyName = subKeyNames[i];
                    RegKey item = new RegKey(keyName, key.OpenSubKey(keyName));
                    subKeys.Add(item);
                }
                catch { }
            }

            return subKeys;
        }