Пример #1
0
 /// <summary>
 /// Gets the item value from the items array.
 /// This method makes the combination between ItemsElementName and Items array
 /// to the get value.
 /// </summary>
 /// <param name="itemName">Name of the item.</param>
 /// <returns></returns>
 public Object GetItemValue(registry_object_ItemsChoices itemName)
 {
     for (int i = 0; i <= this.RegistryObjectItemsElementName.Count() - 1; i++)
     {
         if (this.RegistryObjectItemsElementName[i] == itemName)
         {
             return this.Items[i];
         }
     }
     return null;
 }
Пример #2
0
 /// <summary>
 /// Gets the item value from the items array.
 /// This method makes the combination between ItemsElementName and Items array
 /// to the get value.
 /// </summary>
 /// <param name="itemName">Name of the item.</param>
 /// <returns></returns>
 public Object GetItemValue(registry_object_ItemsChoices itemName)
 {
     for (int i = 0; i <= this.RegistryObjectItemsElementName.Count() - 1; i++)
     {
         if (this.RegistryObjectItemsElementName[i] == itemName)
         {
             return(this.Items[i]);
         }
     }
     return(null);
 }
        private IEnumerable <string> processOperationInEntity(registry_object_ItemsChoices entity, RegistryObject registryObject)
        {
            string entityValue = registryObject.GetValueOfEntity(entity.ToString());
            OperationEnumeration entityOperation = registryObject.GetOperationOfEntity(entity.ToString());
            bool isKeyEntity = (entity == registry_object_ItemsChoices.key);

            if (operatorHelper.IsEqualsOperation(entityOperation))
            {
                return(new List <string>()
                {
                    this.processEqualsOperations(entity, registryObject, isKeyEntity)
                });
            }
            else
            {
                return(this.EvaluateOperation(entityOperation, entityValue, registryObject, isKeyEntity));
            }
        }
        private string processEqualsOperations(registry_object_ItemsChoices entity, RegistryObject registryObject, bool isKey)
        {
            string hive = registryObject.Hive;
            string key  = registryObject.Key;
            Dictionary <string, string> parameters = RegistryHelper.GetInputParametersForWmiEnumValuesMethod(hive, key);

            if (isKey)
            {
                Dictionary <string, object> result = this.wmiDataProvider.InvokeMethod("EnumKey", parameters);
                if ((uint)result["ReturnValue"] == 2)
                {
                    throw new RegistryKeyNotFoundException(String.Format("The key {0} does not exist", key));
                }
                return(key);
            }
            else
            {
                return(registryObject.GetValueOfEntity(entity.ToString()));
            }
        }
        private string processEqualsOperations(registry_object_ItemsChoices entity, RegistryObject registryObject, bool isKey)
        {
            string hive = registryObject.Hive;
            string key = registryObject.Key;
            Dictionary<string, string> parameters = RegistryHelper.GetInputParametersForWmiEnumValuesMethod(hive, key);
            if (isKey)
            {
                Dictionary<string, object> result = this.wmiDataProvider.InvokeMethod("EnumKey", parameters);
                if ((uint)result["ReturnValue"] == 2)
                    throw new RegistryKeyNotFoundException(String.Format("The key {0} does not exist", key));
                return key;
            }
            else
            {
                return registryObject.GetValueOfEntity(entity.ToString());
            }

        }
 private IEnumerable<string> processOperationInEntity(registry_object_ItemsChoices entity, RegistryObject registryObject)
 {
     string entityValue = registryObject.GetValueOfEntity(entity.ToString());
     OperationEnumeration entityOperation = registryObject.GetOperationOfEntity(entity.ToString());
     bool isKeyEntity = (entity == registry_object_ItemsChoices.key);
     if (operatorHelper.IsEqualsOperation(entityOperation))
     {
         return new List<string>() { this.processEqualsOperations(entity, registryObject, isKeyEntity) };
     }
     else
     {
         return this.EvaluateOperation(entityOperation, entityValue, registryObject, isKeyEntity);
     }
 }