// // Create // // Given a partially composed config object (possibly null) // and some input from the config system, return a // further partially composed config object // public override object Create(Object parent, Object configContext, XmlNode section) { // start res off as a shallow clone of the parent Create(parent); // process XML foreach (XmlNode child in section.ChildNodes) { // skip whitespace and comments if (HandlerBase.IsIgnorableAlsoCheckForNonElement(child)) { continue; } // reject nonelements HandlerBase.CheckForNonElement(child); string listName = child.Name; bool result = false; string attribute; if (listName == "proxy") { // read usersystemdefault="true/false" attribute = HandlerBase.RemoveAttribute(child, "usesystemdefault"); // // If an earlier config entry specified a usersystemdefault, // that meant that we would pick up our config settings // from IE. If someone later on, wants to turn that off, // we need to recreate a blank WebProxy entry to override // the orginial IE settings // if (ReadBoolValue(attribute, ref result)) { if (result) { m_IWebProxy = ProxyRegBlob.GetIEProxy(); } else { m_IWebProxy = new WebProxy(); } } WebProxy webProxy = m_IWebProxy as System.Net.WebProxy; if (webProxy != null) { // read bypassonlocal="true/false" attribute = HandlerBase.RemoveAttribute(child, "bypassonlocal"); if (ReadBoolValue(attribute, ref result)) { webProxy.BypassProxyOnLocal = result; } // read proxyaddress="http://sampleproxy" attribute = HandlerBase.RemoveAttribute(child, "proxyaddress"); if (attribute != null) { try { webProxy.Address = new Uri(attribute); } catch (Exception) {} } } } else if (listName == "bypasslist") { if (IsNormalWebProxy(m_IWebProxy)) { WalkXmlNodeList(child); } } else if (listName == "module") { WebProxy webProxy = m_IWebProxy as System.Net.WebProxy; attribute = HandlerBase.RemoveAttribute(child, "type"); if (ReadModuleType(attribute, ref m_IWebProxy)) { WebProxy webProxyNew = m_IWebProxy as System.Net.WebProxy; if (webProxy != null && webProxyNew != null) { webProxyNew.Address = webProxy.Address; webProxyNew.BypassProxyOnLocal = webProxy.BypassProxyOnLocal; webProxyNew.BypassList = webProxy.BypassList; } } } } return(Get()); }