예제 #1
0
 /// <summary>
 /// Returns whether the database knows a key with the handle specified in <paramref name="request"/>.
 /// The full path of the key is set to <paramref name="request.KeyFullPath"/> if the key is known.
 /// </summary>
 /// <param name="request">The index to search a key for.</param>
 /// <returns></returns>
 public bool IsKnownKey(RegistryRequest request)
 {
     using (_keysSynchronizationLock.EnterDisposableReadLock())
     {
         if (_keyAliases.ContainsKey(request.Handle))
         {
             request.Handle = _keyAliases[request.Handle];
         }
         if (_keys.Keys.Contains(request.Handle))
         {
             request.KeyFullPath = _keys[request.Handle].Path;
             return(true);
         }
     }
     return(false);
 }
예제 #2
0
 /// <summary>
 /// Determines whether a rule for the specified <see cref="identifier"/> is defined
 /// in the current <see cref="EngineRuleCollection"/>.
 /// </summary>
 /// <param name="identifier">
 /// The value to determine the existence of an associated <see cref="VirtualizationType"/> for.
 /// </param>
 /// <param name="rule">
 /// The first <see cref="VirtualizationType"/> associated to the given value.
 /// </param>
 /// <returns></returns>
 public bool HasRule(string identifier, out VirtualizationType rule)
 {
     rule = default(VirtualizationType);
     using (_rulesLock.EnterDisposableReadLock())
     {
         var i = GetRuleIndex(identifier);
         if (i == -1)
         {
             return(false);
         }
         rule = _rules[i].VirtualizationType;
         return(true);
     }
 }
예제 #3
0
 /// <summary>
 /// Returns true if the specified index is already used by one of the users.
 /// </summary>
 /// <param name="indexToValidate"></param>
 /// <returns></returns>
 public bool IsInUse(uint indexToValidate)
 {
     // First check the ranges with indices to exclude.
     foreach (var range in _excludedRanges)
     {
         if (range.IsInRange(indexToValidate))
         {
             return(true);
         }
     }
     // Now check if one of the users holds the index.
     using (_usersLock.EnterDisposableReadLock())
         foreach (var user in _users)
         {
             if (user.IsUsedIndex(indexToValidate))
             {
                 return(true);
             }
         }
     return(false);
 }