Microsoft.Win32.KeyHandler.VolatileKeyExists C# (CSharp) Méthode

VolatileKeyExists() public static méthode

public static VolatileKeyExists ( string dir ) : bool
dir string
Résultat bool
		public static bool VolatileKeyExists (string dir)
		{
			lock (typeof (KeyHandler)) {
				KeyHandler kh = (KeyHandler) dir_to_handler [dir];
				if (kh != null)
					return kh.IsVolatile;
			}

			if (Directory.Exists (dir)) // Non-volatile key exists.
				return false;

			return Directory.Exists (GetVolatileDir (dir));
		}

Usage Example

        private RegistryKey CreateSubKey(RegistryKey rkey, string keyname, bool writable, bool is_volatile)
        {
            KeyHandler self = KeyHandler.Lookup(rkey, true);

            if (self == null)
            {
                throw RegistryKey.CreateMarkedForDeletionException();
            }
            if (KeyHandler.VolatileKeyExists(self.Dir) && !is_volatile)
            {
                throw new IOException("Cannot create a non volatile subkey under a volatile key.");
            }

            return(self.Ensure(rkey, ToUnix(keyname), writable, is_volatile));
        }