private IEnumerable <ItemType> processOperationInRegistryObject(RegistryObject registryObject) { List <string> hives = new List <string>() { registryObject.Hive }; RegistryItemTypeFactory itemTypeFactory = new RegistryItemTypeFactory(); List <ItemType> items = new List <ItemType>(); List <string> keys = new List <string>(); List <string> names = new List <string>(); try { var registryNameValue = registryObject.GetValueOfEntity("name"); keys.AddRange(this.processOperationInEntity(registry_object_ItemsChoices.key, registryObject)); var derivedRegistryObjects = RegistryObjectFactory.CreateRegistryObjectsByCombinationOfEntitiesFrom(hives, keys, new string[] { registryNameValue }, registryObject); if (registryObject.GetNameOperation() != OperationEnumeration.equals) { foreach (var newRegistryObject in derivedRegistryObjects) { if (!string.IsNullOrEmpty(registryNameValue)) { names = this.processOperationInEntity(registry_object_ItemsChoices.name, newRegistryObject).ToList(); items.AddRange(itemTypeFactory.CreateRegistryItemTypesByCombinationOfEntitiesFrom(hives, new string[] { newRegistryObject.Key }, names, registryObject)); } } } else { names.AddRange(this.processOperationInEntity(registry_object_ItemsChoices.name, registryObject)); items.AddRange(itemTypeFactory.CreateRegistryItemTypesByCombinationOfEntitiesFrom(hives, keys, names, registryObject)); } } catch (RegistryKeyNotFoundException) { items = itemTypeFactory.CreateRegistryItemTypesByCombinationOfEntitiesFrom(hives, null, null, registryObject).ToList(); } catch (RegistryItemNotFoundException) { items = new List <ItemType>() { itemTypeFactory.CreateRegistryItem("", "", "", StatusEnumeration.doesnotexist) }; } catch (Exception ex) { registry_item registry = itemTypeFactory.CreateRegistryItem(registryObject.Hive, registryObject.Key, registryObject.Name, StatusEnumeration.error); registry.message = MessageType.FromErrorString(ex.Message); items = new List <ItemType>() { registry }; } return(items); }
private IEnumerable<ItemType> processOperationInRegistryObject(RegistryObject registryObject) { List<string> hives = new List<string>() { registryObject.Hive }; RegistryItemTypeFactory itemTypeFactory = new RegistryItemTypeFactory(); List<ItemType> items = new List<ItemType>(); List<string> keys = new List<string>(); List<string> names = new List<string>(); try { var registryNameValue = registryObject.GetValueOfEntity("name"); keys.AddRange(this.processOperationInEntity(registry_object_ItemsChoices.key, registryObject)); var derivedRegistryObjects = RegistryObjectFactory.CreateRegistryObjectsByCombinationOfEntitiesFrom(hives, keys, new string[] { registryNameValue }, registryObject); if (registryObject.GetNameOperation() != OperationEnumeration.equals) { foreach (var newRegistryObject in derivedRegistryObjects) { if (!string.IsNullOrEmpty(registryNameValue)) { names = this.processOperationInEntity(registry_object_ItemsChoices.name, newRegistryObject).ToList(); items.AddRange(itemTypeFactory.CreateRegistryItemTypesByCombinationOfEntitiesFrom(hives, new string[] { newRegistryObject.Key }, names, registryObject)); } } } else { names.AddRange(this.processOperationInEntity(registry_object_ItemsChoices.name, registryObject)); items.AddRange(itemTypeFactory.CreateRegistryItemTypesByCombinationOfEntitiesFrom(hives, keys, names, registryObject)); } } catch (RegistryKeyNotFoundException) { items = itemTypeFactory.CreateRegistryItemTypesByCombinationOfEntitiesFrom(hives, null, null, registryObject).ToList(); } catch (RegistryItemNotFoundException) { items = new List<ItemType>() { itemTypeFactory.CreateRegistryItem("", "", "", StatusEnumeration.doesnotexist) }; } catch (Exception ex) { registry_item registry = itemTypeFactory.CreateRegistryItem(registryObject.Hive, registryObject.Key, registryObject.Name, StatusEnumeration.error); registry.message = MessageType.FromErrorString(ex.Message); items = new List<ItemType>() { registry }; } return items; }