protected override bool OnDeserializeUnrecognizedElement(String elementName, XmlReader reader) {
            bool handled = false;

            // Deal with the "group" element
            if (elementName == "group") {
                ProfileGroupSettingsCollection groupCollection;
                ProfileGroupSettings newGroupSettings;
                ProfileGroupSettings curGroupSettings = null;
                string name = reader.GetAttribute("name");

                groupCollection = GroupSettings;

                if (name != null) {
                    curGroupSettings = groupCollection[name];
                }

                newGroupSettings = new ProfileGroupSettings();
                newGroupSettings.InternalReset(curGroupSettings);
                newGroupSettings.InternalDeserialize(reader, false);

                groupCollection.AddOrReplace(newGroupSettings);

                handled = true;
            }
            else {
                if (elementName == "clear") {
                    GroupSettings.Clear();
                }

                // Let the base class deal with "add, remove, clear"
                handled = base.OnDeserializeUnrecognizedElement(elementName, reader);
            }

            return handled;
        }
コード例 #2
0
        // LAMESPEC: this is missing from MSDN but is present in 2.0sp1 version of the
        // class.
        protected override bool OnDeserializeUnrecognizedElement(string elementName, XmlReader reader)
        {
            if (elementName == "group")
            {
                ProfileGroupSettings newSettings = new ProfileGroupSettings();
                newSettings.DoDeserialize(reader);
                GroupSettings.AddNewSettings(newSettings);

                return(true);
            }

            return(base.OnDeserializeUnrecognizedElement(elementName, reader));
        }
コード例 #3
0
        public void Set(ProfileGroupSettings group)
        {
            ProfileGroupSettings existing = Get(group.Name);

            if (existing == null)
            {
                Add(group);
            }
            else
            {
                int index = BaseIndexOf(existing);
                RemoveAt(index);
                BaseAdd(index, group);
            }
        }
コード例 #4
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);
            }
        }
コード例 #5
0
        public override bool Equals(object obj)
        {
            ProfileGroupSettings other = obj as ProfileGroupSettings;

            if (other == null)
            {
                return(false);
            }

            if (GetType() != other.GetType())
            {
                return(false);
            }

            return(Name.Equals(other.Name));
        }
        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)
        {
            bool handled = false;

            // Deal with the "group" element
            if (elementName == "group")
            {
                ProfileGroupSettingsCollection groupCollection;
                ProfileGroupSettings           newGroupSettings;
                ProfileGroupSettings           curGroupSettings = null;
                string name = reader.GetAttribute("name");

                groupCollection = GroupSettings;

                if (name != null)
                {
                    curGroupSettings = groupCollection[name];
                }

                newGroupSettings = new ProfileGroupSettings();
                newGroupSettings.InternalReset(curGroupSettings);
                newGroupSettings.InternalDeserialize(reader, false);

                groupCollection.AddOrReplace(newGroupSettings);

                handled = true;
            }
            else
            {
                if (elementName == "clear")
                {
                    GroupSettings.Clear();
                }

                // Let the base class deal with "add, remove, clear"
                handled = base.OnDeserializeUnrecognizedElement(elementName, reader);
            }

            return(handled);
        }
 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);
 }
 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 void Add(ProfileGroupSettings group)
 {
 }
コード例 #11
0
ファイル: ProfileBase.cs プロジェクト: Profit0004/mono
		static SettingsProperty CreateSettingsProperty (ProfileGroupSettings pgs, ProfilePropertySettings pps)
		{
			string name = ((pgs == null) ? String.Empty : pgs.Name + ".") + pps.Name;
			SettingsProperty sp = new SettingsProperty (name);

			sp.Attributes.Add ("AllowAnonymous", pps.AllowAnonymous);
			sp.DefaultValue = pps.DefaultValue;
			sp.IsReadOnly = pps.ReadOnly;
			sp.Provider = ProfileManager.Provider;
			sp.ThrowOnErrorDeserializing = false;
			sp.ThrowOnErrorSerializing = true;

			if (pps.Type.Length == 0 || pps.Type == "string")
				sp.PropertyType = typeof (string);
			else
				sp.PropertyType = GetPropertyType (pgs, pps);

			switch (pps.SerializeAs) {
				case SerializationMode.Binary:
					sp.SerializeAs = SettingsSerializeAs.Binary;
					break;
				case SerializationMode.ProviderSpecific:
					sp.SerializeAs = SettingsSerializeAs.ProviderSpecific;
					break;
				case SerializationMode.String:
					sp.SerializeAs = SettingsSerializeAs.String;
					break;
				case SerializationMode.Xml:
					sp.SerializeAs = SettingsSerializeAs.Xml;
					break;
			}

			return sp;
		}
コード例 #12
0
        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);
            }
            
        }
コード例 #13
0
		// LAMESPEC: this is missing from MSDN but is present in 2.0sp1 version of the
		// class.
		protected override bool OnDeserializeUnrecognizedElement (string elementName, XmlReader reader)
		{
			if (elementName == "group") {
				ProfileGroupSettings newSettings = new ProfileGroupSettings ();
				newSettings.DoDeserialize (reader);
				GroupSettings.AddNewSettings (newSettings);
				
				return true;
			}
			
			return base.OnDeserializeUnrecognizedElement (elementName, reader);
		}
コード例 #14
0
 // public methods
 public void Add(ProfileGroupSettings group) {
     BaseAdd(group);
 }
コード例 #15
0
 public int IndexOf(ProfileGroupSettings group) {
     return BaseIndexOf(group);
 }
 public void Set(ProfileGroupSettings group)
 {
 }
コード例 #17
0
 internal void AddNewSettings(ProfileGroupSettings newSettings)
 {
     // allow overriding - no exception should be thrown
     BaseAdd(newSettings, false);
 }
コード例 #18
0
        public override bool Equals(object obj)
        {
            ProfileGroupSettings settings = obj as ProfileGroupSettings;

            return(((settings != null) && (this.Name == settings.Name)) && object.Equals(this.PropertySettings, settings.PropertySettings));
        }
コード例 #19
0
 internal void InternalReset(ProfileGroupSettings parentSettings)
 {
     base.Reset(parentSettings);
 }
 public void Add(ProfileGroupSettings group)
 {
 }
 public int IndexOf(ProfileGroupSettings group)
 {
     return(default(int));
 }
 public int IndexOf(ProfileGroupSettings group)
 {
   return default(int);
 }
コード例 #23
0
 public int IndexOf(ProfileGroupSettings group)
 {
     return(BaseIndexOf(group));
 }
コード例 #24
0
 internal void InternalReset(ProfileGroupSettings parentSettings) {
     base.Reset(parentSettings);
 }
コード例 #25
0
ファイル: Register.aspx.cs プロジェクト: husseinmuhammadi/DSA
        void f1()
        {
            // Process the System.Web.Configuration.ProfileSectionobject.
            try
            {
                // Get the Web application configuration.
                System.Configuration.Configuration configuration =
                    System.Web.Configuration.WebConfigurationManager.OpenWebConfiguration("/aspnet");

                // Get the section.
                System.Web.Configuration.ProfileSection profileSection =
                    (System.Web.Configuration.ProfileSection)
                    configuration.GetSection("system.web/profile");

                // Get the current AutomaticSaveEnabled property value.
                Console.WriteLine(
                    "Current AutomaticSaveEnabled value: '{0}'", profileSection.AutomaticSaveEnabled);

                // Set the AutomaticSaveEnabled property to false.
                profileSection.AutomaticSaveEnabled = false;

                // Get the current DefaultProvider property value.
                Console.WriteLine(
                    "Current DefaultProvider value: '{0}'", profileSection.DefaultProvider);

                // Set the DefaultProvider property to "AspNetSqlProvider".
                profileSection.DefaultProvider = "AspNetSqlProvider";

                // Get the current Inherits property value.
                Console.WriteLine(
                    "Current Inherits value: '{0}'", profileSection.Inherits);

                // Set the Inherits property to
                // "CustomProfiles.MyCustomProfile, CustomProfiles.dll".
                profileSection.Inherits = "CustomProfiles.MyCustomProfile, CustomProfiles.dll";

                // Display all current root ProfilePropertySettings.
                Console.WriteLine("Current Root ProfilePropertySettings:");
                int rootPPSCtr = 0;
                foreach (ProfilePropertySettings rootPPS in profileSection.PropertySettings)
                {
                    Console.WriteLine("  {0}: ProfilePropertySetting '{1}'", ++rootPPSCtr,
                        rootPPS.Name);
                }

                // Get and modify a root ProfilePropertySettings object.
                Console.WriteLine(
                    "Display and modify 'LastReadDate' ProfilePropertySettings:");
                ProfilePropertySettings profilePropertySettings =
                    profileSection.PropertySettings["LastReadDate"];

                // Get the current ReadOnly property value.
                Console.WriteLine(
                    "Current ReadOnly value: '{0}'", profilePropertySettings.ReadOnly);

                // Set the ReadOnly property to true.
                profilePropertySettings.ReadOnly = true;

                // Get the current AllowAnonymous property value.
                Console.WriteLine(
                    "Current AllowAnonymous value: '{0}'", profilePropertySettings.AllowAnonymous);

                // Set the AllowAnonymous property to true.
                profilePropertySettings.AllowAnonymous = true;

                // Get the current SerializeAs property value.
                Console.WriteLine(
                    "Current SerializeAs value: '{0}'", profilePropertySettings.SerializeAs);

                // Set the SerializeAs property to SerializationMode.Binary.
                profilePropertySettings.SerializeAs = SerializationMode.Binary;

                // Get the current Type property value.
                Console.WriteLine(
                    "Current Type value: '{0}'", profilePropertySettings.Type);

                // Set the Type property to "System.DateTime".
                profilePropertySettings.Type = "System.DateTime";

                // Get the current DefaultValue property value.
                Console.WriteLine(
                    "Current DefaultValue value: '{0}'", profilePropertySettings.DefaultValue);

                // Set the DefaultValue property to "March 16, 2004".
                profilePropertySettings.DefaultValue = "March 16, 2004";

                // Get the current ProviderName property value.
                Console.WriteLine(
                    "Current ProviderName value: '{0}'", profilePropertySettings.Provider);

                // Set the ProviderName property to "AspNetSqlRoleProvider".
                profilePropertySettings.Provider = "AspNetSqlRoleProvider";

                // Get the current Name property value.
                Console.WriteLine(
                    "Current Name value: '{0}'", profilePropertySettings.Name);

                // Set the Name property to "LastAccessDate".
                profilePropertySettings.Name = "LastAccessDate";

                // Display all current ProfileGroupSettings.
                Console.WriteLine("Current ProfileGroupSettings:");
                int PGSCtr = 0;
                foreach (ProfileGroupSettings propGroups in profileSection.PropertySettings.GroupSettings)
                {
                    Console.WriteLine("  {0}: ProfileGroupSetting '{1}'", ++PGSCtr,
                        propGroups.Name);
                    int PPSCtr = 0;
                    foreach (ProfilePropertySettings props in propGroups.PropertySettings)
                    {
                        Console.WriteLine("    {0}: ProfilePropertySetting '{1}'", ++PPSCtr,
                            props.Name);
                    }
                }

                // Add a new group.
                ProfileGroupSettings newPropGroup = new ProfileGroupSettings("Forum");
                profileSection.PropertySettings.GroupSettings.Add(newPropGroup);

                // Add a new PropertySettings to the group.
                ProfilePropertySettings newProp = new ProfilePropertySettings("AvatarImage");
                newProp.Type = "System.String, System.dll";
                newPropGroup.PropertySettings.Add(newProp);

                // Remove a PropertySettings from the group.
                newPropGroup.PropertySettings.Remove("AvatarImage");
                newPropGroup.PropertySettings.RemoveAt(0);

                // Clear all PropertySettings from the group.
                newPropGroup.PropertySettings.Clear();

                // Display all current Providers.
                Console.WriteLine("Current Providers:");
                int providerCtr = 0;
                foreach (ProviderSettings provider in profileSection.Providers)
                {
                    Console.WriteLine("  {0}: Provider '{1}' of type '{2}'", ++providerCtr,
                        provider.Name, provider.Type);
                }

                // Add a new provider.
                profileSection.Providers.Add(new ProviderSettings("AspNetSqlProvider", "...SqlProfileProvider"));

                // Get the current Enabled property value.
                Console.WriteLine(
                    "Current Enabled value: '{0}'", profileSection.Enabled);

                // Set the Enabled property to false.
                profileSection.Enabled = false;

                // Update if not locked.
                if (!profileSection.SectionInformation.IsLocked)
                {
                    configuration.Save();
                    Console.WriteLine("** Configuration updated.");
                }
                else
                    Console.WriteLine("** Could not update, section is locked.");
            }
            catch (System.ArgumentException e)
            {
                // Unknown error.
                Console.WriteLine("A invalid argument exception detected in UsingProfileSection Main. Check your");
                Console.WriteLine("command line for errors.");
            }
        }
コード例 #26
0
		public void Set (ProfileGroupSettings group)
		{
			ProfileGroupSettings existing = Get (group.Name);

			if (existing == null) {
				Add (group);
			}
			else {
				int index = BaseIndexOf (existing);
				RemoveAt (index);
				BaseAdd (index, group);
			}
		}
コード例 #27
0
 public void Add(ProfileGroupSettings group)
 {
     BaseAdd(group);
 }
コード例 #28
0
 public void Set(ProfileGroupSettings group)
 {
     base.BaseAdd(group, false);
 }
コード例 #29
0
 public void Set(ProfileGroupSettings group) {
     BaseAdd(group, false);
 }
コード例 #30
0
 internal void AddOrReplace(ProfileGroupSettings groupSettings)
 {
     base.BaseAdd(groupSettings, false);
 }
コード例 #31
0
 internal void AddOrReplace(ProfileGroupSettings groupSettings) {
     BaseAdd(groupSettings, false);
 }
 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);
     }
 }
コード例 #33
0
		internal void AddNewSettings (ProfileGroupSettings newSettings)
		{
			// allow overriding - no exception should be thrown
			BaseAdd (newSettings, false);
		}
コード例 #34
0
ファイル: ProfileBase.cs プロジェクト: Profit0004/mono
		static Type GetPropertyType (ProfileGroupSettings pgs, ProfilePropertySettings pps)
		{
			Type type = HttpApplication.LoadType (pps.Type);
			if (type != null)
				return type;

			Type profileType = null;
			if (pgs == null)
				profileType = ProfileParser.GetProfileCommonType (HttpContext.Current);
			else
				profileType = ProfileParser.GetProfileGroupType (HttpContext.Current, pgs.Name);

			if (profileType == null)
				return null;

			PropertyInfo pi = profileType.GetProperty (pps.Name);
			if (pi != null)
				return pi.PropertyType;

			return null;
		}
コード例 #35
0
        public override bool Equals(object obj)
        {
            ProfileGroupSettings o = obj as ProfileGroupSettings;

            return(o != null && Name == o.Name && Object.Equals(PropertySettings, o.PropertySettings));
        }
 public void Set(ProfileGroupSettings group)
 {
 }