コード例 #1
0
        public IEnumerable <ItemType> CreateRegistryItemTypesByCombinationOfEntitiesFrom(
            IEnumerable <string> hives,
            IEnumerable <string> keys,
            IEnumerable <string> names, RegistryObject registryObjectSource)
        {
            List <ItemType> registryObjects = new List <ItemType>();

            registryObjects.AddRange(this.VerifyErrorsInTheListOfRegistryEntities(hives, keys, names, registryObjectSource));
            if (registryObjects.Count == 0)
            {
                foreach (string hiveValue in hives)
                {
                    foreach (string keyValue in keys)
                    {
                        foreach (string nameValue in names)
                        {
                            registryObjects.Add(this.CreateRegistryItem(hiveValue, keyValue, nameValue));
                        }
                    }
                }
            }


            return(registryObjects);
        }
コード例 #2
0
 /// <summary>
 /// Creates the registry objects by combination of entities.
 /// This method combines the entities for the create multiples RegistryObjects given a other RegistryObject as source. 
 /// Ex. We can have the hives [HKEY_LOCAL_MACHINE], the keys [Microsoft\Windows,Microsoft\Windows NT] 
 /// and the names [CurrentVersion,CurrentBuild]. 
 /// With these wqlParameters will be created 4 registryObjects:
 ///  1 - RegistryObject {hive = HKEY_LOCAL_MACHINE, key = Microsoft\Windows, name = CurrentVersion}
 ///  2 - RegistryObject {hive = HKEY_LOCAL_MACHINE, key = Microsoft\Windows, name = CurrentBuild}
 ///  3 - RegistryObject {hive = HKEY_LOCAL_MACHINE, key = Microsoft\Windows NT, name = CurrentVersion}
 ///  4 - RegistryObject {hive = HKEY_LOCAL_MACHINE, key = Microsoft\Windows NT, name = CurrentBuild}
 ///  The information of Variables and Operations for each entity, will be copied from source RegistryObject.
 /// </summary>
 /// <param name="hives">The hives.</param>
 /// <param name="keys">The keys.</param>
 /// <param name="names">The names.</param>
 /// <param name="registryObjectSource"> the source registry object </param>
 /// <returns></returns>
 public static IEnumerable<RegistryObject> CreateRegistryObjectsByCombinationOfEntitiesFrom(IEnumerable<string> hives, 
                                                                                            IEnumerable<string> keys, 
                                                                                            IEnumerable<string> names,
                                                                                            RegistryObject registryObjectSource)
 {
     List<RegistryObject> registryObjects = CreateResgistryObjectByCombination(hives, keys, names, registryObjectSource);
     return registryObjects;
 }
コード例 #3
0
        public IEnumerable<ItemType> CreateRegistryItemTypesByCombinationOfEntitiesFrom(
                                                                   IEnumerable<string> hives, 
                                                                   IEnumerable<string> keys, 
                                                                   IEnumerable<string> names, RegistryObject registryObjectSource)
        {
            List<ItemType> registryObjects = new List<ItemType>();

            registryObjects.AddRange(this.VerifyErrorsInTheListOfRegistryEntities(hives,keys,names,registryObjectSource));
            if (registryObjects.Count == 0)
                foreach (string hiveValue in hives)
                    foreach (string keyValue in keys)
                        foreach (string nameValue in names)
                            registryObjects.Add(this.CreateRegistryItem(hiveValue, keyValue, nameValue));

            return registryObjects;
        }
コード例 #4
0
        private static List <RegistryObject> CreateResgistryObjectByCombination(
            IEnumerable <string> hives,
            IEnumerable <string> keys,
            IEnumerable <string> names,
            RegistryObject registryObjectSource)
        {
            List <RegistryObject> registryObjects = new List <RegistryObject>();

            foreach (string hiveValue in hives)
            {
                foreach (string keyValue in keys)
                {
                    foreach (string nameValue in names)
                    {
                        RegistryObject registry = RegistryObjectFactory.CreateRegistryObjectFrom(hiveValue, keyValue, nameValue, registryObjectSource);
                        registryObjects.Add(registry);
                    }
                }
            }
            return(registryObjects);
        }
コード例 #5
0
 private static List<RegistryObject> CreateResgistryObjectByCombination(
                                                 IEnumerable<string> hives, 
                                                 IEnumerable<string> keys, 
                                                 IEnumerable<string> names, 
                                                 RegistryObject registryObjectSource)
 {
     List<RegistryObject> registryObjects = new List<RegistryObject>();
     foreach (string hiveValue in hives)
     {
         foreach (string keyValue in keys)
         {
             foreach (string nameValue in names)
             {
                 RegistryObject registry = RegistryObjectFactory.CreateRegistryObjectFrom(hiveValue, keyValue, nameValue, registryObjectSource);
                 registryObjects.Add(registry);
             }
         }
     }
     return registryObjects;
 }
コード例 #6
0
 private static EntityObjectStringType CreateEntityObjectStringType(string entityName, string value, RegistryObject source)
 {
     return new EntityObjectStringType()
     {
         Value = value,
         var_ref = source.GetVariableId(entityName),
         operation = source.GetOperationOfEntity(entityName)
     };
 }
コード例 #7
0
        private static RegistryObject CreateRegistryObjectFrom(string hive, string key, string name, RegistryObject source)
        {
            Dictionary<string, EntityObjectStringType> registryEntities = new Dictionary<string, EntityObjectStringType>();
            registryEntities.Add(registry_object_ItemsChoices.hive.ToString(), CreateEntityObjectStringType(registry_object_ItemsChoices.hive.ToString(),hive,source));
            registryEntities.Add(registry_object_ItemsChoices.key.ToString(), CreateEntityObjectStringType(registry_object_ItemsChoices.key.ToString(), key, source));
            registryEntities.Add(registry_object_ItemsChoices.name.ToString(), CreateEntityObjectStringType(registry_object_ItemsChoices.name.ToString(), name, source));
            return new RegistryObject(registryEntities);

        }
コード例 #8
0
        private IEnumerable<ItemType> VerifyErrorsInTheListOfRegistryEntities(
            IEnumerable<string> hives, IEnumerable<string> keys, IEnumerable<string> names, RegistryObject registryObjectSource)
        {
            List<ItemType> registryObjects = new List<ItemType>();
            if ((hives == null) || (hives.Count() == 0))
            {
                registry_item registry = this.CreateRegistryItem(registryObjectSource.Hive, "", "",StatusEnumeration.doesnotexist);
                registry.hive.status = StatusEnumeration.doesnotexist;
                registryObjects.Add(registry);
                return registryObjects;
            }
            if ((keys == null) || (keys.Count() == 0))
            {
                registry_item registry = this.CreateRegistryItem(registryObjectSource.Hive, registryObjectSource.Key, "", StatusEnumeration.doesnotexist);
                registry.key.status = StatusEnumeration.doesnotexist;
                registryObjects.Add(registry);
                return registryObjects;
            }
            if ((names == null) || (names.Count() == 0))
            {
                registry_item registry = this.CreateRegistryItem(registryObjectSource.Hive, registryObjectSource.Key, registryObjectSource.Name,StatusEnumeration.doesnotexist);
                registry.name.status = StatusEnumeration.doesnotexist;
                registryObjects.Add(registry);
                return registryObjects;
            }

            return registryObjects;
        }
コード例 #9
0
        /// <summary>
        /// Creates the registry objects by combination of entities.
        /// This method combines the entities for the create multiples RegistryObjects given a other RegistryObject as source.
        /// Ex. We can have the hives [HKEY_LOCAL_MACHINE], the keys [Microsoft\Windows,Microsoft\Windows NT]
        /// and the names [CurrentVersion,CurrentBuild].
        /// With these wqlParameters will be created 4 registryObjects:
        ///  1 - RegistryObject {hive = HKEY_LOCAL_MACHINE, key = Microsoft\Windows, name = CurrentVersion}
        ///  2 - RegistryObject {hive = HKEY_LOCAL_MACHINE, key = Microsoft\Windows, name = CurrentBuild}
        ///  3 - RegistryObject {hive = HKEY_LOCAL_MACHINE, key = Microsoft\Windows NT, name = CurrentVersion}
        ///  4 - RegistryObject {hive = HKEY_LOCAL_MACHINE, key = Microsoft\Windows NT, name = CurrentBuild}
        ///  The information of Variables and Operations for each entity, will be copied from source RegistryObject.
        /// </summary>
        /// <param name="hives">The hives.</param>
        /// <param name="keys">The keys.</param>
        /// <param name="names">The names.</param>
        /// <param name="registryObjectSource"> the source registry object </param>
        /// <returns></returns>
        public static IEnumerable <RegistryObject> CreateRegistryObjectsByCombinationOfEntitiesFrom(IEnumerable <string> hives,
                                                                                                    IEnumerable <string> keys,
                                                                                                    IEnumerable <string> names,
                                                                                                    RegistryObject registryObjectSource)
        {
            List <RegistryObject> registryObjects = CreateResgistryObjectByCombination(hives, keys, names, registryObjectSource);

            return(registryObjects);
        }
コード例 #10
0
 private static EntityObjectStringType CreateEntityObjectStringType(string entityName, string value, RegistryObject source)
 {
     return(new EntityObjectStringType()
     {
         Value = value,
         var_ref = source.GetVariableId(entityName),
         operation = source.GetOperationOfEntity(entityName)
     });
 }
コード例 #11
0
        private static RegistryObject CreateRegistryObjectFrom(string hive, string key, string name, RegistryObject source)
        {
            Dictionary <string, EntityObjectStringType> registryEntities = new Dictionary <string, EntityObjectStringType>();

            registryEntities.Add(registry_object_ItemsChoices.hive.ToString(), CreateEntityObjectStringType(registry_object_ItemsChoices.hive.ToString(), hive, source));
            registryEntities.Add(registry_object_ItemsChoices.key.ToString(), CreateEntityObjectStringType(registry_object_ItemsChoices.key.ToString(), key, source));
            registryEntities.Add(registry_object_ItemsChoices.name.ToString(), CreateEntityObjectStringType(registry_object_ItemsChoices.name.ToString(), name, source));
            return(new RegistryObject(registryEntities));
        }
コード例 #12
0
        private IEnumerable <ItemType> VerifyErrorsInTheListOfRegistryEntities(
            IEnumerable <string> hives, IEnumerable <string> keys, IEnumerable <string> names, RegistryObject registryObjectSource)
        {
            List <ItemType> registryObjects = new List <ItemType>();

            if ((hives == null) || (hives.Count() == 0))
            {
                registry_item registry = this.CreateRegistryItem(registryObjectSource.Hive, "", "", StatusEnumeration.doesnotexist);
                registry.hive.status = StatusEnumeration.doesnotexist;
                registryObjects.Add(registry);
                return(registryObjects);
            }
            if ((keys == null) || (keys.Count() == 0))
            {
                registry_item registry = this.CreateRegistryItem(registryObjectSource.Hive, registryObjectSource.Key, "", StatusEnumeration.doesnotexist);
                registry.key.status = StatusEnumeration.doesnotexist;
                registryObjects.Add(registry);
                return(registryObjects);
            }
            if ((names == null) || (names.Count() == 0))
            {
                registry_item registry = this.CreateRegistryItem(registryObjectSource.Hive, registryObjectSource.Key, registryObjectSource.Name, StatusEnumeration.doesnotexist);
                registry.name.status = StatusEnumeration.doesnotexist;
                registryObjects.Add(registry);
                return(registryObjects);
            }

            return(registryObjects);
        }