Atomia.Provisioning.Modules.Folders.Helpers.Common.FillBindingsElement C# (CSharp) Method

FillBindingsElement() private static method

private static FillBindingsElement ( System resourceAndPolicy, string moduleName ) : ResourceDescription>.Dictionary
resourceAndPolicy System
moduleName string
return ResourceDescription>.Dictionary
        private static Dictionary<string, ResourceDescription> FillBindingsElement(System.Xml.Linq.XElement resourceAndPolicy, string moduleName)
        {
            Dictionary<string, ResourceDescription> resources = new Dictionary<string, ResourceDescription>();

            // find all resources descriptions for module
            foreach (System.Xml.Linq.XElement module in resourceAndPolicy.Element("moduleList").Elements())
            {
                if (module.Attribute("name").Value == moduleName)
                {

                    foreach (System.Xml.Linq.XElement resourceItem in resourceAndPolicy.Element("resourceList").Elements())
                    {

                        ResourceDescription resourceDesc = new ResourceDescription(resourceItem.Attribute("name").Value, moduleName);

                        resourceDesc.ShouldBeLocked = true;

                        foreach (System.Xml.Linq.XElement propElem in resourceItem.Elements("property"))
                        {
                            resourceDesc[propElem.Attribute("name").Value] = propElem.Value;
                        }

                        foreach (System.Xml.Linq.XElement propListEl in resourceItem.Elements("propertyList"))
                        {
                            ResourceDescriptionPropertyList resDescPropList = new ResourceDescriptionPropertyList();
                            resDescPropList.PropertyListName = propListEl.Attribute("name").Value;
                            foreach (System.Xml.Linq.XElement propListItem in propListEl.Elements("propertyListItem"))
                            {
                                resDescPropList.PropertyListItems.Add(propListItem.Value);
                            }

                            resourceDesc.PropertyList.Add(resDescPropList);
                        }

                        // first check if this resource already exist in list of resoources
                        if (resources.ContainsKey(resourceDesc.Name))
                        {
                            // check if they are the same
                            if (resourceDesc.Equals(resources[resourceDesc.Name]))
                            {
                                resourceDesc = resources[resourceDesc.Name];
                            }
                            else
                            {
                                // they have the same name but settings are different.
                                // this is not allowed
                                throw ExceptionHelper.GetModuleException("ID422005", new Dictionary<string, string>() { { "Message", resourceDesc.Name } }, null);
                            }
                        }
                        else
                        {
                            resources[resourceDesc.Name] = resourceDesc;
                        }

                    }

                }
            }

            return resources;
        }