Exemple #1
0
 private bool TryCreateMatchingExtension(BindingElement bindingElement, ExtensionElementCollection collection, bool allowDerivedTypes, string assemblyName, out BindingElementExtensionElement result)
 {
     result = null;
     foreach (ExtensionElement element in collection)
     {
         bool flag;
         BindingElementExtensionElement element2 = Activator.CreateInstance(System.Type.GetType(element.Type, true)) as BindingElementExtensionElement;
         if (element2 == null)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(System.ServiceModel.SR.GetString("ConfigInvalidExtensionType", new object[] { element.Type, assemblyName, "bindingElementExtensions" })));
         }
         if (allowDerivedTypes)
         {
             flag = element2.BindingElementType.IsAssignableFrom(bindingElement.GetType());
         }
         else
         {
             flag = element2.BindingElementType.Equals(bindingElement.GetType());
         }
         if (flag)
         {
             result = element2;
             return(true);
         }
     }
     return(false);
 }
        bool TryCreateMatchingExtension(BindingElement bindingElement, ExtensionElementCollection collection, bool allowDerivedTypes, string assemblyName, out BindingElementExtensionElement result)
        {
            result = null;
            foreach (ExtensionElement element in collection)
            {
                BindingElementExtensionElement bindingElementExtension = Activator.CreateInstance(Type.GetType(element.Type, true)) as BindingElementExtensionElement;
                if (null == bindingElementExtension)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(SR.GetString(SR.ConfigInvalidExtensionType,
                        element.Type,
                        assemblyName,
                        ConfigurationStrings.BindingElementExtensions)));
                }

                bool isMatch;
                if (allowDerivedTypes)
                {
                    isMatch = bindingElementExtension.BindingElementType.IsAssignableFrom(bindingElement.GetType());
                }
                else
                {
                    isMatch = bindingElementExtension.BindingElementType.Equals(bindingElement.GetType());
                }

                if (isMatch)
                {
                    result = bindingElementExtension;
                    return true;
                }
            }
            return false;
        }
 protected internal virtual void InitializeFrom(BindingElement bindingElement)
 {
     if (bindingElement == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("bindingElement");
     }
     if (bindingElement.GetType() != this.BindingElementType)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("bindingElement", System.ServiceModel.SR.GetString("ConfigInvalidTypeForBindingElement", new object[] { this.BindingElementType.ToString(), bindingElement.GetType().ToString() }));
     }
 }
Exemple #4
0
        protected override void InitializeFrom(BindingElement bindingElement)
        {
            base.InitializeFrom(bindingElement);

            if (bindingElement == null)
            {
                throw new ArgumentNullException("bindingElement");
            }

            var binding = bindingElement as QpidTransportBindingElement;

            if (binding == null)
            {
                throw new ArgumentException(
                          string.Format("Invalid type for binding. Expected {0}, Passed: {1}",
                                        typeof(QpidTransportBindingElement).AssemblyQualifiedName,
                                        bindingElement.GetType().AssemblyQualifiedName));
            }

            Host        = binding.Host;
            PortNumber  = binding.PortNumber;
            Password    = binding.Password;
            UserName    = binding.UserName;
            VirtualHost = binding.VirtualHost;
        }
 private bool TryCreateMatchingExtension(BindingElement bindingElement, ExtensionElementCollection collection, bool allowDerivedTypes, string assemblyName, out BindingElementExtensionElement result)
 {
     result = null;
     foreach (ExtensionElement element in collection)
     {
         bool flag;
         BindingElementExtensionElement element2 = Activator.CreateInstance(System.Type.GetType(element.Type, true)) as BindingElementExtensionElement;
         if (element2 == null)
         {
             throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(System.ServiceModel.SR.GetString("ConfigInvalidExtensionType", new object[] { element.Type, assemblyName, "bindingElementExtensions" })));
         }
         if (allowDerivedTypes)
         {
             flag = element2.BindingElementType.IsAssignableFrom(bindingElement.GetType());
         }
         else
         {
             flag = element2.BindingElementType.Equals(bindingElement.GetType());
         }
         if (flag)
         {
             result = element2;
             return true;
         }
     }
     return false;
 }
        bool TryCreateMatchingExtension(BindingElement bindingElement, ExtensionElementCollection collection, bool allowDerivedTypes, string assemblyName, out BindingElementExtensionElement result)
        {
            result = null;
            foreach (ExtensionElement element in collection)
            {
                BindingElementExtensionElement bindingElementExtension = Activator.CreateInstance(Type.GetType(element.Type, true)) as BindingElementExtensionElement;
                if (null == bindingElementExtension)
                {
                    throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new ConfigurationErrorsException(SR.GetString(SR.ConfigInvalidExtensionType,
                                                                                                                            element.Type,
                                                                                                                            assemblyName,
                                                                                                                            ConfigurationStrings.BindingElementExtensions)));
                }

                bool isMatch;
                if (allowDerivedTypes)
                {
                    isMatch = bindingElementExtension.BindingElementType.IsAssignableFrom(bindingElement.GetType());
                }
                else
                {
                    isMatch = bindingElementExtension.BindingElementType.Equals(bindingElement.GetType());
                }

                if (isMatch)
                {
                    result = bindingElementExtension;
                    return(true);
                }
            }
            return(false);
        }
        public override void ApplyConfiguration(BindingElement bindingElement)
        {
            base.ApplyConfiguration(bindingElement);
            if (bindingElement == null)
            {
                throw new ArgumentNullException("binding");
            }

            RabbitMQTransportBindingElement rabbind = bindingElement as RabbitMQTransportBindingElement;

            if (rabbind == null)
            {
                throw new ArgumentException(
                          string.Format("Invalid type for binding. Expected {0}, Passed: {1}",
                                        typeof(RabbitMQBinding).AssemblyQualifiedName,
                                        bindingElement.GetType().AssemblyQualifiedName));
            }

            rabbind.HostName                      = this.HostName;
            rabbind.Port                          = this.Port;
            rabbind.BrokerProtocol                = this.Protocol;
            rabbind.ConnectionFactory.Password    = this.Password;
            rabbind.ConnectionFactory.UserName    = this.Username;
            rabbind.ConnectionFactory.VirtualHost = this.VirtualHost;
        }
Exemple #8
0
        protected override void InitializeFrom(BindingElement bindingElement)
        {
            base.InitializeFrom(bindingElement);

            if (bindingElement == null)
            {
                throw new ArgumentNullException("bindingElement");
            }

            RabbitMQTransportBindingElement rabbind = bindingElement as RabbitMQTransportBindingElement;

            if (rabbind == null)
            {
                throw new ArgumentException(
                          string.Format("Invalid type for binding. Expected {0}, Passed: {1}",
                                        typeof(RabbitMQBinding).AssemblyQualifiedName,
                                        bindingElement.GetType().AssemblyQualifiedName));
            }

            PersistentDelivery = rabbind.PersistentDelivery;
            AutoBindExchange   = rabbind.AutoBindExchange;
            TTL             = rabbind.TTL;
            ProtocolVersion = rabbind.BrokerProtocol.ApiName;
            ReplyToQueue    = rabbind.ReplyToQueue;
            ReplyToExchange = rabbind.ReplyToExchange.ToString();
            OneWayOnly      = rabbind.OneWayOnly;
            MessageFormat   = rabbind.MessageFormat;
            ApplicationId   = rabbind.ApplicationId;
            HeaderNamespace = rabbind.HeaderNamespace;
        }
Exemple #9
0
        public override void ApplyConfiguration(BindingElement bindingElement)
        {
            base.ApplyConfiguration(bindingElement);
            if (bindingElement == null)
            {
                throw new ArgumentNullException("bindingElement");
            }

            RabbitMQTransportBindingElement rabbind = bindingElement as RabbitMQTransportBindingElement;

            if (rabbind == null)
            {
                throw new ArgumentException(
                          string.Format("Invalid type for binding. Expected {0}, Passed: {1}",
                                        typeof(RabbitMQBinding).AssemblyQualifiedName,
                                        bindingElement.GetType().AssemblyQualifiedName));
            }

            rabbind.PersistentDelivery = PersistentDelivery;
            rabbind.AutoBindExchange   = AutoBindExchange;
            rabbind.TTL                      = TTL;
            rabbind.AutoDelete               = AutoDelete;
            rabbind.BrokerProtocol           = Protocol;
            rabbind.TransactedReceiveEnabled = ExactlyOnce;
            rabbind.ReplyToQueue             = ReplyToQueue;
            rabbind.ReplyToExchange          = ReplyToExchange != null ? new Uri(ReplyToExchange) : null;
            rabbind.OneWayOnly               = OneWayOnly;
            rabbind.MessageFormat            = MessageFormat;
        }
Exemple #10
0
        private static bool IsBindingElementMatch(BindingElement elementThis, BindingElement elementThat)
        {
            Type type = elementThis.GetType();

            object[] objArray = new object[] { elementThat };
            return((bool)InvokeHelper.InvokeInstanceMethod(type, elementThis, "IsMatch", objArray));
        }
 protected internal virtual void InitializeFrom(BindingElement bindingElement)
 {
     if (bindingElement == null)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("bindingElement");
     }
     if (bindingElement.GetType() != this.BindingElementType)
     {
         throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgument("bindingElement", System.ServiceModel.SR.GetString("ConfigInvalidTypeForBindingElement", new object[] { this.BindingElementType.ToString(), bindingElement.GetType().ToString() }));
     }
 }
        public override void ApplyConfiguration(BindingElement bindingElement)
        {
            base.ApplyConfiguration(bindingElement);
            if (bindingElement == null)
                throw new ArgumentNullException("bindingElement");

            var bindind = bindingElement as QpidTransportBindingElement;
            if (bindind == null)
            {
                throw new ArgumentException(
                    string.Format("Invalid type for binding. Expected {0}, Passed: {1}",
                                  typeof(QpidTransportBindingElement).AssemblyQualifiedName,
                                  bindingElement.GetType().AssemblyQualifiedName));
            }

            bindind.Host = Host;
            bindind.Password = Password;
            bindind.UserName = UserName;
            bindind.VirtualHost = VirtualHost;
            bindind.PortNumber = PortNumber;
        }
        public override void ApplyConfiguration(BindingElement bindingElement)
        {
            base.ApplyConfiguration(bindingElement);
            if (bindingElement == null)
                throw new ArgumentNullException("binding");

            RabbitMQTransportBindingElement rabbind = bindingElement as RabbitMQTransportBindingElement;
            if (rabbind == null)
            {
                throw new ArgumentException(
                    string.Format("Invalid type for binding. Expected {0}, Passed: {1}",
                        typeof(RabbitMQBinding).AssemblyQualifiedName,
                        bindingElement.GetType().AssemblyQualifiedName));
            }

            rabbind.HostName = this.HostName;
            rabbind.Port = this.Port;
            rabbind.BrokerProtocol = this.Protocol;
            rabbind.ConnectionFactory.Password = this.Password;
            rabbind.ConnectionFactory.UserName = this.Username;
            rabbind.ConnectionFactory.VirtualHost = this.VirtualHost;
        }
Exemple #14
0
        public override void ApplyConfiguration(BindingElement bindingElement)
        {
            base.ApplyConfiguration(bindingElement);
            if (bindingElement == null)
            {
                throw new ArgumentNullException("bindingElement");
            }

            var bindind = bindingElement as QpidTransportBindingElement;

            if (bindind == null)
            {
                throw new ArgumentException(
                          string.Format("Invalid type for binding. Expected {0}, Passed: {1}",
                                        typeof(QpidTransportBindingElement).AssemblyQualifiedName,
                                        bindingElement.GetType().AssemblyQualifiedName));
            }

            bindind.Host        = Host;
            bindind.Password    = Password;
            bindind.UserName    = UserName;
            bindind.VirtualHost = VirtualHost;
            bindind.PortNumber  = PortNumber;
        }
        public override void ApplyConfiguration(BindingElement bindingElement)
        {
            base.ApplyConfiguration(bindingElement);
            if (bindingElement == null)
                throw new ArgumentNullException("binding");

            RabbitMQTransportBindingElement rabbind = bindingElement as RabbitMQTransportBindingElement;
            if (rabbind == null)
            {
                throw new ArgumentException(
                    string.Format("Invalid type for binding. Expected {0}, Passed: {1}",
                        typeof(RabbitMQBinding).AssemblyQualifiedName,
                        bindingElement.GetType().AssemblyQualifiedName));
            }

            rabbind.PersistentDelivery = this.PersistentDelivery;
            rabbind.AutoBindExchange = this.AutoBindExchange;
            rabbind.TTL = this.TTL;
            rabbind.BrokerProtocol = this.Protocol;
            rabbind.TransactedReceiveEnabled = this.ExactlyOnce;
            rabbind.ReplyToQueue = this.ReplyToQueue;
            rabbind.ReplyToExchange = this.ReplyToExchange != null ? new Uri(this.ReplyToExchange) : null;
            rabbind.OneWayOnly = this.OneWayOnly;
        }
        /// <summary>
        /// Returns an ordered collection of binding elements contained in the current binding.
        /// </summary>
        public override BindingElementCollection CreateBindingElements()
        {
            BindingElementCollection elements = base.CreateBindingElements();

            if (this.BinaryEncoding)
            {
                // search the existing message encoding element (Text or MTOM) and replace it
                // note: the search must be done with the base type of text and mtom binding element,
                // because this code is compiled against silverlight also
                // and there is no mtom encoding available
                for (int i = elements.Count - 1; i >= 0; i--)
                {
                    BindingElement element = elements[i];
                    if (element.GetType().IsSubclassOf(typeof(MessageEncodingBindingElement)))
                    {
                        BinaryMessageEncodingBindingElement binaryElement = null;

                        var textEncoding = element as TextMessageEncodingBindingElement;
                        var mtomEncoding = element as MtomMessageEncodingBindingElement;

                        if (textEncoding != null)
                        {
                            // copy settings to binary element
                            binaryElement = new BinaryMessageEncodingBindingElement();

                            // copy settings
                            binaryElement.ReaderQuotas.MaxArrayLength         = textEncoding.ReaderQuotas.MaxArrayLength;
                            binaryElement.ReaderQuotas.MaxBytesPerRead        = textEncoding.ReaderQuotas.MaxBytesPerRead;
                            binaryElement.ReaderQuotas.MaxDepth               = textEncoding.ReaderQuotas.MaxDepth;
                            binaryElement.ReaderQuotas.MaxNameTableCharCount  = textEncoding.ReaderQuotas.MaxNameTableCharCount;
                            binaryElement.ReaderQuotas.MaxStringContentLength = textEncoding.ReaderQuotas.MaxStringContentLength;
                            binaryElement.MaxReadPoolSize  = textEncoding.MaxReadPoolSize;
                            binaryElement.MaxWritePoolSize = textEncoding.MaxWritePoolSize;

                            // binary uses always soap-1.2
                            //binaryElement.MessageVersion = textEncoding.MessageVersion;
                        }

                        else if (mtomEncoding != null)
                        {
                            // copy settings to binary element
                            binaryElement = new BinaryMessageEncodingBindingElement();

                            // copy settings
                            binaryElement.ReaderQuotas.MaxArrayLength         = mtomEncoding.ReaderQuotas.MaxArrayLength;
                            binaryElement.ReaderQuotas.MaxBytesPerRead        = mtomEncoding.ReaderQuotas.MaxBytesPerRead;
                            binaryElement.ReaderQuotas.MaxDepth               = mtomEncoding.ReaderQuotas.MaxDepth;
                            binaryElement.ReaderQuotas.MaxNameTableCharCount  = mtomEncoding.ReaderQuotas.MaxNameTableCharCount;
                            binaryElement.ReaderQuotas.MaxStringContentLength = mtomEncoding.ReaderQuotas.MaxStringContentLength;
                            binaryElement.MaxReadPoolSize  = mtomEncoding.MaxReadPoolSize;
                            binaryElement.MaxWritePoolSize = mtomEncoding.MaxWritePoolSize;

                            // binary uses always soap-1.2
                            //binaryElement.MessageVersion = mtomEncoding.MessageVersion;
                        }

                        else if (element is BinaryMessageEncodingBindingElement)
                        {
                            // it's already binary
                        }
                        else
                        {
                            string exStr = string.Format(CultureInfo.CurrentCulture, "Message encoding type {0} is not implemented.", element.GetType().Name);
                            throw new NotImplementedException(exStr);
                        }

                        if (binaryElement != null)
                        {
                            elements.RemoveAt(i);
                            elements.Insert(i, binaryElement);
                            break;
                        }
                    }
                }
            }

            return(elements);
        }
        static void FillBindingInfo(BindingElement bindingElement, ref IWmiInstance instance)
        {
            Fx.Assert(null != bindingElement, "");
            Fx.Assert(null != instance, "");

            if (bindingElement is IWmiInstanceProvider)
            {
                IWmiInstanceProvider instanceProvider = (IWmiInstanceProvider)bindingElement;
                instance = instance.NewInstance(instanceProvider.GetInstanceType());
                instanceProvider.FillInstance(instance);
                return;
            }

            Type elementType = AdministrationHelpers.GetServiceModelBaseType(bindingElement.GetType());
            if (null != elementType)
            {
                instance = instance.NewInstance(elementType.Name);
                if (bindingElement is TransportBindingElement)
                {
                    TransportBindingElement transport = (TransportBindingElement)bindingElement;
                    instance.SetProperty(AdministrationStrings.ManualAddressing, transport.ManualAddressing);
                    instance.SetProperty(AdministrationStrings.MaxReceivedMessageSize, transport.MaxReceivedMessageSize);
                    instance.SetProperty(AdministrationStrings.MaxBufferPoolSize, transport.MaxBufferPoolSize);
                    instance.SetProperty(AdministrationStrings.Scheme, transport.Scheme);

                    if (bindingElement is ConnectionOrientedTransportBindingElement)
                    {
                        ConnectionOrientedTransportBindingElement connectionOriented = (ConnectionOrientedTransportBindingElement)bindingElement;
                        instance.SetProperty(AdministrationStrings.ConnectionBufferSize, connectionOriented.ConnectionBufferSize);
                        instance.SetProperty(AdministrationStrings.HostNameComparisonMode, connectionOriented.HostNameComparisonMode.ToString());
                        instance.SetProperty(AdministrationStrings.ChannelInitializationTimeout, connectionOriented.ChannelInitializationTimeout);
                        instance.SetProperty(AdministrationStrings.MaxBufferSize, connectionOriented.MaxBufferSize);
                        instance.SetProperty(AdministrationStrings.MaxPendingConnections, connectionOriented.MaxPendingConnections);
                        instance.SetProperty(AdministrationStrings.MaxOutputDelay, connectionOriented.MaxOutputDelay);
                        instance.SetProperty(AdministrationStrings.MaxPendingAccepts, connectionOriented.MaxPendingAccepts);
                        instance.SetProperty(AdministrationStrings.TransferMode, connectionOriented.TransferMode.ToString());

                        if (bindingElement is TcpTransportBindingElement)
                        {
                            TcpTransportBindingElement tcp = (TcpTransportBindingElement)bindingElement;
                            instance.SetProperty(AdministrationStrings.ListenBacklog, tcp.ListenBacklog);
                            instance.SetProperty(AdministrationStrings.PortSharingEnabled, tcp.PortSharingEnabled);
                            instance.SetProperty(AdministrationStrings.TeredoEnabled, tcp.TeredoEnabled);

                            IWmiInstance connectionPool = instance.NewInstance(AdministrationStrings.TcpConnectionPoolSettings);
                            connectionPool.SetProperty(AdministrationStrings.GroupName, tcp.ConnectionPoolSettings.GroupName);
                            connectionPool.SetProperty(AdministrationStrings.IdleTimeout, tcp.ConnectionPoolSettings.IdleTimeout);
                            connectionPool.SetProperty(AdministrationStrings.LeaseTimeout, tcp.ConnectionPoolSettings.LeaseTimeout);
                            connectionPool.SetProperty(AdministrationStrings.MaxOutboundConnectionsPerEndpoint, tcp.ConnectionPoolSettings.MaxOutboundConnectionsPerEndpoint);

                            instance.SetProperty(AdministrationStrings.ConnectionPoolSettings, connectionPool);

                            FillExtendedProtectionPolicy(instance, tcp.ExtendedProtectionPolicy);
                        }
                        else if (bindingElement is NamedPipeTransportBindingElement)
                        {
                            NamedPipeTransportBindingElement namedPipe = (NamedPipeTransportBindingElement)bindingElement;
                            IWmiInstance connectionPool = instance.NewInstance(AdministrationStrings.NamedPipeConnectionPoolSettings);

                            connectionPool.SetProperty(AdministrationStrings.GroupName, namedPipe.ConnectionPoolSettings.GroupName);
                            connectionPool.SetProperty(AdministrationStrings.IdleTimeout, namedPipe.ConnectionPoolSettings.IdleTimeout);
                            connectionPool.SetProperty(AdministrationStrings.MaxOutboundConnectionsPerEndpoint, namedPipe.ConnectionPoolSettings.MaxOutboundConnectionsPerEndpoint);

                            instance.SetProperty(AdministrationStrings.ConnectionPoolSettings, connectionPool);
                        }
                    }
                    else if (bindingElement is HttpTransportBindingElement)
                    {
                        HttpTransportBindingElement http = (HttpTransportBindingElement)bindingElement;
                        instance.SetProperty(AdministrationStrings.AllowCookies, http.AllowCookies);
                        instance.SetProperty(AdministrationStrings.AuthenticationScheme, http.AuthenticationScheme.ToString());

                        instance.SetProperty(AdministrationStrings.BypassProxyOnLocal, http.BypassProxyOnLocal);
                        instance.SetProperty(AdministrationStrings.DecompressionEnabled, http.DecompressionEnabled);
                        instance.SetProperty(AdministrationStrings.HostNameComparisonMode, http.HostNameComparisonMode.ToString());
                        instance.SetProperty(AdministrationStrings.KeepAliveEnabled, http.KeepAliveEnabled);
                        instance.SetProperty(AdministrationStrings.MaxBufferSize, http.MaxBufferSize);
                        if (null != http.ProxyAddress)
                        {
                            instance.SetProperty(AdministrationStrings.ProxyAddress, http.ProxyAddress.AbsoluteUri.ToString());
                        }
                        instance.SetProperty(AdministrationStrings.ProxyAuthenticationScheme, http.ProxyAuthenticationScheme.ToString());
                        instance.SetProperty(AdministrationStrings.Realm, http.Realm);
                        instance.SetProperty(AdministrationStrings.TransferMode, http.TransferMode.ToString());
                        instance.SetProperty(AdministrationStrings.UnsafeConnectionNtlmAuthentication, http.UnsafeConnectionNtlmAuthentication);
                        instance.SetProperty(AdministrationStrings.UseDefaultWebProxy, http.UseDefaultWebProxy);

                        FillExtendedProtectionPolicy(instance, http.ExtendedProtectionPolicy);

                        if (bindingElement is HttpsTransportBindingElement)
                        {
                            HttpsTransportBindingElement https = (HttpsTransportBindingElement)bindingElement;
                            instance.SetProperty(AdministrationStrings.RequireClientCertificate, https.RequireClientCertificate);
                        }
                    }
                    else if (bindingElement is MsmqBindingElementBase)
                    {
                        MsmqBindingElementBase msmq = (MsmqBindingElementBase)bindingElement;

                        if (null != msmq.CustomDeadLetterQueue)
                        {
                            instance.SetProperty(AdministrationStrings.CustomDeadLetterQueue, msmq.CustomDeadLetterQueue.AbsoluteUri.ToString());
                        }
                        instance.SetProperty(AdministrationStrings.DeadLetterQueue, msmq.DeadLetterQueue);
                        instance.SetProperty(AdministrationStrings.Durable, msmq.Durable);
                        instance.SetProperty(AdministrationStrings.ExactlyOnce, msmq.ExactlyOnce);
                        instance.SetProperty(AdministrationStrings.MaxRetryCycles, msmq.MaxRetryCycles);
                        instance.SetProperty(AdministrationStrings.ReceiveContextEnabled, msmq.ReceiveContextEnabled);
                        instance.SetProperty(AdministrationStrings.ReceiveErrorHandling, msmq.ReceiveErrorHandling);
                        instance.SetProperty(AdministrationStrings.ReceiveRetryCount, msmq.ReceiveRetryCount);
                        instance.SetProperty(AdministrationStrings.RetryCycleDelay, msmq.RetryCycleDelay);
                        instance.SetProperty(AdministrationStrings.TimeToLive, msmq.TimeToLive);
                        instance.SetProperty(AdministrationStrings.UseSourceJournal, msmq.UseSourceJournal);
                        instance.SetProperty(AdministrationStrings.UseMsmqTracing, msmq.UseMsmqTracing);
                        instance.SetProperty(AdministrationStrings.ValidityDuration, msmq.ValidityDuration);

                        MsmqTransportBindingElement msmqTransport = msmq as MsmqTransportBindingElement;
                        if (null != msmqTransport)
                        {
                            instance.SetProperty(AdministrationStrings.MaxPoolSize, msmqTransport.MaxPoolSize);
                            instance.SetProperty(AdministrationStrings.QueueTransferProtocol, msmqTransport.QueueTransferProtocol);
                            instance.SetProperty(AdministrationStrings.UseActiveDirectory, msmqTransport.UseActiveDirectory);
                        }

                        MsmqIntegrationBindingElement msmqIntegration = msmq as MsmqIntegrationBindingElement;
                        if (null != msmqIntegration)
                            instance.SetProperty(AdministrationStrings.SerializationFormat, msmqIntegration.SerializationFormat.ToString());
                    }
#pragma warning disable 0618
                    else if (bindingElement is PeerTransportBindingElement)
                    {
                        PeerTransportBindingElement peer = (PeerTransportBindingElement)bindingElement;
                        instance.SetProperty(AdministrationStrings.ListenIPAddress, peer.ListenIPAddress);
                        instance.SetProperty(AdministrationStrings.Port, peer.Port);

                        IWmiInstance securitySettings = instance.NewInstance(AdministrationStrings.PeerSecuritySettings);
                        securitySettings.SetProperty(AdministrationStrings.PeerSecurityMode, peer.Security.Mode.ToString());
                        IWmiInstance transportSecuritySettings = securitySettings.NewInstance(AdministrationStrings.PeerTransportSecuritySettings);
                        transportSecuritySettings.SetProperty(AdministrationStrings.PeerTransportCredentialType, peer.Security.Transport.CredentialType.ToString());
                        securitySettings.SetProperty(AdministrationStrings.Transport, transportSecuritySettings);
                        instance.SetProperty(AdministrationStrings.Security, securitySettings);
                    }
                }
                else if (bindingElement is PeerResolverBindingElement)
                {
                    PeerResolverBindingElement baseResolver = (PeerResolverBindingElement)bindingElement;
                    instance.SetProperty(AdministrationStrings.ReferralPolicy, baseResolver.ReferralPolicy.ToString());
                    if (bindingElement is PeerCustomResolverBindingElement)
                    {
                        PeerCustomResolverBindingElement specificElement = (PeerCustomResolverBindingElement)bindingElement;
                        if (specificElement.Address != null)
                            instance.SetProperty(AdministrationStrings.Address, specificElement.Address.ToString());
                        if (specificElement.Binding != null)
                            instance.SetProperty(AdministrationStrings.Binding, specificElement.Binding.ToString());
                    }
                }
#pragma warning restore 0618
                else if (bindingElement is ReliableSessionBindingElement)
                {
                    ReliableSessionBindingElement specificElement = (ReliableSessionBindingElement)bindingElement;
                    instance.SetProperty(AdministrationStrings.AcknowledgementInterval, specificElement.AcknowledgementInterval);
                    instance.SetProperty(AdministrationStrings.FlowControlEnabled, specificElement.FlowControlEnabled);
                    instance.SetProperty(AdministrationStrings.InactivityTimeout, specificElement.InactivityTimeout);
                    instance.SetProperty(AdministrationStrings.MaxPendingChannels, specificElement.MaxPendingChannels);
                    instance.SetProperty(AdministrationStrings.MaxRetryCount, specificElement.MaxRetryCount);
                    instance.SetProperty(AdministrationStrings.MaxTransferWindowSize, specificElement.MaxTransferWindowSize);
                    instance.SetProperty(AdministrationStrings.Ordered, specificElement.Ordered);
                    instance.SetProperty(AdministrationStrings.ReliableMessagingVersion, specificElement.ReliableMessagingVersion.ToString());
                }
                else if (bindingElement is SecurityBindingElement)
                {
                    SecurityBindingElement specificElement = (SecurityBindingElement)bindingElement;
                    instance.SetProperty(AdministrationStrings.AllowInsecureTransport, specificElement.AllowInsecureTransport);
                    instance.SetProperty(AdministrationStrings.DefaultAlgorithmSuite, specificElement.DefaultAlgorithmSuite.ToString());
                    instance.SetProperty(AdministrationStrings.EnableUnsecuredResponse, specificElement.EnableUnsecuredResponse);
                    instance.SetProperty(AdministrationStrings.IncludeTimestamp, specificElement.IncludeTimestamp);
                    instance.SetProperty(AdministrationStrings.KeyEntropyMode, specificElement.KeyEntropyMode.ToString());
                    instance.SetProperty(AdministrationStrings.SecurityHeaderLayout, specificElement.SecurityHeaderLayout.ToString());
                    instance.SetProperty(AdministrationStrings.MessageSecurityVersion, specificElement.MessageSecurityVersion.ToString());

                    IWmiInstance localServiceSecuritySettings = instance.NewInstance(AdministrationStrings.LocalServiceSecuritySettings);
                    localServiceSecuritySettings.SetProperty(AdministrationStrings.DetectReplays, specificElement.LocalServiceSettings.DetectReplays);
                    localServiceSecuritySettings.SetProperty(AdministrationStrings.InactivityTimeout, specificElement.LocalServiceSettings.InactivityTimeout);
                    localServiceSecuritySettings.SetProperty(AdministrationStrings.IssuedCookieLifetime, specificElement.LocalServiceSettings.IssuedCookieLifetime);
                    localServiceSecuritySettings.SetProperty(AdministrationStrings.MaxCachedCookies, specificElement.LocalServiceSettings.MaxCachedCookies);
                    localServiceSecuritySettings.SetProperty(AdministrationStrings.MaxClockSkew, specificElement.LocalServiceSettings.MaxClockSkew);
                    localServiceSecuritySettings.SetProperty(AdministrationStrings.MaxPendingSessions, specificElement.LocalServiceSettings.MaxPendingSessions);
                    localServiceSecuritySettings.SetProperty(AdministrationStrings.MaxStatefulNegotiations, specificElement.LocalServiceSettings.MaxStatefulNegotiations);
                    localServiceSecuritySettings.SetProperty(AdministrationStrings.NegotiationTimeout, specificElement.LocalServiceSettings.NegotiationTimeout);
                    localServiceSecuritySettings.SetProperty(AdministrationStrings.ReconnectTransportOnFailure, specificElement.LocalServiceSettings.ReconnectTransportOnFailure);
                    localServiceSecuritySettings.SetProperty(AdministrationStrings.ReplayCacheSize, specificElement.LocalServiceSettings.ReplayCacheSize);
                    localServiceSecuritySettings.SetProperty(AdministrationStrings.ReplayWindow, specificElement.LocalServiceSettings.ReplayWindow);
                    localServiceSecuritySettings.SetProperty(AdministrationStrings.SessionKeyRenewalInterval, specificElement.LocalServiceSettings.SessionKeyRenewalInterval);
                    localServiceSecuritySettings.SetProperty(AdministrationStrings.SessionKeyRolloverInterval, specificElement.LocalServiceSettings.SessionKeyRolloverInterval);
                    localServiceSecuritySettings.SetProperty(AdministrationStrings.TimestampValidityDuration, specificElement.LocalServiceSettings.TimestampValidityDuration);
                    instance.SetProperty(AdministrationStrings.LocalServiceSecuritySettings, localServiceSecuritySettings);

                    if (bindingElement is AsymmetricSecurityBindingElement)
                    {
                        AsymmetricSecurityBindingElement specificElement1 = (AsymmetricSecurityBindingElement)bindingElement;

                        instance.SetProperty(AdministrationStrings.MessageProtectionOrder, specificElement1.MessageProtectionOrder.ToString());
                        instance.SetProperty(AdministrationStrings.RequireSignatureConfirmation, specificElement1.RequireSignatureConfirmation);
                    }
                    else if (bindingElement is SymmetricSecurityBindingElement)
                    {
                        SymmetricSecurityBindingElement specificElement1 = (SymmetricSecurityBindingElement)bindingElement;

                        instance.SetProperty(AdministrationStrings.MessageProtectionOrder, specificElement1.MessageProtectionOrder.ToString());
                        instance.SetProperty(AdministrationStrings.RequireSignatureConfirmation, specificElement1.RequireSignatureConfirmation);
                    }
                }
                else if (bindingElement is WindowsStreamSecurityBindingElement)
                {
                    WindowsStreamSecurityBindingElement specificElement
                        = (WindowsStreamSecurityBindingElement)bindingElement;
                    instance.SetProperty(AdministrationStrings.ProtectionLevel, specificElement.ProtectionLevel.ToString());
                }
                else if (bindingElement is SslStreamSecurityBindingElement)
                {
                    SslStreamSecurityBindingElement specificElement = (SslStreamSecurityBindingElement)bindingElement;
                    instance.SetProperty(AdministrationStrings.RequireClientCertificate, specificElement.RequireClientCertificate);
                }
                else if (bindingElement is CompositeDuplexBindingElement)
                {
                    CompositeDuplexBindingElement specificElement = (CompositeDuplexBindingElement)bindingElement;
                    if (specificElement.ClientBaseAddress != null)
                    {
                        instance.SetProperty(AdministrationStrings.ClientBaseAddress, specificElement.ClientBaseAddress.AbsoluteUri);
                    }
                }
                else if (bindingElement is OneWayBindingElement)
                {
                    OneWayBindingElement oneWay = (OneWayBindingElement)bindingElement;
                    IWmiInstance channelPoolSettings = instance.NewInstance(AdministrationStrings.ChannelPoolSettings);
                    channelPoolSettings.SetProperty(AdministrationStrings.IdleTimeout, oneWay.ChannelPoolSettings.IdleTimeout);
                    channelPoolSettings.SetProperty(AdministrationStrings.LeaseTimeout, oneWay.ChannelPoolSettings.LeaseTimeout);
                    channelPoolSettings.SetProperty(AdministrationStrings.MaxOutboundChannelsPerEndpoint, oneWay.ChannelPoolSettings.MaxOutboundChannelsPerEndpoint);
                    instance.SetProperty(AdministrationStrings.ChannelPoolSettings, channelPoolSettings);
                    instance.SetProperty(AdministrationStrings.PacketRoutable, oneWay.PacketRoutable);
                    instance.SetProperty(AdministrationStrings.MaxAcceptedChannels, oneWay.MaxAcceptedChannels);
                }
                else if (bindingElement is MessageEncodingBindingElement)
                {
                    MessageEncodingBindingElement encodingElement = (MessageEncodingBindingElement)bindingElement;

                    instance.SetProperty(AdministrationStrings.MessageVersion, encodingElement.MessageVersion.ToString());

                    if (bindingElement is BinaryMessageEncodingBindingElement)
                    {
                        BinaryMessageEncodingBindingElement specificElement = (BinaryMessageEncodingBindingElement)bindingElement;
                        instance.SetProperty(AdministrationStrings.MaxSessionSize, specificElement.MaxSessionSize);
                        instance.SetProperty(AdministrationStrings.MaxReadPoolSize, specificElement.MaxReadPoolSize);
                        instance.SetProperty(AdministrationStrings.MaxWritePoolSize, specificElement.MaxWritePoolSize);
                        if (null != specificElement.ReaderQuotas)
                        {
                            FillReaderQuotas(instance, specificElement.ReaderQuotas);
                        }
                        instance.SetProperty(AdministrationStrings.CompressionFormat, specificElement.CompressionFormat.ToString());
                    }
                    else if (bindingElement is TextMessageEncodingBindingElement)
                    {
                        TextMessageEncodingBindingElement specificElement = (TextMessageEncodingBindingElement)bindingElement;
                        instance.SetProperty(AdministrationStrings.Encoding, specificElement.WriteEncoding.WebName);
                        instance.SetProperty(AdministrationStrings.MaxReadPoolSize, specificElement.MaxReadPoolSize);
                        instance.SetProperty(AdministrationStrings.MaxWritePoolSize, specificElement.MaxWritePoolSize);
                        if (null != specificElement.ReaderQuotas)
                        {
                            FillReaderQuotas(instance, specificElement.ReaderQuotas);
                        }
                    }
                    else if (bindingElement is MtomMessageEncodingBindingElement)
                    {
                        MtomMessageEncodingBindingElement specificElement = (MtomMessageEncodingBindingElement)bindingElement;
                        instance.SetProperty(AdministrationStrings.Encoding, specificElement.WriteEncoding.WebName);
                        instance.SetProperty(AdministrationStrings.MessageVersion, specificElement.MessageVersion.ToString());
                        instance.SetProperty(AdministrationStrings.MaxReadPoolSize, specificElement.MaxReadPoolSize);
                        instance.SetProperty(AdministrationStrings.MaxWritePoolSize, specificElement.MaxWritePoolSize);
                        if (null != specificElement.ReaderQuotas)
                        {
                            FillReaderQuotas(instance, specificElement.ReaderQuotas);
                        }
                    }
                }
                else if (bindingElement is TransactionFlowBindingElement)
                {
                    TransactionFlowBindingElement specificElement = (TransactionFlowBindingElement)bindingElement;
                    instance.SetProperty(AdministrationStrings.TransactionFlow, specificElement.Transactions);
                    instance.SetProperty(AdministrationStrings.TransactionProtocol, specificElement.TransactionProtocol.ToString());
                    instance.SetProperty(AdministrationStrings.AllowWildcardAction, specificElement.AllowWildcardAction);
                }
                else if (bindingElement is PrivacyNoticeBindingElement)
                {
                    PrivacyNoticeBindingElement specificElement = (PrivacyNoticeBindingElement)bindingElement;
                    instance.SetProperty(AdministrationStrings.Url, specificElement.Url.ToString());
                    instance.SetProperty(AdministrationStrings.PrivacyNoticeVersion, specificElement.Version);
                }
            }
        }
Exemple #18
0
        protected override void InitializeFrom(BindingElement bindingElement)
        {
            base.InitializeFrom(bindingElement);

            if (bindingElement == null)
            {
                throw new ArgumentNullException(nameof(bindingElement));
            }
            if (!(bindingElement is RabbitMQTransportBindingElement rabbitMqTransportBindingElement))
            {
                throw new ArgumentException($"Invalid type for binding. Expected {typeof(RabbitMQBinding).AssemblyQualifiedName}, Passed: {bindingElement.GetType().AssemblyQualifiedName}");
            }

            this.HostName    = rabbitMqTransportBindingElement.HostName;
            this.Port        = rabbitMqTransportBindingElement.Port;
            this.Password    = rabbitMqTransportBindingElement.ConnectionFactory.Password;
            this.Username    = rabbitMqTransportBindingElement.ConnectionFactory.UserName;
            this.VirtualHost = rabbitMqTransportBindingElement.ConnectionFactory.VirtualHost;
        }
        protected override void InitializeFrom(BindingElement bindingElement)
        {
            base.InitializeFrom(bindingElement);

            if (bindingElement == null)
                throw new ArgumentNullException("bindingElement");

            var binding = bindingElement as QpidTransportBindingElement;
            if (binding == null)
            {
                throw new ArgumentException(
                    string.Format("Invalid type for binding. Expected {0}, Passed: {1}",
                                  typeof(QpidTransportBindingElement).AssemblyQualifiedName,
                                  bindingElement.GetType().AssemblyQualifiedName));
            }

            Host = binding.Host;
            PortNumber = binding.PortNumber;
            Password = binding.Password;
            UserName = binding.UserName;
            VirtualHost = binding.VirtualHost;
        }
Exemple #20
0
        public override void ApplyConfiguration(BindingElement bindingElement)
        {
            base.ApplyConfiguration(bindingElement);
            if (bindingElement == null)
            {
                throw new ArgumentNullException(nameof(bindingElement));
            }
            if (!(bindingElement is RabbitMQTransportBindingElement rabbitMqTransportBindingElement))
            {
                throw new ArgumentException($"Invalid type for binding. Expected {typeof(RabbitMQBinding).AssemblyQualifiedName}, Passed: {bindingElement.GetType().AssemblyQualifiedName}");
            }

            rabbitMqTransportBindingElement.HostName = this.HostName;
            rabbitMqTransportBindingElement.Port     = this.Port;
            rabbitMqTransportBindingElement.ConnectionFactory.Password    = this.Password;
            rabbitMqTransportBindingElement.ConnectionFactory.UserName    = this.Username;
            rabbitMqTransportBindingElement.ConnectionFactory.VirtualHost = this.VirtualHost;
        }
        protected override void InitializeFrom(BindingElement bindingElement)
        {
            base.InitializeFrom(bindingElement);

            if (bindingElement == null)
                throw new ArgumentNullException("binding");

            RabbitMQTransportBindingElement rabbind = bindingElement as RabbitMQTransportBindingElement;
            if (rabbind == null)
            {
                throw new ArgumentException(
                    string.Format("Invalid type for binding. Expected {0}, Passed: {1}",
                        typeof(RabbitMQBinding).AssemblyQualifiedName,
                        bindingElement.GetType().AssemblyQualifiedName));
            }

            this.PersistentDelivery = rabbind.PersistentDelivery;
            this.AutoBindExchange = rabbind.AutoBindExchange;
            this.TTL = rabbind.TTL;
            this.ProtocolVersion = rabbind.BrokerProtocol.ApiName;
            this.ReplyToQueue = rabbind.ReplyToQueue;
            this.ReplyToExchange = rabbind.ReplyToExchange.ToString();
            this.OneWayOnly = rabbind.OneWayOnly;
        }
 private static void FillBindingInfo(BindingElement bindingElement, ref IWmiInstance instance)
 {
     if (bindingElement is IWmiInstanceProvider)
     {
         IWmiInstanceProvider provider = (IWmiInstanceProvider) bindingElement;
         instance = instance.NewInstance(provider.GetInstanceType());
         provider.FillInstance(instance);
     }
     else
     {
         System.Type serviceModelBaseType = AdministrationHelpers.GetServiceModelBaseType(bindingElement.GetType());
         if (null != serviceModelBaseType)
         {
             instance = instance.NewInstance(serviceModelBaseType.Name);
             if (bindingElement is TransportBindingElement)
             {
                 TransportBindingElement element = (TransportBindingElement) bindingElement;
                 instance.SetProperty("ManualAddressing", element.ManualAddressing);
                 instance.SetProperty("MaxReceivedMessageSize", element.MaxReceivedMessageSize);
                 instance.SetProperty("MaxBufferPoolSize", element.MaxBufferPoolSize);
                 instance.SetProperty("Scheme", element.Scheme);
                 if (bindingElement is ConnectionOrientedTransportBindingElement)
                 {
                     ConnectionOrientedTransportBindingElement element2 = (ConnectionOrientedTransportBindingElement) bindingElement;
                     instance.SetProperty("ConnectionBufferSize", element2.ConnectionBufferSize);
                     instance.SetProperty("HostNameComparisonMode", element2.HostNameComparisonMode.ToString());
                     instance.SetProperty("ChannelInitializationTimeout", element2.ChannelInitializationTimeout);
                     instance.SetProperty("MaxBufferSize", element2.MaxBufferSize);
                     instance.SetProperty("MaxPendingConnections", element2.MaxPendingConnections);
                     instance.SetProperty("MaxOutputDelay", element2.MaxOutputDelay);
                     instance.SetProperty("MaxPendingAccepts", element2.MaxPendingAccepts);
                     instance.SetProperty("TransferMode", element2.TransferMode.ToString());
                     if (bindingElement is TcpTransportBindingElement)
                     {
                         TcpTransportBindingElement element3 = (TcpTransportBindingElement) bindingElement;
                         instance.SetProperty("ListenBacklog", element3.ListenBacklog);
                         instance.SetProperty("PortSharingEnabled", element3.PortSharingEnabled);
                         instance.SetProperty("TeredoEnabled", element3.TeredoEnabled);
                         IWmiInstance instance2 = instance.NewInstance("TcpConnectionPoolSettings");
                         instance2.SetProperty("GroupName", element3.ConnectionPoolSettings.GroupName);
                         instance2.SetProperty("IdleTimeout", element3.ConnectionPoolSettings.IdleTimeout);
                         instance2.SetProperty("LeaseTimeout", element3.ConnectionPoolSettings.LeaseTimeout);
                         instance2.SetProperty("MaxOutboundConnectionsPerEndpoint", element3.ConnectionPoolSettings.MaxOutboundConnectionsPerEndpoint);
                         instance.SetProperty("ConnectionPoolSettings", instance2);
                         FillExtendedProtectionPolicy(instance, element3.ExtendedProtectionPolicy);
                     }
                     else if (bindingElement is NamedPipeTransportBindingElement)
                     {
                         NamedPipeTransportBindingElement element4 = (NamedPipeTransportBindingElement) bindingElement;
                         IWmiInstance instance3 = instance.NewInstance("NamedPipeConnectionPoolSettings");
                         instance3.SetProperty("GroupName", element4.ConnectionPoolSettings.GroupName);
                         instance3.SetProperty("IdleTimeout", element4.ConnectionPoolSettings.IdleTimeout);
                         instance3.SetProperty("MaxOutboundConnectionsPerEndpoint", element4.ConnectionPoolSettings.MaxOutboundConnectionsPerEndpoint);
                         instance.SetProperty("ConnectionPoolSettings", instance3);
                     }
                 }
                 else if (!(bindingElement is HttpTransportBindingElement))
                 {
                     if (!(bindingElement is MsmqBindingElementBase))
                     {
                         if (bindingElement is PeerTransportBindingElement)
                         {
                             PeerTransportBindingElement element9 = (PeerTransportBindingElement) bindingElement;
                             instance.SetProperty("ListenIPAddress", element9.ListenIPAddress);
                             instance.SetProperty("Port", element9.Port);
                             IWmiInstance instance4 = instance.NewInstance("PeerSecuritySettings");
                             instance4.SetProperty("Mode", element9.Security.Mode.ToString());
                             IWmiInstance instance5 = instance4.NewInstance("PeerTransportSecuritySettings");
                             instance5.SetProperty("CredentialType", element9.Security.Transport.CredentialType.ToString());
                             instance4.SetProperty("Transport", instance5);
                             instance.SetProperty("Security", instance4);
                         }
                     }
                     else
                     {
                         MsmqBindingElementBase base2 = (MsmqBindingElementBase) bindingElement;
                         if (null != base2.CustomDeadLetterQueue)
                         {
                             instance.SetProperty("CustomDeadLetterQueue", base2.CustomDeadLetterQueue.AbsoluteUri.ToString());
                         }
                         instance.SetProperty("DeadLetterQueue", base2.DeadLetterQueue);
                         instance.SetProperty("Durable", base2.Durable);
                         instance.SetProperty("ExactlyOnce", base2.ExactlyOnce);
                         instance.SetProperty("MaxRetryCycles", base2.MaxRetryCycles);
                         instance.SetProperty("ReceiveContextEnabled", base2.ReceiveContextEnabled);
                         instance.SetProperty("ReceiveErrorHandling", base2.ReceiveErrorHandling);
                         instance.SetProperty("ReceiveRetryCount", base2.ReceiveRetryCount);
                         instance.SetProperty("RetryCycleDelay", base2.RetryCycleDelay);
                         instance.SetProperty("TimeToLive", base2.TimeToLive);
                         instance.SetProperty("UseSourceJournal", base2.UseSourceJournal);
                         instance.SetProperty("UseMsmqTracing", base2.UseMsmqTracing);
                         instance.SetProperty("ValidityDuration", base2.ValidityDuration);
                         MsmqTransportBindingElement element7 = base2 as MsmqTransportBindingElement;
                         if (element7 != null)
                         {
                             instance.SetProperty("MaxPoolSize", element7.MaxPoolSize);
                             instance.SetProperty("QueueTransferProtocol", element7.QueueTransferProtocol);
                             instance.SetProperty("UseActiveDirectory", element7.UseActiveDirectory);
                         }
                         MsmqIntegrationBindingElement element8 = base2 as MsmqIntegrationBindingElement;
                         if (element8 != null)
                         {
                             instance.SetProperty("SerializationFormat", element8.SerializationFormat.ToString());
                         }
                     }
                 }
                 else
                 {
                     HttpTransportBindingElement element5 = (HttpTransportBindingElement) bindingElement;
                     instance.SetProperty("AllowCookies", element5.AllowCookies);
                     instance.SetProperty("AuthenticationScheme", element5.AuthenticationScheme.ToString());
                     instance.SetProperty("BypassProxyOnLocal", element5.BypassProxyOnLocal);
                     instance.SetProperty("DecompressionEnabled", element5.DecompressionEnabled);
                     instance.SetProperty("HostNameComparisonMode", element5.HostNameComparisonMode.ToString());
                     instance.SetProperty("KeepAliveEnabled", element5.KeepAliveEnabled);
                     instance.SetProperty("MaxBufferSize", element5.MaxBufferSize);
                     if (null != element5.ProxyAddress)
                     {
                         instance.SetProperty("ProxyAddress", element5.ProxyAddress.AbsoluteUri.ToString());
                     }
                     instance.SetProperty("ProxyAuthenticationScheme", element5.ProxyAuthenticationScheme.ToString());
                     instance.SetProperty("Realm", element5.Realm);
                     instance.SetProperty("TransferMode", element5.TransferMode.ToString());
                     instance.SetProperty("UnsafeConnectionNtlmAuthentication", element5.UnsafeConnectionNtlmAuthentication);
                     instance.SetProperty("UseDefaultWebProxy", element5.UseDefaultWebProxy);
                     FillExtendedProtectionPolicy(instance, element5.ExtendedProtectionPolicy);
                     if (bindingElement is HttpsTransportBindingElement)
                     {
                         HttpsTransportBindingElement element6 = (HttpsTransportBindingElement) bindingElement;
                         instance.SetProperty("RequireClientCertificate", element6.RequireClientCertificate);
                     }
                 }
             }
             else if (bindingElement is PeerResolverBindingElement)
             {
                 PeerResolverBindingElement element10 = (PeerResolverBindingElement) bindingElement;
                 instance.SetProperty("ReferralPolicy", element10.ReferralPolicy.ToString());
                 if (bindingElement is PeerCustomResolverBindingElement)
                 {
                     PeerCustomResolverBindingElement element11 = (PeerCustomResolverBindingElement) bindingElement;
                     if (element11.Address != null)
                     {
                         instance.SetProperty("Address", element11.Address.ToString());
                     }
                     if (element11.Binding != null)
                     {
                         instance.SetProperty("Binding", element11.Binding.ToString());
                     }
                 }
             }
             else if (bindingElement is ReliableSessionBindingElement)
             {
                 ReliableSessionBindingElement element12 = (ReliableSessionBindingElement) bindingElement;
                 instance.SetProperty("AcknowledgementInterval", element12.AcknowledgementInterval);
                 instance.SetProperty("FlowControlEnabled", element12.FlowControlEnabled);
                 instance.SetProperty("InactivityTimeout", element12.InactivityTimeout);
                 instance.SetProperty("MaxPendingChannels", element12.MaxPendingChannels);
                 instance.SetProperty("MaxRetryCount", element12.MaxRetryCount);
                 instance.SetProperty("MaxTransferWindowSize", element12.MaxTransferWindowSize);
                 instance.SetProperty("Ordered", element12.Ordered);
                 instance.SetProperty("ReliableMessagingVersion", element12.ReliableMessagingVersion.ToString());
             }
             else if (bindingElement is SecurityBindingElement)
             {
                 SecurityBindingElement element13 = (SecurityBindingElement) bindingElement;
                 instance.SetProperty("AllowInsecureTransport", element13.AllowInsecureTransport);
                 instance.SetProperty("DefaultAlgorithmSuite", element13.DefaultAlgorithmSuite.ToString());
                 instance.SetProperty("EnableUnsecuredResponse", element13.EnableUnsecuredResponse);
                 instance.SetProperty("IncludeTimestamp", element13.IncludeTimestamp);
                 instance.SetProperty("KeyEntropyMode", element13.KeyEntropyMode.ToString());
                 instance.SetProperty("SecurityHeaderLayout", element13.SecurityHeaderLayout.ToString());
                 instance.SetProperty("MessageSecurityVersion", element13.MessageSecurityVersion.ToString());
                 IWmiInstance instance6 = instance.NewInstance("LocalServiceSecuritySettings");
                 instance6.SetProperty("DetectReplays", element13.LocalServiceSettings.DetectReplays);
                 instance6.SetProperty("InactivityTimeout", element13.LocalServiceSettings.InactivityTimeout);
                 instance6.SetProperty("IssuedCookieLifetime", element13.LocalServiceSettings.IssuedCookieLifetime);
                 instance6.SetProperty("MaxCachedCookies", element13.LocalServiceSettings.MaxCachedCookies);
                 instance6.SetProperty("MaxClockSkew", element13.LocalServiceSettings.MaxClockSkew);
                 instance6.SetProperty("MaxPendingSessions", element13.LocalServiceSettings.MaxPendingSessions);
                 instance6.SetProperty("MaxStatefulNegotiations", element13.LocalServiceSettings.MaxStatefulNegotiations);
                 instance6.SetProperty("NegotiationTimeout", element13.LocalServiceSettings.NegotiationTimeout);
                 instance6.SetProperty("ReconnectTransportOnFailure", element13.LocalServiceSettings.ReconnectTransportOnFailure);
                 instance6.SetProperty("ReplayCacheSize", element13.LocalServiceSettings.ReplayCacheSize);
                 instance6.SetProperty("ReplayWindow", element13.LocalServiceSettings.ReplayWindow);
                 instance6.SetProperty("SessionKeyRenewalInterval", element13.LocalServiceSettings.SessionKeyRenewalInterval);
                 instance6.SetProperty("SessionKeyRolloverInterval", element13.LocalServiceSettings.SessionKeyRolloverInterval);
                 instance6.SetProperty("TimestampValidityDuration", element13.LocalServiceSettings.TimestampValidityDuration);
                 instance.SetProperty("LocalServiceSecuritySettings", instance6);
                 if (bindingElement is AsymmetricSecurityBindingElement)
                 {
                     AsymmetricSecurityBindingElement element14 = (AsymmetricSecurityBindingElement) bindingElement;
                     instance.SetProperty("MessageProtectionOrder", element14.MessageProtectionOrder.ToString());
                     instance.SetProperty("RequireSignatureConfirmation", element14.RequireSignatureConfirmation);
                 }
                 else if (bindingElement is SymmetricSecurityBindingElement)
                 {
                     SymmetricSecurityBindingElement element15 = (SymmetricSecurityBindingElement) bindingElement;
                     instance.SetProperty("MessageProtectionOrder", element15.MessageProtectionOrder.ToString());
                     instance.SetProperty("RequireSignatureConfirmation", element15.RequireSignatureConfirmation);
                 }
             }
             else if (bindingElement is WindowsStreamSecurityBindingElement)
             {
                 WindowsStreamSecurityBindingElement element16 = (WindowsStreamSecurityBindingElement) bindingElement;
                 instance.SetProperty("ProtectionLevel", element16.ProtectionLevel.ToString());
             }
             else if (bindingElement is SslStreamSecurityBindingElement)
             {
                 SslStreamSecurityBindingElement element17 = (SslStreamSecurityBindingElement) bindingElement;
                 instance.SetProperty("RequireClientCertificate", element17.RequireClientCertificate);
             }
             else if (bindingElement is CompositeDuplexBindingElement)
             {
                 CompositeDuplexBindingElement element18 = (CompositeDuplexBindingElement) bindingElement;
                 if (element18.ClientBaseAddress != null)
                 {
                     instance.SetProperty("ClientBaseAddress", element18.ClientBaseAddress.AbsoluteUri);
                 }
             }
             else if (bindingElement is OneWayBindingElement)
             {
                 OneWayBindingElement element19 = (OneWayBindingElement) bindingElement;
                 IWmiInstance instance7 = instance.NewInstance("ChannelPoolSettings");
                 instance7.SetProperty("IdleTimeout", element19.ChannelPoolSettings.IdleTimeout);
                 instance7.SetProperty("LeaseTimeout", element19.ChannelPoolSettings.LeaseTimeout);
                 instance7.SetProperty("MaxOutboundChannelsPerEndpoint", element19.ChannelPoolSettings.MaxOutboundChannelsPerEndpoint);
                 instance.SetProperty("ChannelPoolSettings", instance7);
                 instance.SetProperty("PacketRoutable", element19.PacketRoutable);
                 instance.SetProperty("MaxAcceptedChannels", element19.MaxAcceptedChannels);
             }
             else if (bindingElement is MessageEncodingBindingElement)
             {
                 MessageEncodingBindingElement element20 = (MessageEncodingBindingElement) bindingElement;
                 instance.SetProperty("MessageVersion", element20.MessageVersion.ToString());
                 if (bindingElement is BinaryMessageEncodingBindingElement)
                 {
                     BinaryMessageEncodingBindingElement element21 = (BinaryMessageEncodingBindingElement) bindingElement;
                     instance.SetProperty("MaxSessionSize", element21.MaxSessionSize);
                     instance.SetProperty("MaxReadPoolSize", element21.MaxReadPoolSize);
                     instance.SetProperty("MaxWritePoolSize", element21.MaxWritePoolSize);
                     if (element21.ReaderQuotas != null)
                     {
                         FillReaderQuotas(instance, element21.ReaderQuotas);
                     }
                 }
                 else if (!(bindingElement is TextMessageEncodingBindingElement))
                 {
                     if (bindingElement is MtomMessageEncodingBindingElement)
                     {
                         MtomMessageEncodingBindingElement element23 = (MtomMessageEncodingBindingElement) bindingElement;
                         instance.SetProperty("Encoding", element23.WriteEncoding.WebName);
                         instance.SetProperty("MessageVersion", element23.MessageVersion.ToString());
                         instance.SetProperty("MaxReadPoolSize", element23.MaxReadPoolSize);
                         instance.SetProperty("MaxWritePoolSize", element23.MaxWritePoolSize);
                         if (element23.ReaderQuotas != null)
                         {
                             FillReaderQuotas(instance, element23.ReaderQuotas);
                         }
                     }
                 }
                 else
                 {
                     TextMessageEncodingBindingElement element22 = (TextMessageEncodingBindingElement) bindingElement;
                     instance.SetProperty("Encoding", element22.WriteEncoding.WebName);
                     instance.SetProperty("MaxReadPoolSize", element22.MaxReadPoolSize);
                     instance.SetProperty("MaxWritePoolSize", element22.MaxWritePoolSize);
                     if (element22.ReaderQuotas != null)
                     {
                         FillReaderQuotas(instance, element22.ReaderQuotas);
                     }
                 }
             }
             else if (bindingElement is TransactionFlowBindingElement)
             {
                 TransactionFlowBindingElement element24 = (TransactionFlowBindingElement) bindingElement;
                 instance.SetProperty("TransactionFlow", element24.Transactions);
                 instance.SetProperty("TransactionProtocol", element24.TransactionProtocol.ToString());
                 instance.SetProperty("AllowWildcardAction", element24.AllowWildcardAction);
             }
             else if (bindingElement is PrivacyNoticeBindingElement)
             {
                 PrivacyNoticeBindingElement element25 = (PrivacyNoticeBindingElement) bindingElement;
                 instance.SetProperty("Url", element25.Url.ToString());
                 instance.SetProperty("PrivacyNoticeVersion", element25.Version);
             }
         }
     }
 }
        public override void ApplyConfiguration(BindingElement bindingElement)
        {
            base.ApplyConfiguration(bindingElement);
            Microsoft.ServiceBus.Channels.ConnectionOrientedTransportBindingElement channelInitializationTimeout = bindingElement as Microsoft.ServiceBus.Channels.ConnectionOrientedTransportBindingElement;
            int?nullable = null;

            if (base.ElementInformation.Properties["maxBufferSize"].ValueOrigin != PropertyValueOrigin.Default)
            {
                nullable = new int?(this.MaxBufferSize);
            }
            if (channelInitializationTimeout == null)
            {
                RelayedOnewayTransportBindingElement connectionBufferSize = bindingElement as RelayedOnewayTransportBindingElement;
                if (connectionBufferSize == null)
                {
                    throw new InvalidCastException(SRClient.ExpectedTypeInvalidCastException(typeof(Microsoft.ServiceBus.Channels.ConnectionOrientedTransportBindingElement).ToString(), typeof(RelayedOnewayTransportBindingElement).ToString(), bindingElement.GetType().ToString()));
                }
                connectionBufferSize.ChannelInitializationTimeout = this.ChannelInitializationTimeout;
                connectionBufferSize.ConnectionBufferSize         = this.ConnectionBufferSize;
                connectionBufferSize.MaxPendingAccepts            = this.MaxPendingAccepts;
                connectionBufferSize.MaxPendingConnections        = this.MaxPendingConnections;
                if (nullable.HasValue)
                {
                    connectionBufferSize.MaxBufferSize = nullable.Value;
                    return;
                }
            }
            else
            {
                channelInitializationTimeout.ChannelInitializationTimeout = this.ChannelInitializationTimeout;
                channelInitializationTimeout.ConnectionBufferSize         = this.ConnectionBufferSize;
                channelInitializationTimeout.HostNameComparisonMode       = this.HostNameComparisonMode;
                channelInitializationTimeout.MaxPendingConnections        = this.MaxPendingConnections;
                channelInitializationTimeout.MaxOutputDelay    = this.MaxOutputDelay;
                channelInitializationTimeout.MaxPendingAccepts = this.MaxPendingAccepts;
                channelInitializationTimeout.TransferMode      = this.TransferMode;
                if (nullable.HasValue)
                {
                    channelInitializationTimeout.MaxBufferSize = nullable.Value;
                    return;
                }
            }
        }
        static void FillBindingInfo(BindingElement bindingElement, ref IWmiInstance instance)
        {
            Fx.Assert(null != bindingElement, "");
            Fx.Assert(null != instance, "");

            if (bindingElement is IWmiInstanceProvider)
            {
                IWmiInstanceProvider instanceProvider = (IWmiInstanceProvider)bindingElement;
                instance = instance.NewInstance(instanceProvider.GetInstanceType());
                instanceProvider.FillInstance(instance);
                return;
            }

            Type elementType = AdministrationHelpers.GetServiceModelBaseType(bindingElement.GetType());

            if (null != elementType)
            {
                instance = instance.NewInstance(elementType.Name);
                if (bindingElement is TransportBindingElement)
                {
                    TransportBindingElement transport = (TransportBindingElement)bindingElement;
                    instance.SetProperty(AdministrationStrings.ManualAddressing, transport.ManualAddressing);
                    instance.SetProperty(AdministrationStrings.MaxReceivedMessageSize, transport.MaxReceivedMessageSize);
                    instance.SetProperty(AdministrationStrings.MaxBufferPoolSize, transport.MaxBufferPoolSize);
                    instance.SetProperty(AdministrationStrings.Scheme, transport.Scheme);

                    if (bindingElement is ConnectionOrientedTransportBindingElement)
                    {
                        ConnectionOrientedTransportBindingElement connectionOriented = (ConnectionOrientedTransportBindingElement)bindingElement;
                        instance.SetProperty(AdministrationStrings.ConnectionBufferSize, connectionOriented.ConnectionBufferSize);
                        instance.SetProperty(AdministrationStrings.HostNameComparisonMode, connectionOriented.HostNameComparisonMode.ToString());
                        instance.SetProperty(AdministrationStrings.ChannelInitializationTimeout, connectionOriented.ChannelInitializationTimeout);
                        instance.SetProperty(AdministrationStrings.MaxBufferSize, connectionOriented.MaxBufferSize);
                        instance.SetProperty(AdministrationStrings.MaxPendingConnections, connectionOriented.MaxPendingConnections);
                        instance.SetProperty(AdministrationStrings.MaxOutputDelay, connectionOriented.MaxOutputDelay);
                        instance.SetProperty(AdministrationStrings.MaxPendingAccepts, connectionOriented.MaxPendingAccepts);
                        instance.SetProperty(AdministrationStrings.TransferMode, connectionOriented.TransferMode.ToString());

                        if (bindingElement is TcpTransportBindingElement)
                        {
                            TcpTransportBindingElement tcp = (TcpTransportBindingElement)bindingElement;
                            instance.SetProperty(AdministrationStrings.ListenBacklog, tcp.ListenBacklog);
                            instance.SetProperty(AdministrationStrings.PortSharingEnabled, tcp.PortSharingEnabled);
                            instance.SetProperty(AdministrationStrings.TeredoEnabled, tcp.TeredoEnabled);

                            IWmiInstance connectionPool = instance.NewInstance(AdministrationStrings.TcpConnectionPoolSettings);
                            connectionPool.SetProperty(AdministrationStrings.GroupName, tcp.ConnectionPoolSettings.GroupName);
                            connectionPool.SetProperty(AdministrationStrings.IdleTimeout, tcp.ConnectionPoolSettings.IdleTimeout);
                            connectionPool.SetProperty(AdministrationStrings.LeaseTimeout, tcp.ConnectionPoolSettings.LeaseTimeout);
                            connectionPool.SetProperty(AdministrationStrings.MaxOutboundConnectionsPerEndpoint, tcp.ConnectionPoolSettings.MaxOutboundConnectionsPerEndpoint);

                            instance.SetProperty(AdministrationStrings.ConnectionPoolSettings, connectionPool);

                            FillExtendedProtectionPolicy(instance, tcp.ExtendedProtectionPolicy);
                        }
                        else if (bindingElement is NamedPipeTransportBindingElement)
                        {
                            NamedPipeTransportBindingElement namedPipe = (NamedPipeTransportBindingElement)bindingElement;
                            IWmiInstance connectionPool = instance.NewInstance(AdministrationStrings.NamedPipeConnectionPoolSettings);

                            connectionPool.SetProperty(AdministrationStrings.GroupName, namedPipe.ConnectionPoolSettings.GroupName);
                            connectionPool.SetProperty(AdministrationStrings.IdleTimeout, namedPipe.ConnectionPoolSettings.IdleTimeout);
                            connectionPool.SetProperty(AdministrationStrings.MaxOutboundConnectionsPerEndpoint, namedPipe.ConnectionPoolSettings.MaxOutboundConnectionsPerEndpoint);

                            instance.SetProperty(AdministrationStrings.ConnectionPoolSettings, connectionPool);
                        }
                    }
                    else if (bindingElement is HttpTransportBindingElement)
                    {
                        HttpTransportBindingElement http = (HttpTransportBindingElement)bindingElement;
                        instance.SetProperty(AdministrationStrings.AllowCookies, http.AllowCookies);
                        instance.SetProperty(AdministrationStrings.AuthenticationScheme, http.AuthenticationScheme.ToString());

                        instance.SetProperty(AdministrationStrings.BypassProxyOnLocal, http.BypassProxyOnLocal);
                        instance.SetProperty(AdministrationStrings.DecompressionEnabled, http.DecompressionEnabled);
                        instance.SetProperty(AdministrationStrings.HostNameComparisonMode, http.HostNameComparisonMode.ToString());
                        instance.SetProperty(AdministrationStrings.KeepAliveEnabled, http.KeepAliveEnabled);
                        instance.SetProperty(AdministrationStrings.MaxBufferSize, http.MaxBufferSize);
                        if (null != http.ProxyAddress)
                        {
                            instance.SetProperty(AdministrationStrings.ProxyAddress, http.ProxyAddress.AbsoluteUri.ToString());
                        }
                        instance.SetProperty(AdministrationStrings.ProxyAuthenticationScheme, http.ProxyAuthenticationScheme.ToString());
                        instance.SetProperty(AdministrationStrings.Realm, http.Realm);
                        instance.SetProperty(AdministrationStrings.TransferMode, http.TransferMode.ToString());
                        instance.SetProperty(AdministrationStrings.UnsafeConnectionNtlmAuthentication, http.UnsafeConnectionNtlmAuthentication);
                        instance.SetProperty(AdministrationStrings.UseDefaultWebProxy, http.UseDefaultWebProxy);

                        FillExtendedProtectionPolicy(instance, http.ExtendedProtectionPolicy);

                        if (bindingElement is HttpsTransportBindingElement)
                        {
                            HttpsTransportBindingElement https = (HttpsTransportBindingElement)bindingElement;
                            instance.SetProperty(AdministrationStrings.RequireClientCertificate, https.RequireClientCertificate);
                        }
                    }
                    else if (bindingElement is MsmqBindingElementBase)
                    {
                        MsmqBindingElementBase msmq = (MsmqBindingElementBase)bindingElement;

                        if (null != msmq.CustomDeadLetterQueue)
                        {
                            instance.SetProperty(AdministrationStrings.CustomDeadLetterQueue, msmq.CustomDeadLetterQueue.AbsoluteUri.ToString());
                        }
                        instance.SetProperty(AdministrationStrings.DeadLetterQueue, msmq.DeadLetterQueue);
                        instance.SetProperty(AdministrationStrings.Durable, msmq.Durable);
                        instance.SetProperty(AdministrationStrings.ExactlyOnce, msmq.ExactlyOnce);
                        instance.SetProperty(AdministrationStrings.MaxRetryCycles, msmq.MaxRetryCycles);
                        instance.SetProperty(AdministrationStrings.ReceiveContextEnabled, msmq.ReceiveContextEnabled);
                        instance.SetProperty(AdministrationStrings.ReceiveErrorHandling, msmq.ReceiveErrorHandling);
                        instance.SetProperty(AdministrationStrings.ReceiveRetryCount, msmq.ReceiveRetryCount);
                        instance.SetProperty(AdministrationStrings.RetryCycleDelay, msmq.RetryCycleDelay);
                        instance.SetProperty(AdministrationStrings.TimeToLive, msmq.TimeToLive);
                        instance.SetProperty(AdministrationStrings.UseSourceJournal, msmq.UseSourceJournal);
                        instance.SetProperty(AdministrationStrings.UseMsmqTracing, msmq.UseMsmqTracing);
                        instance.SetProperty(AdministrationStrings.ValidityDuration, msmq.ValidityDuration);

                        MsmqTransportBindingElement msmqTransport = msmq as MsmqTransportBindingElement;
                        if (null != msmqTransport)
                        {
                            instance.SetProperty(AdministrationStrings.MaxPoolSize, msmqTransport.MaxPoolSize);
                            instance.SetProperty(AdministrationStrings.QueueTransferProtocol, msmqTransport.QueueTransferProtocol);
                            instance.SetProperty(AdministrationStrings.UseActiveDirectory, msmqTransport.UseActiveDirectory);
                        }

                        MsmqIntegrationBindingElement msmqIntegration = msmq as MsmqIntegrationBindingElement;
                        if (null != msmqIntegration)
                        {
                            instance.SetProperty(AdministrationStrings.SerializationFormat, msmqIntegration.SerializationFormat.ToString());
                        }
                    }
#pragma warning disable 0618
                    else if (bindingElement is PeerTransportBindingElement)
                    {
                        PeerTransportBindingElement peer = (PeerTransportBindingElement)bindingElement;
                        instance.SetProperty(AdministrationStrings.ListenIPAddress, peer.ListenIPAddress);
                        instance.SetProperty(AdministrationStrings.Port, peer.Port);

                        IWmiInstance securitySettings = instance.NewInstance(AdministrationStrings.PeerSecuritySettings);
                        securitySettings.SetProperty(AdministrationStrings.PeerSecurityMode, peer.Security.Mode.ToString());
                        IWmiInstance transportSecuritySettings = securitySettings.NewInstance(AdministrationStrings.PeerTransportSecuritySettings);
                        transportSecuritySettings.SetProperty(AdministrationStrings.PeerTransportCredentialType, peer.Security.Transport.CredentialType.ToString());
                        securitySettings.SetProperty(AdministrationStrings.Transport, transportSecuritySettings);
                        instance.SetProperty(AdministrationStrings.Security, securitySettings);
                    }
                }
                else if (bindingElement is PeerResolverBindingElement)
                {
                    PeerResolverBindingElement baseResolver = (PeerResolverBindingElement)bindingElement;
                    instance.SetProperty(AdministrationStrings.ReferralPolicy, baseResolver.ReferralPolicy.ToString());
                    if (bindingElement is PeerCustomResolverBindingElement)
                    {
                        PeerCustomResolverBindingElement specificElement = (PeerCustomResolverBindingElement)bindingElement;
                        if (specificElement.Address != null)
                        {
                            instance.SetProperty(AdministrationStrings.Address, specificElement.Address.ToString());
                        }
                        if (specificElement.Binding != null)
                        {
                            instance.SetProperty(AdministrationStrings.Binding, specificElement.Binding.ToString());
                        }
                    }
                }
#pragma warning restore 0618
                else if (bindingElement is ReliableSessionBindingElement)
                {
                    ReliableSessionBindingElement specificElement = (ReliableSessionBindingElement)bindingElement;
                    instance.SetProperty(AdministrationStrings.AcknowledgementInterval, specificElement.AcknowledgementInterval);
                    instance.SetProperty(AdministrationStrings.FlowControlEnabled, specificElement.FlowControlEnabled);
                    instance.SetProperty(AdministrationStrings.InactivityTimeout, specificElement.InactivityTimeout);
                    instance.SetProperty(AdministrationStrings.MaxPendingChannels, specificElement.MaxPendingChannels);
                    instance.SetProperty(AdministrationStrings.MaxRetryCount, specificElement.MaxRetryCount);
                    instance.SetProperty(AdministrationStrings.MaxTransferWindowSize, specificElement.MaxTransferWindowSize);
                    instance.SetProperty(AdministrationStrings.Ordered, specificElement.Ordered);
                    instance.SetProperty(AdministrationStrings.ReliableMessagingVersion, specificElement.ReliableMessagingVersion.ToString());
                }
                else if (bindingElement is SecurityBindingElement)
                {
                    SecurityBindingElement specificElement = (SecurityBindingElement)bindingElement;
                    instance.SetProperty(AdministrationStrings.AllowInsecureTransport, specificElement.AllowInsecureTransport);
                    instance.SetProperty(AdministrationStrings.DefaultAlgorithmSuite, specificElement.DefaultAlgorithmSuite.ToString());
                    instance.SetProperty(AdministrationStrings.EnableUnsecuredResponse, specificElement.EnableUnsecuredResponse);
                    instance.SetProperty(AdministrationStrings.IncludeTimestamp, specificElement.IncludeTimestamp);
                    instance.SetProperty(AdministrationStrings.KeyEntropyMode, specificElement.KeyEntropyMode.ToString());
                    instance.SetProperty(AdministrationStrings.SecurityHeaderLayout, specificElement.SecurityHeaderLayout.ToString());
                    instance.SetProperty(AdministrationStrings.MessageSecurityVersion, specificElement.MessageSecurityVersion.ToString());

                    IWmiInstance localServiceSecuritySettings = instance.NewInstance(AdministrationStrings.LocalServiceSecuritySettings);
                    localServiceSecuritySettings.SetProperty(AdministrationStrings.DetectReplays, specificElement.LocalServiceSettings.DetectReplays);
                    localServiceSecuritySettings.SetProperty(AdministrationStrings.InactivityTimeout, specificElement.LocalServiceSettings.InactivityTimeout);
                    localServiceSecuritySettings.SetProperty(AdministrationStrings.IssuedCookieLifetime, specificElement.LocalServiceSettings.IssuedCookieLifetime);
                    localServiceSecuritySettings.SetProperty(AdministrationStrings.MaxCachedCookies, specificElement.LocalServiceSettings.MaxCachedCookies);
                    localServiceSecuritySettings.SetProperty(AdministrationStrings.MaxClockSkew, specificElement.LocalServiceSettings.MaxClockSkew);
                    localServiceSecuritySettings.SetProperty(AdministrationStrings.MaxPendingSessions, specificElement.LocalServiceSettings.MaxPendingSessions);
                    localServiceSecuritySettings.SetProperty(AdministrationStrings.MaxStatefulNegotiations, specificElement.LocalServiceSettings.MaxStatefulNegotiations);
                    localServiceSecuritySettings.SetProperty(AdministrationStrings.NegotiationTimeout, specificElement.LocalServiceSettings.NegotiationTimeout);
                    localServiceSecuritySettings.SetProperty(AdministrationStrings.ReconnectTransportOnFailure, specificElement.LocalServiceSettings.ReconnectTransportOnFailure);
                    localServiceSecuritySettings.SetProperty(AdministrationStrings.ReplayCacheSize, specificElement.LocalServiceSettings.ReplayCacheSize);
                    localServiceSecuritySettings.SetProperty(AdministrationStrings.ReplayWindow, specificElement.LocalServiceSettings.ReplayWindow);
                    localServiceSecuritySettings.SetProperty(AdministrationStrings.SessionKeyRenewalInterval, specificElement.LocalServiceSettings.SessionKeyRenewalInterval);
                    localServiceSecuritySettings.SetProperty(AdministrationStrings.SessionKeyRolloverInterval, specificElement.LocalServiceSettings.SessionKeyRolloverInterval);
                    localServiceSecuritySettings.SetProperty(AdministrationStrings.TimestampValidityDuration, specificElement.LocalServiceSettings.TimestampValidityDuration);
                    instance.SetProperty(AdministrationStrings.LocalServiceSecuritySettings, localServiceSecuritySettings);

                    if (bindingElement is AsymmetricSecurityBindingElement)
                    {
                        AsymmetricSecurityBindingElement specificElement1 = (AsymmetricSecurityBindingElement)bindingElement;

                        instance.SetProperty(AdministrationStrings.MessageProtectionOrder, specificElement1.MessageProtectionOrder.ToString());
                        instance.SetProperty(AdministrationStrings.RequireSignatureConfirmation, specificElement1.RequireSignatureConfirmation);
                    }
                    else if (bindingElement is SymmetricSecurityBindingElement)
                    {
                        SymmetricSecurityBindingElement specificElement1 = (SymmetricSecurityBindingElement)bindingElement;

                        instance.SetProperty(AdministrationStrings.MessageProtectionOrder, specificElement1.MessageProtectionOrder.ToString());
                        instance.SetProperty(AdministrationStrings.RequireSignatureConfirmation, specificElement1.RequireSignatureConfirmation);
                    }
                }
                else if (bindingElement is WindowsStreamSecurityBindingElement)
                {
                    WindowsStreamSecurityBindingElement specificElement
                        = (WindowsStreamSecurityBindingElement)bindingElement;
                    instance.SetProperty(AdministrationStrings.ProtectionLevel, specificElement.ProtectionLevel.ToString());
                }
                else if (bindingElement is SslStreamSecurityBindingElement)
                {
                    SslStreamSecurityBindingElement specificElement = (SslStreamSecurityBindingElement)bindingElement;
                    instance.SetProperty(AdministrationStrings.RequireClientCertificate, specificElement.RequireClientCertificate);
                }
                else if (bindingElement is CompositeDuplexBindingElement)
                {
                    CompositeDuplexBindingElement specificElement = (CompositeDuplexBindingElement)bindingElement;
                    if (specificElement.ClientBaseAddress != null)
                    {
                        instance.SetProperty(AdministrationStrings.ClientBaseAddress, specificElement.ClientBaseAddress.AbsoluteUri);
                    }
                }
                else if (bindingElement is OneWayBindingElement)
                {
                    OneWayBindingElement oneWay = (OneWayBindingElement)bindingElement;
                    IWmiInstance         channelPoolSettings = instance.NewInstance(AdministrationStrings.ChannelPoolSettings);
                    channelPoolSettings.SetProperty(AdministrationStrings.IdleTimeout, oneWay.ChannelPoolSettings.IdleTimeout);
                    channelPoolSettings.SetProperty(AdministrationStrings.LeaseTimeout, oneWay.ChannelPoolSettings.LeaseTimeout);
                    channelPoolSettings.SetProperty(AdministrationStrings.MaxOutboundChannelsPerEndpoint, oneWay.ChannelPoolSettings.MaxOutboundChannelsPerEndpoint);
                    instance.SetProperty(AdministrationStrings.ChannelPoolSettings, channelPoolSettings);
                    instance.SetProperty(AdministrationStrings.PacketRoutable, oneWay.PacketRoutable);
                    instance.SetProperty(AdministrationStrings.MaxAcceptedChannels, oneWay.MaxAcceptedChannels);
                }
                else if (bindingElement is MessageEncodingBindingElement)
                {
                    MessageEncodingBindingElement encodingElement = (MessageEncodingBindingElement)bindingElement;

                    instance.SetProperty(AdministrationStrings.MessageVersion, encodingElement.MessageVersion.ToString());

                    if (bindingElement is BinaryMessageEncodingBindingElement)
                    {
                        BinaryMessageEncodingBindingElement specificElement = (BinaryMessageEncodingBindingElement)bindingElement;
                        instance.SetProperty(AdministrationStrings.MaxSessionSize, specificElement.MaxSessionSize);
                        instance.SetProperty(AdministrationStrings.MaxReadPoolSize, specificElement.MaxReadPoolSize);
                        instance.SetProperty(AdministrationStrings.MaxWritePoolSize, specificElement.MaxWritePoolSize);
                        if (null != specificElement.ReaderQuotas)
                        {
                            FillReaderQuotas(instance, specificElement.ReaderQuotas);
                        }
                        instance.SetProperty(AdministrationStrings.CompressionFormat, specificElement.CompressionFormat.ToString());
                    }
                    else if (bindingElement is TextMessageEncodingBindingElement)
                    {
                        TextMessageEncodingBindingElement specificElement = (TextMessageEncodingBindingElement)bindingElement;
                        instance.SetProperty(AdministrationStrings.Encoding, specificElement.WriteEncoding.WebName);
                        instance.SetProperty(AdministrationStrings.MaxReadPoolSize, specificElement.MaxReadPoolSize);
                        instance.SetProperty(AdministrationStrings.MaxWritePoolSize, specificElement.MaxWritePoolSize);
                        if (null != specificElement.ReaderQuotas)
                        {
                            FillReaderQuotas(instance, specificElement.ReaderQuotas);
                        }
                    }
                    else if (bindingElement is MtomMessageEncodingBindingElement)
                    {
                        MtomMessageEncodingBindingElement specificElement = (MtomMessageEncodingBindingElement)bindingElement;
                        instance.SetProperty(AdministrationStrings.Encoding, specificElement.WriteEncoding.WebName);
                        instance.SetProperty(AdministrationStrings.MessageVersion, specificElement.MessageVersion.ToString());
                        instance.SetProperty(AdministrationStrings.MaxReadPoolSize, specificElement.MaxReadPoolSize);
                        instance.SetProperty(AdministrationStrings.MaxWritePoolSize, specificElement.MaxWritePoolSize);
                        if (null != specificElement.ReaderQuotas)
                        {
                            FillReaderQuotas(instance, specificElement.ReaderQuotas);
                        }
                    }
                }
                else if (bindingElement is TransactionFlowBindingElement)
                {
                    TransactionFlowBindingElement specificElement = (TransactionFlowBindingElement)bindingElement;
                    instance.SetProperty(AdministrationStrings.TransactionFlow, specificElement.Transactions);
                    instance.SetProperty(AdministrationStrings.TransactionProtocol, specificElement.TransactionProtocol.ToString());
                    instance.SetProperty(AdministrationStrings.AllowWildcardAction, specificElement.AllowWildcardAction);
                }
                else if (bindingElement is PrivacyNoticeBindingElement)
                {
                    PrivacyNoticeBindingElement specificElement = (PrivacyNoticeBindingElement)bindingElement;
                    instance.SetProperty(AdministrationStrings.Url, specificElement.Url.ToString());
                    instance.SetProperty(AdministrationStrings.PrivacyNoticeVersion, specificElement.Version);
                }
            }
        }
 private static void FillBindingInfo(BindingElement bindingElement, ref IWmiInstance instance)
 {
     if (bindingElement is IWmiInstanceProvider)
     {
         IWmiInstanceProvider provider = (IWmiInstanceProvider)bindingElement;
         instance = instance.NewInstance(provider.GetInstanceType());
         provider.FillInstance(instance);
     }
     else
     {
         System.Type serviceModelBaseType = AdministrationHelpers.GetServiceModelBaseType(bindingElement.GetType());
         if (null != serviceModelBaseType)
         {
             instance = instance.NewInstance(serviceModelBaseType.Name);
             if (bindingElement is TransportBindingElement)
             {
                 TransportBindingElement element = (TransportBindingElement)bindingElement;
                 instance.SetProperty("ManualAddressing", element.ManualAddressing);
                 instance.SetProperty("MaxReceivedMessageSize", element.MaxReceivedMessageSize);
                 instance.SetProperty("MaxBufferPoolSize", element.MaxBufferPoolSize);
                 instance.SetProperty("Scheme", element.Scheme);
                 if (bindingElement is ConnectionOrientedTransportBindingElement)
                 {
                     ConnectionOrientedTransportBindingElement element2 = (ConnectionOrientedTransportBindingElement)bindingElement;
                     instance.SetProperty("ConnectionBufferSize", element2.ConnectionBufferSize);
                     instance.SetProperty("HostNameComparisonMode", element2.HostNameComparisonMode.ToString());
                     instance.SetProperty("ChannelInitializationTimeout", element2.ChannelInitializationTimeout);
                     instance.SetProperty("MaxBufferSize", element2.MaxBufferSize);
                     instance.SetProperty("MaxPendingConnections", element2.MaxPendingConnections);
                     instance.SetProperty("MaxOutputDelay", element2.MaxOutputDelay);
                     instance.SetProperty("MaxPendingAccepts", element2.MaxPendingAccepts);
                     instance.SetProperty("TransferMode", element2.TransferMode.ToString());
                     if (bindingElement is TcpTransportBindingElement)
                     {
                         TcpTransportBindingElement element3 = (TcpTransportBindingElement)bindingElement;
                         instance.SetProperty("ListenBacklog", element3.ListenBacklog);
                         instance.SetProperty("PortSharingEnabled", element3.PortSharingEnabled);
                         instance.SetProperty("TeredoEnabled", element3.TeredoEnabled);
                         IWmiInstance instance2 = instance.NewInstance("TcpConnectionPoolSettings");
                         instance2.SetProperty("GroupName", element3.ConnectionPoolSettings.GroupName);
                         instance2.SetProperty("IdleTimeout", element3.ConnectionPoolSettings.IdleTimeout);
                         instance2.SetProperty("LeaseTimeout", element3.ConnectionPoolSettings.LeaseTimeout);
                         instance2.SetProperty("MaxOutboundConnectionsPerEndpoint", element3.ConnectionPoolSettings.MaxOutboundConnectionsPerEndpoint);
                         instance.SetProperty("ConnectionPoolSettings", instance2);
                         FillExtendedProtectionPolicy(instance, element3.ExtendedProtectionPolicy);
                     }
                     else if (bindingElement is NamedPipeTransportBindingElement)
                     {
                         NamedPipeTransportBindingElement element4 = (NamedPipeTransportBindingElement)bindingElement;
                         IWmiInstance instance3 = instance.NewInstance("NamedPipeConnectionPoolSettings");
                         instance3.SetProperty("GroupName", element4.ConnectionPoolSettings.GroupName);
                         instance3.SetProperty("IdleTimeout", element4.ConnectionPoolSettings.IdleTimeout);
                         instance3.SetProperty("MaxOutboundConnectionsPerEndpoint", element4.ConnectionPoolSettings.MaxOutboundConnectionsPerEndpoint);
                         instance.SetProperty("ConnectionPoolSettings", instance3);
                     }
                 }
                 else if (!(bindingElement is HttpTransportBindingElement))
                 {
                     if (!(bindingElement is MsmqBindingElementBase))
                     {
                         if (bindingElement is PeerTransportBindingElement)
                         {
                             PeerTransportBindingElement element9 = (PeerTransportBindingElement)bindingElement;
                             instance.SetProperty("ListenIPAddress", element9.ListenIPAddress);
                             instance.SetProperty("Port", element9.Port);
                             IWmiInstance instance4 = instance.NewInstance("PeerSecuritySettings");
                             instance4.SetProperty("Mode", element9.Security.Mode.ToString());
                             IWmiInstance instance5 = instance4.NewInstance("PeerTransportSecuritySettings");
                             instance5.SetProperty("CredentialType", element9.Security.Transport.CredentialType.ToString());
                             instance4.SetProperty("Transport", instance5);
                             instance.SetProperty("Security", instance4);
                         }
                     }
                     else
                     {
                         MsmqBindingElementBase base2 = (MsmqBindingElementBase)bindingElement;
                         if (null != base2.CustomDeadLetterQueue)
                         {
                             instance.SetProperty("CustomDeadLetterQueue", base2.CustomDeadLetterQueue.AbsoluteUri.ToString());
                         }
                         instance.SetProperty("DeadLetterQueue", base2.DeadLetterQueue);
                         instance.SetProperty("Durable", base2.Durable);
                         instance.SetProperty("ExactlyOnce", base2.ExactlyOnce);
                         instance.SetProperty("MaxRetryCycles", base2.MaxRetryCycles);
                         instance.SetProperty("ReceiveContextEnabled", base2.ReceiveContextEnabled);
                         instance.SetProperty("ReceiveErrorHandling", base2.ReceiveErrorHandling);
                         instance.SetProperty("ReceiveRetryCount", base2.ReceiveRetryCount);
                         instance.SetProperty("RetryCycleDelay", base2.RetryCycleDelay);
                         instance.SetProperty("TimeToLive", base2.TimeToLive);
                         instance.SetProperty("UseSourceJournal", base2.UseSourceJournal);
                         instance.SetProperty("UseMsmqTracing", base2.UseMsmqTracing);
                         instance.SetProperty("ValidityDuration", base2.ValidityDuration);
                         MsmqTransportBindingElement element7 = base2 as MsmqTransportBindingElement;
                         if (element7 != null)
                         {
                             instance.SetProperty("MaxPoolSize", element7.MaxPoolSize);
                             instance.SetProperty("QueueTransferProtocol", element7.QueueTransferProtocol);
                             instance.SetProperty("UseActiveDirectory", element7.UseActiveDirectory);
                         }
                         MsmqIntegrationBindingElement element8 = base2 as MsmqIntegrationBindingElement;
                         if (element8 != null)
                         {
                             instance.SetProperty("SerializationFormat", element8.SerializationFormat.ToString());
                         }
                     }
                 }
                 else
                 {
                     HttpTransportBindingElement element5 = (HttpTransportBindingElement)bindingElement;
                     instance.SetProperty("AllowCookies", element5.AllowCookies);
                     instance.SetProperty("AuthenticationScheme", element5.AuthenticationScheme.ToString());
                     instance.SetProperty("BypassProxyOnLocal", element5.BypassProxyOnLocal);
                     instance.SetProperty("DecompressionEnabled", element5.DecompressionEnabled);
                     instance.SetProperty("HostNameComparisonMode", element5.HostNameComparisonMode.ToString());
                     instance.SetProperty("KeepAliveEnabled", element5.KeepAliveEnabled);
                     instance.SetProperty("MaxBufferSize", element5.MaxBufferSize);
                     if (null != element5.ProxyAddress)
                     {
                         instance.SetProperty("ProxyAddress", element5.ProxyAddress.AbsoluteUri.ToString());
                     }
                     instance.SetProperty("ProxyAuthenticationScheme", element5.ProxyAuthenticationScheme.ToString());
                     instance.SetProperty("Realm", element5.Realm);
                     instance.SetProperty("TransferMode", element5.TransferMode.ToString());
                     instance.SetProperty("UnsafeConnectionNtlmAuthentication", element5.UnsafeConnectionNtlmAuthentication);
                     instance.SetProperty("UseDefaultWebProxy", element5.UseDefaultWebProxy);
                     FillExtendedProtectionPolicy(instance, element5.ExtendedProtectionPolicy);
                     if (bindingElement is HttpsTransportBindingElement)
                     {
                         HttpsTransportBindingElement element6 = (HttpsTransportBindingElement)bindingElement;
                         instance.SetProperty("RequireClientCertificate", element6.RequireClientCertificate);
                     }
                 }
             }
             else if (bindingElement is PeerResolverBindingElement)
             {
                 PeerResolverBindingElement element10 = (PeerResolverBindingElement)bindingElement;
                 instance.SetProperty("ReferralPolicy", element10.ReferralPolicy.ToString());
                 if (bindingElement is PeerCustomResolverBindingElement)
                 {
                     PeerCustomResolverBindingElement element11 = (PeerCustomResolverBindingElement)bindingElement;
                     if (element11.Address != null)
                     {
                         instance.SetProperty("Address", element11.Address.ToString());
                     }
                     if (element11.Binding != null)
                     {
                         instance.SetProperty("Binding", element11.Binding.ToString());
                     }
                 }
             }
             else if (bindingElement is ReliableSessionBindingElement)
             {
                 ReliableSessionBindingElement element12 = (ReliableSessionBindingElement)bindingElement;
                 instance.SetProperty("AcknowledgementInterval", element12.AcknowledgementInterval);
                 instance.SetProperty("FlowControlEnabled", element12.FlowControlEnabled);
                 instance.SetProperty("InactivityTimeout", element12.InactivityTimeout);
                 instance.SetProperty("MaxPendingChannels", element12.MaxPendingChannels);
                 instance.SetProperty("MaxRetryCount", element12.MaxRetryCount);
                 instance.SetProperty("MaxTransferWindowSize", element12.MaxTransferWindowSize);
                 instance.SetProperty("Ordered", element12.Ordered);
                 instance.SetProperty("ReliableMessagingVersion", element12.ReliableMessagingVersion.ToString());
             }
             else if (bindingElement is SecurityBindingElement)
             {
                 SecurityBindingElement element13 = (SecurityBindingElement)bindingElement;
                 instance.SetProperty("AllowInsecureTransport", element13.AllowInsecureTransport);
                 instance.SetProperty("DefaultAlgorithmSuite", element13.DefaultAlgorithmSuite.ToString());
                 instance.SetProperty("EnableUnsecuredResponse", element13.EnableUnsecuredResponse);
                 instance.SetProperty("IncludeTimestamp", element13.IncludeTimestamp);
                 instance.SetProperty("KeyEntropyMode", element13.KeyEntropyMode.ToString());
                 instance.SetProperty("SecurityHeaderLayout", element13.SecurityHeaderLayout.ToString());
                 instance.SetProperty("MessageSecurityVersion", element13.MessageSecurityVersion.ToString());
                 IWmiInstance instance6 = instance.NewInstance("LocalServiceSecuritySettings");
                 instance6.SetProperty("DetectReplays", element13.LocalServiceSettings.DetectReplays);
                 instance6.SetProperty("InactivityTimeout", element13.LocalServiceSettings.InactivityTimeout);
                 instance6.SetProperty("IssuedCookieLifetime", element13.LocalServiceSettings.IssuedCookieLifetime);
                 instance6.SetProperty("MaxCachedCookies", element13.LocalServiceSettings.MaxCachedCookies);
                 instance6.SetProperty("MaxClockSkew", element13.LocalServiceSettings.MaxClockSkew);
                 instance6.SetProperty("MaxPendingSessions", element13.LocalServiceSettings.MaxPendingSessions);
                 instance6.SetProperty("MaxStatefulNegotiations", element13.LocalServiceSettings.MaxStatefulNegotiations);
                 instance6.SetProperty("NegotiationTimeout", element13.LocalServiceSettings.NegotiationTimeout);
                 instance6.SetProperty("ReconnectTransportOnFailure", element13.LocalServiceSettings.ReconnectTransportOnFailure);
                 instance6.SetProperty("ReplayCacheSize", element13.LocalServiceSettings.ReplayCacheSize);
                 instance6.SetProperty("ReplayWindow", element13.LocalServiceSettings.ReplayWindow);
                 instance6.SetProperty("SessionKeyRenewalInterval", element13.LocalServiceSettings.SessionKeyRenewalInterval);
                 instance6.SetProperty("SessionKeyRolloverInterval", element13.LocalServiceSettings.SessionKeyRolloverInterval);
                 instance6.SetProperty("TimestampValidityDuration", element13.LocalServiceSettings.TimestampValidityDuration);
                 instance.SetProperty("LocalServiceSecuritySettings", instance6);
                 if (bindingElement is AsymmetricSecurityBindingElement)
                 {
                     AsymmetricSecurityBindingElement element14 = (AsymmetricSecurityBindingElement)bindingElement;
                     instance.SetProperty("MessageProtectionOrder", element14.MessageProtectionOrder.ToString());
                     instance.SetProperty("RequireSignatureConfirmation", element14.RequireSignatureConfirmation);
                 }
                 else if (bindingElement is SymmetricSecurityBindingElement)
                 {
                     SymmetricSecurityBindingElement element15 = (SymmetricSecurityBindingElement)bindingElement;
                     instance.SetProperty("MessageProtectionOrder", element15.MessageProtectionOrder.ToString());
                     instance.SetProperty("RequireSignatureConfirmation", element15.RequireSignatureConfirmation);
                 }
             }
             else if (bindingElement is WindowsStreamSecurityBindingElement)
             {
                 WindowsStreamSecurityBindingElement element16 = (WindowsStreamSecurityBindingElement)bindingElement;
                 instance.SetProperty("ProtectionLevel", element16.ProtectionLevel.ToString());
             }
             else if (bindingElement is SslStreamSecurityBindingElement)
             {
                 SslStreamSecurityBindingElement element17 = (SslStreamSecurityBindingElement)bindingElement;
                 instance.SetProperty("RequireClientCertificate", element17.RequireClientCertificate);
             }
             else if (bindingElement is CompositeDuplexBindingElement)
             {
                 CompositeDuplexBindingElement element18 = (CompositeDuplexBindingElement)bindingElement;
                 if (element18.ClientBaseAddress != null)
                 {
                     instance.SetProperty("ClientBaseAddress", element18.ClientBaseAddress.AbsoluteUri);
                 }
             }
             else if (bindingElement is OneWayBindingElement)
             {
                 OneWayBindingElement element19 = (OneWayBindingElement)bindingElement;
                 IWmiInstance         instance7 = instance.NewInstance("ChannelPoolSettings");
                 instance7.SetProperty("IdleTimeout", element19.ChannelPoolSettings.IdleTimeout);
                 instance7.SetProperty("LeaseTimeout", element19.ChannelPoolSettings.LeaseTimeout);
                 instance7.SetProperty("MaxOutboundChannelsPerEndpoint", element19.ChannelPoolSettings.MaxOutboundChannelsPerEndpoint);
                 instance.SetProperty("ChannelPoolSettings", instance7);
                 instance.SetProperty("PacketRoutable", element19.PacketRoutable);
                 instance.SetProperty("MaxAcceptedChannels", element19.MaxAcceptedChannels);
             }
             else if (bindingElement is MessageEncodingBindingElement)
             {
                 MessageEncodingBindingElement element20 = (MessageEncodingBindingElement)bindingElement;
                 instance.SetProperty("MessageVersion", element20.MessageVersion.ToString());
                 if (bindingElement is BinaryMessageEncodingBindingElement)
                 {
                     BinaryMessageEncodingBindingElement element21 = (BinaryMessageEncodingBindingElement)bindingElement;
                     instance.SetProperty("MaxSessionSize", element21.MaxSessionSize);
                     instance.SetProperty("MaxReadPoolSize", element21.MaxReadPoolSize);
                     instance.SetProperty("MaxWritePoolSize", element21.MaxWritePoolSize);
                     if (element21.ReaderQuotas != null)
                     {
                         FillReaderQuotas(instance, element21.ReaderQuotas);
                     }
                 }
                 else if (!(bindingElement is TextMessageEncodingBindingElement))
                 {
                     if (bindingElement is MtomMessageEncodingBindingElement)
                     {
                         MtomMessageEncodingBindingElement element23 = (MtomMessageEncodingBindingElement)bindingElement;
                         instance.SetProperty("Encoding", element23.WriteEncoding.WebName);
                         instance.SetProperty("MessageVersion", element23.MessageVersion.ToString());
                         instance.SetProperty("MaxReadPoolSize", element23.MaxReadPoolSize);
                         instance.SetProperty("MaxWritePoolSize", element23.MaxWritePoolSize);
                         if (element23.ReaderQuotas != null)
                         {
                             FillReaderQuotas(instance, element23.ReaderQuotas);
                         }
                     }
                 }
                 else
                 {
                     TextMessageEncodingBindingElement element22 = (TextMessageEncodingBindingElement)bindingElement;
                     instance.SetProperty("Encoding", element22.WriteEncoding.WebName);
                     instance.SetProperty("MaxReadPoolSize", element22.MaxReadPoolSize);
                     instance.SetProperty("MaxWritePoolSize", element22.MaxWritePoolSize);
                     if (element22.ReaderQuotas != null)
                     {
                         FillReaderQuotas(instance, element22.ReaderQuotas);
                     }
                 }
             }
             else if (bindingElement is TransactionFlowBindingElement)
             {
                 TransactionFlowBindingElement element24 = (TransactionFlowBindingElement)bindingElement;
                 instance.SetProperty("TransactionFlow", element24.Transactions);
                 instance.SetProperty("TransactionProtocol", element24.TransactionProtocol.ToString());
                 instance.SetProperty("AllowWildcardAction", element24.AllowWildcardAction);
             }
             else if (bindingElement is PrivacyNoticeBindingElement)
             {
                 PrivacyNoticeBindingElement element25 = (PrivacyNoticeBindingElement)bindingElement;
                 instance.SetProperty("Url", element25.Url.ToString());
                 instance.SetProperty("PrivacyNoticeVersion", element25.Version);
             }
         }
     }
 }