Exemplo n.º 1
0
        internal void InternalUnMerge(ConfigurationElement sourceElement, ConfigurationElement parentElement, ConfigurationSaveMode saveMode)
        {
            this.Unmerge(sourceElement, parentElement, saveMode);
            base.BaseClear();
            ProfileGroupSettingsCollection settingss  = sourceElement as ProfileGroupSettingsCollection;
            ProfileGroupSettingsCollection settingss2 = parentElement as ProfileGroupSettingsCollection;

            foreach (ProfileGroupSettings settings in settingss)
            {
                ProfileGroupSettings settings2 = settingss2.Get(settings.Name);
                ProfileGroupSettings element   = new ProfileGroupSettings();
                element.InternalUnmerge(settings, settings2, saveMode);
                this.BaseAdd(element);
            }
        }
        internal void InternalUnMerge(ConfigurationElement sourceElement, ConfigurationElement parentElement,
                                      ConfigurationSaveMode saveMode)
        {
            // This requires a special unmerge because it should not act like an element in a collection
            // which is the default behavior
            Unmerge(sourceElement, parentElement, saveMode); // Base merge to get locks merged
            BaseClear();                                     // don't use the merged data however

            ProfileGroupSettingsCollection source = sourceElement as ProfileGroupSettingsCollection;
            ProfileGroupSettingsCollection parent = parentElement as ProfileGroupSettingsCollection;

            // foreach group in the source we should unmerge the individual settings.
            foreach (ProfileGroupSettings settings in source)
            {
                ProfileGroupSettings settingsFromParent = parent.Get(settings.Name);
                ProfileGroupSettings deltaSettings      = new ProfileGroupSettings();

                deltaSettings.InternalUnmerge(settings, settingsFromParent, saveMode);
                BaseAdd(deltaSettings);
            }
        }
 protected override bool OnDeserializeUnrecognizedElement(string elementName, XmlReader reader)
 {
     if (elementName == "group")
     {
         ProfileGroupSettings parentSettings = null;
         string attribute = reader.GetAttribute("name");
         ProfileGroupSettingsCollection groupSettings = this.GroupSettings;
         if (attribute != null)
         {
             parentSettings = groupSettings[attribute];
         }
         ProfileGroupSettings settings = new ProfileGroupSettings();
         settings.InternalReset(parentSettings);
         settings.InternalDeserialize(reader, false);
         groupSettings.AddOrReplace(settings);
         return(true);
     }
     if (elementName == "clear")
     {
         this.GroupSettings.Clear();
     }
     return(base.OnDeserializeUnrecognizedElement(elementName, reader));
 }
		public RootProfilePropertySettingsCollection ()
		{
			groupSettings = new ProfileGroupSettingsCollection ();
		}		
 public RootProfilePropertySettingsCollection()
 {
     groupSettings = new ProfileGroupSettingsCollection();
 }