System.Configuration.ConfigurationData.ReadSection C# (CSharp) Метод

ReadSection() приватный Метод

private ReadSection ( XmlTextReader reader, string sectionName ) : void
reader System.Xml.XmlTextReader
sectionName string
Результат void
		private void ReadSection (XmlTextReader reader, string sectionName)
		{
			string attName;
			string nameValue = null;
			string typeValue = null;
			string allowLoc = null, allowDef = null;
			bool requirePermission = false;
			string requirePer = null;
			bool allowLocation = true;
			AllowDefinition allowDefinition = AllowDefinition.Everywhere;

			while (reader.MoveToNextAttribute ()) {
				attName = reader.Name;
				if (attName == null)
					continue;

				if (attName == "allowLocation") {
					if (allowLoc != null)
						ThrowException ("Duplicated allowLocation attribute.", reader);

					allowLoc = reader.Value;
					allowLocation = (allowLoc == "true");
					if (!allowLocation && allowLoc != "false")
						ThrowException ("Invalid attribute value", reader);

					continue;
				}

				if (attName == "requirePermission") {
					if (requirePer != null)
						ThrowException ("Duplicated requirePermission attribute.", reader);
					requirePer = reader.Value;
					requirePermission = (requirePer == "true");
					if (!requirePermission && requirePer != "false")
						ThrowException ("Invalid attribute value", reader);
					continue;
				}

				if (attName == "allowDefinition") {
					if (allowDef != null)
						ThrowException ("Duplicated allowDefinition attribute.", reader);

					allowDef = reader.Value;
					try {
						allowDefinition = (AllowDefinition) Enum.Parse (
								   typeof (AllowDefinition), allowDef);
					} catch {
						ThrowException ("Invalid attribute value", reader);
					}

					continue;
				}

				if (attName == "type")  {
					if (typeValue != null)
						ThrowException ("Duplicated type attribute.", reader);
					typeValue = reader.Value;
					continue;
				}
				
				if (attName == "name")  {
					if (nameValue != null)
						ThrowException ("Duplicated name attribute.", reader);
					nameValue = reader.Value;
					if (nameValue == "location")
						ThrowException ("location is a reserved section name", reader);
					continue;
				}

				ThrowException ("Unrecognized attribute.", reader);
			}

			if (nameValue == null || typeValue == null)
				ThrowException ("Required attribute missing", reader);

			if (sectionName != null)
				nameValue = sectionName + '/' + nameValue;

			reader.MoveToElement();
			object o = LookForFactory (nameValue);
			if (o != null && o != removedMark)
				ThrowException ("Already have a factory for " + nameValue, reader);
			SectionData section = new SectionData (nameValue, typeValue, allowLocation,
				allowDefinition, requirePermission);
			section.FileName = fileName;
			factories [nameValue] = section;

			if (reader.IsEmptyElement)
				reader.Skip ();
			else {
				reader.Read ();
				reader.MoveToContent ();
				if (reader.NodeType != XmlNodeType.EndElement)
					// sub-section inside a section
					ReadSections (reader, nameValue);
				reader.ReadEndElement ();
			}
			reader.MoveToContent ();
		}