Inheritance: IRegistryApi
Ejemplo n.º 1
0
        private RegistryKey CreateSubKey(RegistryKey rkey, string keyname, bool writable)
        {
            KeyHandler keyHandler = KeyHandler.Lookup(rkey, true);

            if (keyHandler == null)
            {
                throw RegistryKey.CreateMarkedForDeletionException();
            }
            return(keyHandler.Ensure(rkey, UnixRegistryApi.ToUnix(keyname), writable));
        }
Ejemplo n.º 2
0
        public RegistryKey OpenSubKey(RegistryKey rkey, string keyname, bool writable)
        {
            KeyHandler keyHandler = KeyHandler.Lookup(rkey, true);

            if (keyHandler == null)
            {
                return(null);
            }
            RegistryKey registryKey = keyHandler.Probe(rkey, UnixRegistryApi.ToUnix(keyname), writable);

            if (registryKey == null && UnixRegistryApi.IsWellKnownKey(rkey.Name, keyname))
            {
                registryKey = this.CreateSubKey(rkey, keyname, writable);
            }
            return(registryKey);
        }
Ejemplo n.º 3
0
        public void DeleteKey(RegistryKey rkey, string keyname, bool throw_if_missing)
        {
            KeyHandler keyHandler = KeyHandler.Lookup(rkey, true);

            if (keyHandler != null)
            {
                string text = Path.Combine(keyHandler.Dir, UnixRegistryApi.ToUnix(keyname));
                if (Directory.Exists(text))
                {
                    Directory.Delete(text, true);
                    KeyHandler.Drop(text);
                }
                else if (throw_if_missing)
                {
                    throw new ArgumentException("the given value does not exist");
                }
                return;
            }
            if (!throw_if_missing)
            {
                return;
            }
            throw new ArgumentException("the given value does not exist");
        }