mirror of
https://github.com/BepInEx/mono.git
synced 2026-11-17 11:21:39 -10:00
* Makefile: Build System.dll in two steps. Because of the circular
dependency with System.XML.dll.
svn path=/trunk/mcs/; revision=22761
71 lines
1.9 KiB
C#
71 lines
1.9 KiB
C#
//
|
|
// System.Net.Configuration.WebRequestModuleHandler
|
|
//
|
|
// Authors:
|
|
// Gonzalo Paniagua Javier ([email protected])
|
|
//
|
|
// (C) 2003 Ximian, Inc (http://www.ximian.com)
|
|
//
|
|
|
|
using System.Collections;
|
|
using System.Configuration;
|
|
#if (XML_DEP)
|
|
using System.Xml;
|
|
#endif
|
|
|
|
namespace System.Net.Configuration
|
|
{
|
|
class WebRequestModuleHandler : IConfigurationSectionHandler
|
|
{
|
|
#if (XML_DEP)
|
|
public virtual object Create (object parent, object configContext, XmlNode section)
|
|
{
|
|
if (section.Attributes != null && section.Attributes.Count != 0)
|
|
HandlersUtil.ThrowException ("Unrecognized attribute", section);
|
|
|
|
XmlNodeList reqHandlers = section.ChildNodes;
|
|
foreach (XmlNode child in reqHandlers) {
|
|
XmlNodeType ntype = child.NodeType;
|
|
if (ntype == XmlNodeType.Whitespace || ntype == XmlNodeType.Comment)
|
|
continue;
|
|
|
|
if (ntype != XmlNodeType.Element)
|
|
HandlersUtil.ThrowException ("Only elements allowed", child);
|
|
|
|
string name = child.Name;
|
|
if (name == "clear") {
|
|
if (child.Attributes != null && child.Attributes.Count != 0)
|
|
HandlersUtil.ThrowException ("Unrecognized attribute", child);
|
|
|
|
WebRequest.ClearPrefixes ();
|
|
continue;
|
|
}
|
|
|
|
string prefix = HandlersUtil.ExtractAttributeValue ("prefix", child);
|
|
if (name == "add") {
|
|
string type = HandlersUtil.ExtractAttributeValue ("type", child, false);
|
|
if (child.Attributes != null && child.Attributes.Count != 0)
|
|
HandlersUtil.ThrowException ("Unrecognized attribute", child);
|
|
|
|
WebRequest.AddPrefix (prefix, type);
|
|
continue;
|
|
}
|
|
|
|
if (name == "remove") {
|
|
if (child.Attributes != null && child.Attributes.Count != 0)
|
|
HandlersUtil.ThrowException ("Unrecognized attribute", child);
|
|
|
|
WebRequest.RemovePrefix (prefix);
|
|
continue;
|
|
}
|
|
|
|
HandlersUtil.ThrowException ("Unexpected element", child);
|
|
}
|
|
|
|
return null;
|
|
}
|
|
#endif
|
|
}
|
|
}
|
|
|