/// <summary> /// Merge des fichiers xml /// </summary> /// <param name="result">Fichier xml initial</param> /// <param name="component">The component.</param> /// <returns></returns> internal static XmlDocument MergeDeclaredConfigurations(XmlDocument result, SoftwareComponent component) { // Merge des configurations des layers foreach (AbstractLayer layer in component.Layers) { result = MergeConfiguration(result, layer.Configurations); } // Récupération des configurations des librairies externes ReferenceWalker walker = new ReferenceWalker(ReferenceScope.Runtime, new ConfigurationMode()); ConfigurationVisitor visitor = new ConfigurationVisitor(false); walker.Traverse(visitor, component.Model); result = MergeConfiguration(result, visitor.Configurations); // Il faut toujours placer la configSection en premier XmlNode cfgNode = result.SelectSingleNode("/configuration"); if (cfgNode != null) { XmlNode cs = cfgNode.SelectSingleNode("configSections"); if (cs != null) { cfgNode.RemoveChild(cs); cfgNode.InsertAfter(cs, null); } } return(result); }
/// <summary> /// Populates the specified current component. /// </summary> /// <param name="currentComponent">The current component.</param> /// <param name="model">The model.</param> private void Populate(SoftwareComponent currentComponent, CandleModel model) { _currentComponent = currentComponent; lstInheritedConfigurations.AutoGenerateColumns = false; lstConfigurations.AutoGenerateColumns = false; if (currentComponent != null) { foreach (SoftwareLayer layer in currentComponent.Layers) { ColLayer.Items.Add(layer.Name); } colVisibility.Items.Add(Visibility.Public); colVisibility.Items.Add(Visibility.Private); // Remplissage des configurations courantes _items = new ItemList(); foreach (SoftwareLayer layer in currentComponent.Layers) { foreach (ConfigurationPart cfg in layer.Configurations) { Item item = new Item(); item.ConfigName = cfg.Name; item.XmlContent = cfg.XmlContent; item.LayerName = layer.Name; item.LayerId = layer.Id; item.InitialEnabled = item.Enabled = cfg.Enabled; item.IsExternal = false; item.Visibility = cfg.Visibility; _items.Add(item); } } lstConfigurations.DataSource = _items; } else // On enlève cette page { tabControl1.TabPages.RemoveAt(0); } // Configurations externes ReferenceWalker walker = new ReferenceWalker(ReferenceScope.Runtime, new ConfigurationMode()); ConfigurationVisitor visitor = new ConfigurationVisitor(true); walker.Traverse(visitor, model); lstInheritedConfigurations.DataSource = visitor.Configurations.FindAll(delegate(ConfigurationPart p) { return(p.Enabled); }); }