internal ZimbraBinding() : base(BasicHttpsSecurityMode.Transport) { try { configuration = (ZimbraConfigurationSection)ConfigurationManager.GetSection("Zimbra/Configuration"); } catch { }; if (configuration != null) { Type tbindingElement = configuration.Binding.GetType(); Type tbinding = this.GetType(); foreach (PropertyInfo propertyInfo in tbinding.GetProperties()) { PropertyInfo elementPropertyInfo = tbindingElement.GetProperty(propertyInfo.Name); if (elementPropertyInfo != null) { object value = elementPropertyInfo.GetValue(configuration.Binding); if (value != null) { propertyInfo.SetValue(this, Convert.ChangeType(value, propertyInfo.PropertyType), null); } } } } else { MaxReceivedMessageSize = (base.MaxReceivedMessageSize * 4); } //string name //AllowCookies = true; //base.MaxBufferPoolSize //base.MaxBufferSize //base.MaxReceivedMessageSize //base.MessageEncoding //base.Name //base.Namespace //base.OpenTimeout //base.ReaderQuotas //base.ReceiveTimeout //base.Scheme //base.SendTimeout //base.TextEncoding = Encoding.UTF8; //base.TransferMode }
public object Create(object parent, object configContext, System.Xml.XmlNode section) { ZimbraConfigurationSection config = new ZimbraConfigurationSection(); if (section.HasChildNodes) { XmlNode binding = section.SelectSingleNode("//Binding"); XmlNode server = section.SelectSingleNode("//Server"); if (binding != null) { XmlAttributeCollection bindingAttributes = binding.Attributes; if (bindingAttributes != null && bindingAttributes.Count > 0) { Type tbinding = config.Binding.GetType(); foreach (XmlAttribute attribute in bindingAttributes) { PropertyInfo propertyInfo = tbinding.GetProperty(attribute.Name); if (propertyInfo != null) { propertyInfo.SetValue(config.Binding, Convert.ChangeType(attribute.Value, propertyInfo.PropertyType), null); } //string name = attribute.Name; //string value = attribute.Value; } } } if (server != null) { XmlAttributeCollection serverAttributes = server.Attributes; if (serverAttributes != null && serverAttributes.Count > 0) { Type tserver = config.Server.GetType(); foreach (XmlAttribute attribute in serverAttributes) { PropertyInfo propertyInfo = tserver.GetProperty(attribute.Name); if (propertyInfo != null) { propertyInfo.SetValue(config.Server, Convert.ChangeType(attribute.Value, propertyInfo.PropertyType), null); } //string name = attribute.Name; //string value = attribute.Value; } } } } if (config != null) { return(config); } else { return(null); } }