Esempio n. 1
0
        BasicHttpBindingConfiguration ReadBasicHttpBinding(XmlReader reader)
        {
            string a;
            var    b = new BasicHttpBindingConfiguration();

            if ((a = reader.GetAttribute("name")) != null)
            {
                b.Name = a;
            }
            if ((a = reader.GetAttribute("maxBufferPoolSize")) != null)
            {
                b.MaxBufferPoolSize = XmlConvert.ToInt32(a);
            }
            if ((a = reader.GetAttribute("maxBufferSize")) != null)
            {
                b.MaxBufferSize = XmlConvert.ToInt32(a);
            }
            if ((a = reader.GetAttribute("maxReceivedMessageSize")) != null)
            {
                b.MaxReceivedMessageSize = XmlConvert.ToInt32(a);
            }
            if ((a = reader.GetAttribute("textEncoding")) != null)
            {
                b.TextEncoding = Encoding.GetEncoding(a);
            }

            if (!reader.IsEmptyElement)
            {
                reader.ReadStartElement();
                for (reader.MoveToContent(); reader.NodeType != XmlNodeType.EndElement; reader.MoveToContent())
                {
                    if (reader.NodeType != XmlNodeType.Element ||
                        reader.LocalName != "security" ||
                        reader.IsEmptyElement)
                    {
                        reader.Skip();
                        continue;
                    }
                    if ((a = reader.GetAttribute("mode")) != null)
                    {
                        b.Security.Mode = (BasicHttpSecurityMode)Enum.Parse(typeof(BasicHttpSecurityMode), a, false);
                    }
                    reader.Skip();
                }
                reader.ReadEndElement();
            }
            else
            {
                reader.Read();
            }

            return(b);
        }
		BasicHttpBindingConfiguration ReadBasicHttpBinding (XmlReader reader)
		{
			string a;
			var b = new BasicHttpBindingConfiguration ();
			
			if ((a = reader.GetAttribute ("name")) != null)
				b.Name = a;
			if ((a = reader.GetAttribute ("maxBufferPoolSize")) != null)
				b.MaxBufferPoolSize = XmlConvert.ToInt32 (a);
			if ((a = reader.GetAttribute ("maxBufferSize")) != null)
				b.MaxBufferSize = XmlConvert.ToInt32 (a);
			if ((a = reader.GetAttribute ("maxReceivedMessageSize")) != null)
				b.MaxReceivedMessageSize = XmlConvert.ToInt32 (a);
			if ((a = reader.GetAttribute ("textEncoding")) != null)
				b.TextEncoding = Encoding.GetEncoding (a);

			if (!reader.IsEmptyElement) {
				reader.ReadStartElement ();
				for (reader.MoveToContent (); reader.NodeType != XmlNodeType.EndElement; reader.MoveToContent ()) {
					if (reader.NodeType != XmlNodeType.Element ||
					    reader.LocalName != "security") {
						reader.Skip ();
						continue;
					}
					if ((a = reader.GetAttribute ("mode")) != null)
						b.Security.Mode = (BasicHttpSecurityMode) Enum.Parse (typeof (BasicHttpSecurityMode), a, false);
					reader.Skip ();
				}
				reader.ReadEndElement ();
			}
			else
				reader.Read ();
			
			return b;
		}