/// <summary>
 /// Initialize a new instance of the <see cref="MergedConfigurationProperty"/> class with the merged configuration data, A <see cref="PropertyDescriptor"/>, the instance and the <see cref="IConfigurationUIHierarchy"/>.
 /// </summary>
 /// <param name="mergedConfigurationData">A <see cref="ConfigurationNodeMergeData"/> object.</param>
 /// <param name="innerProperyDescriptor">The <see cref="PropertyDescriptor"/> for the node.</param>
 /// <param name="actualInstance">The instance for the property.</param>
 /// <param name="configurationHierarchy">An <see cref="IConfigurationUIHierarchy"/> object.</param>
 public MergedConfigurationProperty(ConfigurationNodeMergeData mergedConfigurationData,
                                    PropertyDescriptor innerProperyDescriptor,
                                    object actualInstance,
                                    IConfigurationUIHierarchy configurationHierarchy)
     : base(innerProperyDescriptor)
 {
     this.actualInstance = actualInstance;
     this.mergedConfigurationData = mergedConfigurationData;
     this.innerProperyDescriptor = innerProperyDescriptor;
     this.configurationHierarchy = configurationHierarchy;
 }
Ejemplo n.º 2
0
        EnvironmentMergeData ReadEnvironmentMergeData(EnvironmentMergeSection environmentSection, IConfigurationUIHierarchy configurationHierarchy)
        {
            EnvironmentMergeData mergeData = new EnvironmentMergeData();

            foreach (EnvironmentNodeMergeElement mergeElement in environmentSection.MergeElements)
            {
                ConfigurationNodeMergeData propertyDictionaty = new ConfigurationNodeMergeData();
                foreach (string key in mergeElement.OverriddenProperties.AllKeys)
                {
                    string overriddenValue = mergeElement.OverriddenProperties[key].Value;
                    propertyDictionaty.SetPropertyValue(key, new UnserializedPropertyValue(overriddenValue));
                }
                ConfigurationNodeMergeData configurationNodeMergeData = new ConfigurationNodeMergeData(mergeElement.OverrideProperties, propertyDictionaty);
                string            fullNodePath = configurationHierarchy.RootNode.Path + mergeElement.ConfigurationNodePath;
                ConfigurationNode node         = configurationHierarchy.FindNodeByPath(fullNodePath);
                if (node != null)
                {
                    mergeData.UpdateMergeData(node, configurationNodeMergeData);
                }
            }

            return(mergeData);
        }
        EnvironmentMergeData ReadEnvironmentMergeData(EnvironmentMergeSection environmentSection, IConfigurationUIHierarchy configurationHierarchy)
        {
            EnvironmentMergeData mergeData = new EnvironmentMergeData();

            foreach (EnvironmentNodeMergeElement mergeElement in environmentSection.MergeElements)
            {
                ConfigurationNodeMergeData propertyDictionaty = new ConfigurationNodeMergeData();
                foreach (string key in mergeElement.OverriddenProperties.AllKeys)
                {
                    string overriddenValue = mergeElement.OverriddenProperties[key].Value;
                    propertyDictionaty.SetPropertyValue(key, new UnserializedPropertyValue(overriddenValue));
                }
                ConfigurationNodeMergeData configurationNodeMergeData = new ConfigurationNodeMergeData(mergeElement.OverrideProperties, propertyDictionaty);
                string fullNodePath = configurationHierarchy.RootNode.Path + mergeElement.ConfigurationNodePath;
                ConfigurationNode node = configurationHierarchy.FindNodeByPath(fullNodePath);
                if (node != null)
                {
                    mergeData.UpdateMergeData(node, configurationNodeMergeData);
                }
            }

            return mergeData;
        }
Ejemplo n.º 4
0
 /// <summary>
 /// Updates the <see cref="ConfigurationNodeMergeData"/> for a specific instance of <see cref="ConfigurationNode"/>.
 /// </summary>
 /// <param name="configurationNode">The <see cref="ConfigurationNode"/> whose <see cref="ConfigurationNodeMergeData"/> should be updated.</param>
 /// <param name="mergeData">The <see cref="ConfigurationNodeMergeData"/> that apply on the given <see cref="ConfigurationNode"/>.</param>
 public void UpdateMergeData(ConfigurationNode configurationNode, ConfigurationNodeMergeData mergeData)
 {
     mergeDataDictionary[configurationNode.Id] = mergeData;
 }
Ejemplo n.º 5
0
        public MergedConfigurationNode GetOverrides(ConfigurationNode node)
        {
            ConfigurationNodeMergeData mergeData = environmentData.GetMergeData(node);

            return(new MergedConfigurationNode(node, mergeData));
        }
Ejemplo n.º 6
0
 /// <summary>
 /// Initialized a new instance of <see cref="MergedConfigurationNode"/>, given a <see cref="ConfigurationNode"/> instance and
 /// an <see cref="ConfigurationNodeMergeData"/> instance.
 /// </summary>
 /// <param name="masterConfigurationNode">The <see cref="ConfigurationNode"/> instance this <see cref="MergedConfigurationNode"/> should override the properties from.</param>
 /// <param name="mergedConfigurationNodeData">The <see cref="ConfigurationNodeMergeData"/> instance that contains all the overridden properties for the <paramref name="masterConfigurationNode"/>.</param>
 public MergedConfigurationNode(ConfigurationNode masterConfigurationNode, ConfigurationNodeMergeData mergedConfigurationNodeData)
 {
     this.masterConfigurationNode = masterConfigurationNode;
     this.mergeData = mergedConfigurationNodeData;
 }
Ejemplo n.º 7
0
 internal MergedConfigurationNode(ConfigurationNodeMergeData mergedConfigurationNodeData, MergedConfigurationNode mergedConfigurationNode)
     : this(mergedConfigurationNode.masterConfigurationNode, mergedConfigurationNodeData)
 {
 }
 /// <summary>
 /// Initialize an instance of <see cref="ConfigurationNodeMergeData"/>, specifying whether properties should be overridden and
 /// another instance of <see cref="ConfigurationNodeMergeData"/> of which the overridden properties are copied.
 /// </summary>
 /// <param name="overrideProperties"><see langword="true"/> if the properties in the original configuration node should be overridden, otherwise <see langword="false"/>.</param>
 /// <param name="mergeData">An other instance of <see cref="ConfigurationNodeMergeData"/> of which the overridden properties are copied.</param>
 public ConfigurationNodeMergeData(bool overrideProperties, ConfigurationNodeMergeData mergeData)
 {
     this.overrideProperties = overrideProperties;
     this.overriddenProperties = mergeData.overriddenProperties;
 }
		/// <summary>
		/// Converts an arbitrary instance of <see cref="System.Object"/> to an instance of <see cref="MergedConfigurationNode"/>.
		/// </summary>
		/// <param name="context">An <see cref="ITypeDescriptorContext"/> that provides a format context.</param>
		/// <param name="culture">A <see cref="System.Globalization.CultureInfo"/>. If <see langword="null"/> is passed, the current culture is assumed.</param>
		/// <param name="value">The instance of <see cref="System.Object"/> that should be used for conversion.</param>
		/// <returns>If conversion succeeds, an instance of <see cref="MergedConfigurationNode"/>, otherwise <see langword="null"/>.</returns>
		public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
		{
			if (value != null)
			{
				string overrideString = value.ToString();
				MergedConfigurationNode oldMergedConfigurationNode = context.PropertyDescriptor.GetValue(context.Instance) as MergedConfigurationNode;
				ConfigurationNodeMergeData oldMergeData = oldMergedConfigurationNode.MergeData;

				bool overrideProperties = (overrideString == Resources.OverrideProperties);

				ConfigurationNodeMergeData newMergeData = new ConfigurationNodeMergeData(overrideProperties, oldMergeData);
				return new MergedConfigurationNode(newMergeData, oldMergedConfigurationNode);
			}
			return base.ConvertFrom(context, culture, value);

		}
 /// <summary>
 /// Initialized a new instance of <see cref="MergedConfigurationNode"/>, given a <see cref="ConfigurationNode"/> instance and 
 /// an <see cref="ConfigurationNodeMergeData"/> instance.
 /// </summary>
 /// <param name="masterConfigurationNode">The <see cref="ConfigurationNode"/> instance this <see cref="MergedConfigurationNode"/> should override the properties from.</param>
 /// <param name="mergedConfigurationNodeData">The <see cref="ConfigurationNodeMergeData"/> instance that contains all the overridden properties for the <paramref name="masterConfigurationNode"/>.</param>
 public MergedConfigurationNode(ConfigurationNode masterConfigurationNode, ConfigurationNodeMergeData mergedConfigurationNodeData)
 {
     this.masterConfigurationNode = masterConfigurationNode;
     this.mergeData = mergedConfigurationNodeData;   
 }
 internal MergedConfigurationNode(ConfigurationNodeMergeData mergedConfigurationNodeData, MergedConfigurationNode mergedConfigurationNode)
     : this(mergedConfigurationNode.masterConfigurationNode, mergedConfigurationNodeData)
 {
 }
Ejemplo n.º 12
0
 /// <summary>
 /// Initialize an instance of <see cref="ConfigurationNodeMergeData"/>, specifying whether properties should be overridden and
 /// another instance of <see cref="ConfigurationNodeMergeData"/> of which the overridden properties are copied.
 /// </summary>
 /// <param name="overrideProperties"><see langword="true"/> if the properties in the original configuration node should be overridden, otherwise <see langword="false"/>.</param>
 /// <param name="mergeData">An other instance of <see cref="ConfigurationNodeMergeData"/> of which the overridden properties are copied.</param>
 public ConfigurationNodeMergeData(bool overrideProperties, ConfigurationNodeMergeData mergeData)
 {
     this.overrideProperties   = overrideProperties;
     this.overriddenProperties = mergeData.overriddenProperties;
 }