static void FillBehaviorInfo(IContractBehavior behavior, IWmiInstance existingInstance, out IWmiInstance instance)
 {
     Fx.Assert(null != existingInstance, "");
     Fx.Assert(null != behavior, "");
     instance = null;
     if (behavior is DeliveryRequirementsAttribute)
     {
         instance = existingInstance.NewInstance("DeliveryRequirementsAttribute");
         DeliveryRequirementsAttribute specificBehavior = (DeliveryRequirementsAttribute)behavior;
         instance.SetProperty(AdministrationStrings.QueuedDeliveryRequirements, specificBehavior.QueuedDeliveryRequirements.ToString());
         instance.SetProperty(AdministrationStrings.RequireOrderedDelivery, specificBehavior.RequireOrderedDelivery);
         if (null != specificBehavior.TargetContract)
         {
             instance.SetProperty(AdministrationStrings.TargetContract, specificBehavior.TargetContract.ToString());
         }
     }
     else if (behavior is IWmiInstanceProvider)
     {
         IWmiInstanceProvider instanceProvider = (IWmiInstanceProvider)behavior;
         instance = existingInstance.NewInstance(instanceProvider.GetInstanceType());
         instanceProvider.FillInstance(instance);
     }
     else
     {
         instance = existingInstance.NewInstance("Behavior");
     }
     if (null != instance)
     {
         instance.SetProperty(AdministrationStrings.Type, behavior.GetType().FullName);
     }
 }
 private static void FillBehaviorInfo(IContractBehavior behavior, IWmiInstance existingInstance, out IWmiInstance instance)
 {
     instance = null;
     if (behavior is DeliveryRequirementsAttribute)
     {
         instance = existingInstance.NewInstance("DeliveryRequirementsAttribute");
         DeliveryRequirementsAttribute attribute = (DeliveryRequirementsAttribute)behavior;
         instance.SetProperty("QueuedDeliveryRequirements", attribute.QueuedDeliveryRequirements.ToString());
         instance.SetProperty("RequireOrderedDelivery", attribute.RequireOrderedDelivery);
         if (null != attribute.TargetContract)
         {
             instance.SetProperty("TargetContract", attribute.TargetContract.ToString());
         }
     }
     else if (behavior is IWmiInstanceProvider)
     {
         IWmiInstanceProvider provider = (IWmiInstanceProvider)behavior;
         instance = existingInstance.NewInstance(provider.GetInstanceType());
         provider.FillInstance(instance);
     }
     else
     {
         instance = existingInstance.NewInstance("Behavior");
     }
     if (instance != null)
     {
         instance.SetProperty("Type", behavior.GetType().FullName);
     }
 }
 static void FillBehaviorInfo(IOperationBehavior behavior, IWmiInstance existingInstance, out IWmiInstance instance)
 {
     Fx.Assert(null != existingInstance, "");
     Fx.Assert(null != behavior, "");
     instance = null;
     if (behavior is DataContractSerializerOperationBehavior)
     {
         instance = existingInstance.NewInstance("DataContractSerializerOperationBehavior");
         DataContractSerializerOperationBehavior specificBehavior = (DataContractSerializerOperationBehavior)behavior;
         instance.SetProperty(AdministrationStrings.IgnoreExtensionDataObject, specificBehavior.IgnoreExtensionDataObject);
         instance.SetProperty(AdministrationStrings.MaxItemsInObjectGraph, specificBehavior.MaxItemsInObjectGraph);
         if (null != specificBehavior.DataContractFormatAttribute)
         {
             instance.SetProperty(AdministrationStrings.Style, specificBehavior.DataContractFormatAttribute.Style.ToString());
         }
     }
     else if (behavior is OperationBehaviorAttribute)
     {
         instance = existingInstance.NewInstance("OperationBehaviorAttribute");
         OperationBehaviorAttribute specificBehavior = (OperationBehaviorAttribute)behavior;
         instance.SetProperty(AdministrationStrings.AutoDisposeParameters, specificBehavior.AutoDisposeParameters);
         instance.SetProperty(AdministrationStrings.Impersonation, specificBehavior.Impersonation.ToString());
         instance.SetProperty(AdministrationStrings.ReleaseInstanceMode, specificBehavior.ReleaseInstanceMode.ToString());
         instance.SetProperty(AdministrationStrings.TransactionAutoComplete, specificBehavior.TransactionAutoComplete);
         instance.SetProperty(AdministrationStrings.TransactionScopeRequired, specificBehavior.TransactionScopeRequired);
     }
     else if (behavior is TransactionFlowAttribute)
     {
         instance = existingInstance.NewInstance("TransactionFlowAttribute");
         TransactionFlowAttribute specificBehavior = (TransactionFlowAttribute)behavior;
         instance.SetProperty(AdministrationStrings.TransactionFlowOption, specificBehavior.Transactions.ToString());
     }
     else if (behavior is XmlSerializerOperationBehavior)
     {
         instance = existingInstance.NewInstance("XmlSerializerOperationBehavior");
         XmlSerializerOperationBehavior specificBehavior = (XmlSerializerOperationBehavior)behavior;
         if (null != specificBehavior.XmlSerializerFormatAttribute)
         {
             instance.SetProperty(AdministrationStrings.Style, specificBehavior.XmlSerializerFormatAttribute.Style.ToString());
             instance.SetProperty(AdministrationStrings.Use, specificBehavior.XmlSerializerFormatAttribute.Use.ToString());
             instance.SetProperty(AdministrationStrings.SupportFaults, specificBehavior.XmlSerializerFormatAttribute.SupportFaults.ToString());
         }
     }
     else if (behavior is IWmiInstanceProvider)
     {
         IWmiInstanceProvider instanceProvider = (IWmiInstanceProvider)behavior;
         instance = existingInstance.NewInstance(instanceProvider.GetInstanceType());
         instanceProvider.FillInstance(instance);
     }
     else
     {
         instance = existingInstance.NewInstance("Behavior");
     }
     if (null != instance)
     {
         instance.SetProperty(AdministrationStrings.Type, behavior.GetType().FullName);
     }
 }
 private static void FillBehaviorInfo(IOperationBehavior behavior, IWmiInstance existingInstance, out IWmiInstance instance)
 {
     instance = null;
     if (behavior is DataContractSerializerOperationBehavior)
     {
         instance = existingInstance.NewInstance("DataContractSerializerOperationBehavior");
         DataContractSerializerOperationBehavior behavior2 = (DataContractSerializerOperationBehavior)behavior;
         instance.SetProperty("IgnoreExtensionDataObject", behavior2.IgnoreExtensionDataObject);
         instance.SetProperty("MaxItemsInObjectGraph", behavior2.MaxItemsInObjectGraph);
         if (behavior2.DataContractFormatAttribute != null)
         {
             instance.SetProperty("Style", behavior2.DataContractFormatAttribute.Style.ToString());
         }
     }
     else if (behavior is OperationBehaviorAttribute)
     {
         instance = existingInstance.NewInstance("OperationBehaviorAttribute");
         OperationBehaviorAttribute attribute = (OperationBehaviorAttribute)behavior;
         instance.SetProperty("AutoDisposeParameters", attribute.AutoDisposeParameters);
         instance.SetProperty("Impersonation", attribute.Impersonation.ToString());
         instance.SetProperty("ReleaseInstanceMode", attribute.ReleaseInstanceMode.ToString());
         instance.SetProperty("TransactionAutoComplete", attribute.TransactionAutoComplete);
         instance.SetProperty("TransactionScopeRequired", attribute.TransactionScopeRequired);
     }
     else if (behavior is TransactionFlowAttribute)
     {
         instance = existingInstance.NewInstance("TransactionFlowAttribute");
         TransactionFlowAttribute attribute2 = (TransactionFlowAttribute)behavior;
         instance.SetProperty("TransactionFlowOption", attribute2.Transactions.ToString());
     }
     else if (behavior is XmlSerializerOperationBehavior)
     {
         instance = existingInstance.NewInstance("XmlSerializerOperationBehavior");
         XmlSerializerOperationBehavior behavior3 = (XmlSerializerOperationBehavior)behavior;
         if (behavior3.XmlSerializerFormatAttribute != null)
         {
             instance.SetProperty("Style", behavior3.XmlSerializerFormatAttribute.Style.ToString());
             instance.SetProperty("Use", behavior3.XmlSerializerFormatAttribute.Use.ToString());
             instance.SetProperty("SupportFaults", behavior3.XmlSerializerFormatAttribute.SupportFaults.ToString());
         }
     }
     else if (behavior is IWmiInstanceProvider)
     {
         IWmiInstanceProvider provider = (IWmiInstanceProvider)behavior;
         instance = existingInstance.NewInstance(provider.GetInstanceType());
         provider.FillInstance(instance);
     }
     else
     {
         instance = existingInstance.NewInstance("Behavior");
     }
     if (instance != null)
     {
         instance.SetProperty("Type", behavior.GetType().FullName);
     }
 }
Example #5
0
        void FillBehaviorInfo(IServiceBehavior behavior, IWmiInstance existingInstance, out IWmiInstance instance)
        {
            Fx.Assert(null != existingInstance, "");
            Fx.Assert(null != behavior, "");
            instance = null;
            if (behavior is AspNetCompatibilityRequirementsAttribute)
            {
                instance = existingInstance.NewInstance("AspNetCompatibilityRequirementsAttribute");
                AspNetCompatibilityRequirementsAttribute specificBehavior = (AspNetCompatibilityRequirementsAttribute)behavior;
                instance.SetProperty(AdministrationStrings.RequirementsMode, specificBehavior.RequirementsMode.ToString());
            }
            else if (behavior is ServiceCredentials)
            {
                instance = existingInstance.NewInstance("ServiceCredentials");
                ServiceCredentials specificBehavior = (ServiceCredentials)behavior;
                if (specificBehavior.ClientCertificate != null && specificBehavior.ClientCertificate.Certificate != null)
                {
                    string result = string.Empty;
                    result += String.Format(CultureInfo.InvariantCulture, "Certificate: {0}\n", specificBehavior.ClientCertificate.Certificate);
                    instance.SetProperty(AdministrationStrings.ClientCertificate, result);
                }
                if (specificBehavior.IssuedTokenAuthentication != null && specificBehavior.IssuedTokenAuthentication.KnownCertificates != null)
                {
                    string result = string.Empty;
                    result += String.Format(CultureInfo.InvariantCulture, "AllowUntrustedRsaIssuers: {0}\n", specificBehavior.IssuedTokenAuthentication.AllowUntrustedRsaIssuers);
                    result += String.Format(CultureInfo.InvariantCulture, "CertificateValidationMode: {0}\n", specificBehavior.IssuedTokenAuthentication.CertificateValidationMode);
                    result += String.Format(CultureInfo.InvariantCulture, "RevocationMode: {0}\n", specificBehavior.IssuedTokenAuthentication.RevocationMode);
                    result += String.Format(CultureInfo.InvariantCulture, "TrustedStoreLocation: {0}\n", specificBehavior.IssuedTokenAuthentication.TrustedStoreLocation);
                    foreach (X509Certificate2 certificate in specificBehavior.IssuedTokenAuthentication.KnownCertificates)
                    {
                        if (certificate != null)
                        {
                            result += String.Format(CultureInfo.InvariantCulture, "Known certificate: {0}\n", certificate.FriendlyName);
                        }
                    }
                    result += String.Format(CultureInfo.InvariantCulture, "AudienceUriMode: {0}\n", specificBehavior.IssuedTokenAuthentication.AudienceUriMode);
                    if (specificBehavior.IssuedTokenAuthentication.AllowedAudienceUris != null)
                    {
                        foreach (string str in specificBehavior.IssuedTokenAuthentication.AllowedAudienceUris)
                        {
                            if (str != null)
                            {
                                result += String.Format(CultureInfo.InvariantCulture, "Allowed Uri: {0}\n", str);
                            }
                        }
                    }

                    instance.SetProperty(AdministrationStrings.IssuedTokenAuthentication, result);
                }
                if (specificBehavior.Peer != null && specificBehavior.Peer.Certificate != null)
                {
                    string result = string.Empty;
                    result += String.Format(CultureInfo.InvariantCulture, "Certificate: {0}\n", specificBehavior.Peer.Certificate.ToString(true));
                    instance.SetProperty(AdministrationStrings.Peer, result);
                }
                if (specificBehavior.SecureConversationAuthentication != null && specificBehavior.SecureConversationAuthentication.SecurityContextClaimTypes != null)
                {
                    string result = string.Empty;
                    foreach (Type claimType in specificBehavior.SecureConversationAuthentication.SecurityContextClaimTypes)
                    {
                        if (claimType != null)
                        {
                            result += String.Format(CultureInfo.InvariantCulture, "ClaimType: {0}\n", claimType);
                        }
                    }
                    instance.SetProperty(AdministrationStrings.SecureConversationAuthentication, result);
                }
                if (specificBehavior.ServiceCertificate != null && specificBehavior.ServiceCertificate.Certificate != null)
                {
                    instance.SetProperty(AdministrationStrings.ServiceCertificate, specificBehavior.ServiceCertificate.Certificate.ToString());
                }
                if (specificBehavior.UserNameAuthentication != null)
                {
                    instance.SetProperty(AdministrationStrings.UserNameAuthentication, String.Format(CultureInfo.InvariantCulture, "{0}: {1}", AdministrationStrings.ValidationMode, specificBehavior.UserNameAuthentication.UserNamePasswordValidationMode.ToString()));
                }
                if (specificBehavior.WindowsAuthentication != null)
                {
                    instance.SetProperty(AdministrationStrings.WindowsAuthentication, String.Format(CultureInfo.InvariantCulture, "{0}: {1}", AdministrationStrings.AllowAnonymous, specificBehavior.WindowsAuthentication.AllowAnonymousLogons.ToString()));
                }
            }
            else if (behavior is ServiceAuthorizationBehavior)
            {
                instance = existingInstance.NewInstance("ServiceAuthorizationBehavior");
                ServiceAuthorizationBehavior specificBehavior = (ServiceAuthorizationBehavior)behavior;
                instance.SetProperty(AdministrationStrings.ImpersonateCallerForAllOperations, specificBehavior.ImpersonateCallerForAllOperations);
                instance.SetProperty(AdministrationStrings.ImpersonateOnSerializingReply, specificBehavior.ImpersonateOnSerializingReply);
                if (specificBehavior.RoleProvider != null)
                {
                    instance.SetProperty(AdministrationStrings.RoleProvider, specificBehavior.RoleProvider.ToString());
                }
                if (specificBehavior.ServiceAuthorizationManager != null)
                {
                    instance.SetProperty(AdministrationStrings.ServiceAuthorizationManager, specificBehavior.ServiceAuthorizationManager.ToString());
                }
                instance.SetProperty(AdministrationStrings.PrincipalPermissionMode, specificBehavior.PrincipalPermissionMode.ToString());
            }
            else if (behavior is ServiceSecurityAuditBehavior)
            {
                instance = existingInstance.NewInstance("ServiceSecurityAuditBehavior");
                ServiceSecurityAuditBehavior specificBehavior = (ServiceSecurityAuditBehavior)behavior;
                instance.SetProperty(AdministrationStrings.AuditLogLocation, specificBehavior.AuditLogLocation.ToString());
                instance.SetProperty(AdministrationStrings.SuppressAuditFailure, specificBehavior.SuppressAuditFailure);
                instance.SetProperty(AdministrationStrings.ServiceAuthorizationAuditLevel, specificBehavior.ServiceAuthorizationAuditLevel.ToString());
                instance.SetProperty(AdministrationStrings.MessageAuthenticationAuditLevel, specificBehavior.MessageAuthenticationAuditLevel.ToString());
            }
            else if (behavior is ServiceBehaviorAttribute)
            {
                instance = existingInstance.NewInstance("ServiceBehaviorAttribute");
                ServiceBehaviorAttribute serviceBehavior = (ServiceBehaviorAttribute)behavior;
                instance.SetProperty(AdministrationStrings.AddressFilterMode, serviceBehavior.AddressFilterMode.ToString());
                instance.SetProperty(AdministrationStrings.AutomaticSessionShutdown, serviceBehavior.AutomaticSessionShutdown);
                instance.SetProperty(AdministrationStrings.ConcurrencyMode, serviceBehavior.ConcurrencyMode.ToString());
                instance.SetProperty(AdministrationStrings.ConfigurationName, serviceBehavior.ConfigurationName);
                instance.SetProperty(AdministrationStrings.EnsureOrderedDispatch, serviceBehavior.EnsureOrderedDispatch);
                instance.SetProperty(AdministrationStrings.IgnoreExtensionDataObject, serviceBehavior.IgnoreExtensionDataObject);
                instance.SetProperty(AdministrationStrings.IncludeExceptionDetailInFaults, serviceBehavior.IncludeExceptionDetailInFaults);
                instance.SetProperty(AdministrationStrings.InstanceContextMode, serviceBehavior.InstanceContextMode.ToString());
                instance.SetProperty(AdministrationStrings.MaxItemsInObjectGraph, serviceBehavior.MaxItemsInObjectGraph);
                instance.SetProperty(AdministrationStrings.Name, serviceBehavior.Name);
                instance.SetProperty(AdministrationStrings.Namespace, serviceBehavior.Namespace);
                instance.SetProperty(AdministrationStrings.ReleaseServiceInstanceOnTransactionComplete, serviceBehavior.ReleaseServiceInstanceOnTransactionComplete);
                instance.SetProperty(AdministrationStrings.TransactionAutoCompleteOnSessionClose, serviceBehavior.TransactionAutoCompleteOnSessionClose);
                instance.SetProperty(AdministrationStrings.TransactionIsolationLevel, serviceBehavior.TransactionIsolationLevel.ToString());
                if (serviceBehavior.TransactionTimeoutSet)
                {
                    instance.SetProperty(AdministrationStrings.TransactionTimeout, serviceBehavior.TransactionTimeoutTimespan);
                }
                instance.SetProperty(AdministrationStrings.UseSynchronizationContext, serviceBehavior.UseSynchronizationContext);
                instance.SetProperty(AdministrationStrings.ValidateMustUnderstand, serviceBehavior.ValidateMustUnderstand);
            }
            else if (behavior is ServiceDebugBehavior)
            {
                instance = existingInstance.NewInstance("ServiceDebugBehavior");
                ServiceDebugBehavior specificBehavior = (ServiceDebugBehavior)behavior;
                if (null != specificBehavior.HttpHelpPageUrl)
                {
                    instance.SetProperty(AdministrationStrings.HttpHelpPageUrl, specificBehavior.HttpHelpPageUrl.ToString());
                }
                instance.SetProperty(AdministrationStrings.HttpHelpPageEnabled, specificBehavior.HttpHelpPageEnabled);
                if (null != specificBehavior.HttpsHelpPageUrl)
                {
                    instance.SetProperty(AdministrationStrings.HttpsHelpPageUrl, specificBehavior.HttpsHelpPageUrl.ToString());
                }
                instance.SetProperty(AdministrationStrings.HttpsHelpPageEnabled, specificBehavior.HttpsHelpPageEnabled);
                instance.SetProperty(AdministrationStrings.IncludeExceptionDetailInFaults, specificBehavior.IncludeExceptionDetailInFaults);
            }
            else if (behavior is ServiceMetadataBehavior)
            {
                instance = existingInstance.NewInstance("ServiceMetadataBehavior");
                ServiceMetadataBehavior metadataBehavior = (ServiceMetadataBehavior)behavior;
                if (null != metadataBehavior.ExternalMetadataLocation)
                {
                    instance.SetProperty(AdministrationStrings.ExternalMetadataLocation, metadataBehavior.ExternalMetadataLocation.ToString());
                }
                instance.SetProperty(AdministrationStrings.HttpGetEnabled, metadataBehavior.HttpGetEnabled);
                if (null != metadataBehavior.HttpGetUrl)
                {
                    instance.SetProperty(AdministrationStrings.HttpGetUrl, metadataBehavior.HttpGetUrl.ToString());
                }
                instance.SetProperty(AdministrationStrings.HttpsGetEnabled, metadataBehavior.HttpsGetEnabled);
                if (null != metadataBehavior.HttpsGetUrl)
                {
                    instance.SetProperty(AdministrationStrings.HttpsGetUrl, metadataBehavior.HttpsGetUrl.ToString());
                }
                FillMetadataExporterInfo(instance, metadataBehavior.MetadataExporter);
            }
            else if (behavior is ServiceThrottlingBehavior)
            {
                instance = existingInstance.NewInstance("ServiceThrottlingBehavior");
                ServiceThrottlingBehavior throttlingBehavior = (ServiceThrottlingBehavior)behavior;
                instance.SetProperty(AdministrationStrings.MaxConcurrentCalls, throttlingBehavior.MaxConcurrentCalls);
                instance.SetProperty(AdministrationStrings.MaxConcurrentSessions, throttlingBehavior.MaxConcurrentSessions);
                instance.SetProperty(AdministrationStrings.MaxConcurrentInstances, throttlingBehavior.MaxConcurrentInstances);
            }
            else if (behavior is ServiceTimeoutsBehavior)
            {
                instance = existingInstance.NewInstance("ServiceTimeoutsBehavior");
                ServiceTimeoutsBehavior specificBehavior = (ServiceTimeoutsBehavior)behavior;
                instance.SetProperty(AdministrationStrings.TransactionTimeout, specificBehavior.TransactionTimeout);
            }
            else if (behavior is IWmiInstanceProvider)
            {
                IWmiInstanceProvider instanceProvider = (IWmiInstanceProvider)behavior;
                instance = existingInstance.NewInstance(instanceProvider.GetInstanceType());
                instanceProvider.FillInstance(instance);
            }
            else
            {
                instance = existingInstance.NewInstance("Behavior");
            }
            if (null != instance)
            {
                instance.SetProperty(AdministrationStrings.Type, behavior.GetType().FullName);
            }
        }
 private void FillBehaviorInfo(IServiceBehavior behavior, IWmiInstance existingInstance, out IWmiInstance instance)
 {
     instance = null;
     if (behavior is AspNetCompatibilityRequirementsAttribute)
     {
         instance = existingInstance.NewInstance("AspNetCompatibilityRequirementsAttribute");
         AspNetCompatibilityRequirementsAttribute attribute = (AspNetCompatibilityRequirementsAttribute)behavior;
         instance.SetProperty("RequirementsMode", attribute.RequirementsMode.ToString());
     }
     else if (behavior is ServiceCredentials)
     {
         instance = existingInstance.NewInstance("ServiceCredentials");
         ServiceCredentials credentials = (ServiceCredentials)behavior;
         if ((credentials.ClientCertificate != null) && (credentials.ClientCertificate.Certificate != null))
         {
             string str = string.Empty + string.Format(CultureInfo.InvariantCulture, "Certificate: {0}\n", new object[] { credentials.ClientCertificate.Certificate });
             instance.SetProperty("ClientCertificate", str);
         }
         if ((credentials.IssuedTokenAuthentication != null) && (credentials.IssuedTokenAuthentication.KnownCertificates != null))
         {
             string str2 = (string.Empty + string.Format(CultureInfo.InvariantCulture, "AllowUntrustedRsaIssuers: {0}\n", new object[] { credentials.IssuedTokenAuthentication.AllowUntrustedRsaIssuers }) + string.Format(CultureInfo.InvariantCulture, "CertificateValidationMode: {0}\n", new object[] { credentials.IssuedTokenAuthentication.CertificateValidationMode })) + string.Format(CultureInfo.InvariantCulture, "RevocationMode: {0}\n", new object[] { credentials.IssuedTokenAuthentication.RevocationMode }) + string.Format(CultureInfo.InvariantCulture, "TrustedStoreLocation: {0}\n", new object[] { credentials.IssuedTokenAuthentication.TrustedStoreLocation });
             foreach (X509Certificate2 certificate in credentials.IssuedTokenAuthentication.KnownCertificates)
             {
                 if (certificate != null)
                 {
                     str2 = str2 + string.Format(CultureInfo.InvariantCulture, "Known certificate: {0}\n", new object[] { certificate.FriendlyName });
                 }
             }
             str2 = str2 + string.Format(CultureInfo.InvariantCulture, "AudienceUriMode: {0}\n", new object[] { credentials.IssuedTokenAuthentication.AudienceUriMode });
             if (credentials.IssuedTokenAuthentication.AllowedAudienceUris != null)
             {
                 foreach (string str3 in credentials.IssuedTokenAuthentication.AllowedAudienceUris)
                 {
                     if (str3 != null)
                     {
                         str2 = str2 + string.Format(CultureInfo.InvariantCulture, "Allowed Uri: {0}\n", new object[] { str3 });
                     }
                 }
             }
             instance.SetProperty("IssuedTokenAuthentication", str2);
         }
         if ((credentials.Peer != null) && (credentials.Peer.Certificate != null))
         {
             string str4 = string.Empty + string.Format(CultureInfo.InvariantCulture, "Certificate: {0}\n", new object[] { credentials.Peer.Certificate.ToString(true) });
             instance.SetProperty("Peer", str4);
         }
         if ((credentials.SecureConversationAuthentication != null) && (credentials.SecureConversationAuthentication.SecurityContextClaimTypes != null))
         {
             string str5 = string.Empty;
             foreach (System.Type type in credentials.SecureConversationAuthentication.SecurityContextClaimTypes)
             {
                 if (type != null)
                 {
                     str5 = str5 + string.Format(CultureInfo.InvariantCulture, "ClaimType: {0}\n", new object[] { type });
                 }
             }
             instance.SetProperty("SecureConversationAuthentication", str5);
         }
         if ((credentials.ServiceCertificate != null) && (credentials.ServiceCertificate.Certificate != null))
         {
             instance.SetProperty("ServiceCertificate", credentials.ServiceCertificate.Certificate.ToString());
         }
         if (credentials.UserNameAuthentication != null)
         {
             instance.SetProperty("UserNameAuthentication", string.Format(CultureInfo.InvariantCulture, "{0}: {1}", new object[] { "ValidationMode", credentials.UserNameAuthentication.UserNamePasswordValidationMode.ToString() }));
         }
         if (credentials.WindowsAuthentication != null)
         {
             instance.SetProperty("WindowsAuthentication", string.Format(CultureInfo.InvariantCulture, "{0}: {1}", new object[] { "AllowAnonymous", credentials.WindowsAuthentication.AllowAnonymousLogons.ToString() }));
         }
     }
     else if (behavior is ServiceAuthorizationBehavior)
     {
         instance = existingInstance.NewInstance("ServiceAuthorizationBehavior");
         ServiceAuthorizationBehavior behavior2 = (ServiceAuthorizationBehavior)behavior;
         instance.SetProperty("ImpersonateCallerForAllOperations", behavior2.ImpersonateCallerForAllOperations);
         if (behavior2.RoleProvider != null)
         {
             instance.SetProperty("RoleProvider", behavior2.RoleProvider.ToString());
         }
         if (behavior2.ServiceAuthorizationManager != null)
         {
             instance.SetProperty("ServiceAuthorizationManager", behavior2.ServiceAuthorizationManager.ToString());
         }
         instance.SetProperty("PrincipalPermissionMode", behavior2.PrincipalPermissionMode.ToString());
     }
     else if (behavior is ServiceSecurityAuditBehavior)
     {
         instance = existingInstance.NewInstance("ServiceSecurityAuditBehavior");
         ServiceSecurityAuditBehavior behavior3 = (ServiceSecurityAuditBehavior)behavior;
         instance.SetProperty("AuditLogLocation", behavior3.AuditLogLocation.ToString());
         instance.SetProperty("SuppressAuditFailure", behavior3.SuppressAuditFailure);
         instance.SetProperty("ServiceAuthorizationAuditLevel", behavior3.ServiceAuthorizationAuditLevel.ToString());
         instance.SetProperty("MessageAuthenticationAuditLevel", behavior3.MessageAuthenticationAuditLevel.ToString());
     }
     else if (behavior is ServiceBehaviorAttribute)
     {
         instance = existingInstance.NewInstance("ServiceBehaviorAttribute");
         ServiceBehaviorAttribute attribute2 = (ServiceBehaviorAttribute)behavior;
         instance.SetProperty("AddressFilterMode", attribute2.AddressFilterMode.ToString());
         instance.SetProperty("AutomaticSessionShutdown", attribute2.AutomaticSessionShutdown);
         instance.SetProperty("ConcurrencyMode", attribute2.ConcurrencyMode.ToString());
         instance.SetProperty("ConfigurationName", attribute2.ConfigurationName);
         instance.SetProperty("IgnoreExtensionDataObject", attribute2.IgnoreExtensionDataObject);
         instance.SetProperty("IncludeExceptionDetailInFaults", attribute2.IncludeExceptionDetailInFaults);
         instance.SetProperty("InstanceContextMode", attribute2.InstanceContextMode.ToString());
         instance.SetProperty("MaxItemsInObjectGraph", attribute2.MaxItemsInObjectGraph);
         instance.SetProperty("Name", attribute2.Name);
         instance.SetProperty("Namespace", attribute2.Namespace);
         instance.SetProperty("ReleaseServiceInstanceOnTransactionComplete", attribute2.ReleaseServiceInstanceOnTransactionComplete);
         instance.SetProperty("TransactionAutoCompleteOnSessionClose", attribute2.TransactionAutoCompleteOnSessionClose);
         instance.SetProperty("TransactionIsolationLevel", attribute2.TransactionIsolationLevel.ToString());
         if (attribute2.TransactionTimeoutSet)
         {
             instance.SetProperty("TransactionTimeout", attribute2.TransactionTimeoutTimespan);
         }
         instance.SetProperty("UseSynchronizationContext", attribute2.UseSynchronizationContext);
         instance.SetProperty("ValidateMustUnderstand", attribute2.ValidateMustUnderstand);
     }
     else if (behavior is ServiceDebugBehavior)
     {
         instance = existingInstance.NewInstance("ServiceDebugBehavior");
         ServiceDebugBehavior behavior4 = (ServiceDebugBehavior)behavior;
         if (null != behavior4.HttpHelpPageUrl)
         {
             instance.SetProperty("HttpHelpPageUrl", behavior4.HttpHelpPageUrl.ToString());
         }
         instance.SetProperty("HttpHelpPageEnabled", behavior4.HttpHelpPageEnabled);
         if (null != behavior4.HttpsHelpPageUrl)
         {
             instance.SetProperty("HttpsHelpPageUrl", behavior4.HttpsHelpPageUrl.ToString());
         }
         instance.SetProperty("HttpsHelpPageEnabled", behavior4.HttpsHelpPageEnabled);
         instance.SetProperty("IncludeExceptionDetailInFaults", behavior4.IncludeExceptionDetailInFaults);
     }
     else if (behavior is ServiceMetadataBehavior)
     {
         instance = existingInstance.NewInstance("ServiceMetadataBehavior");
         ServiceMetadataBehavior behavior5 = (ServiceMetadataBehavior)behavior;
         if (null != behavior5.ExternalMetadataLocation)
         {
             instance.SetProperty("ExternalMetadataLocation", behavior5.ExternalMetadataLocation.ToString());
         }
         instance.SetProperty("HttpGetEnabled", behavior5.HttpGetEnabled);
         if (null != behavior5.HttpGetUrl)
         {
             instance.SetProperty("HttpGetUrl", behavior5.HttpGetUrl.ToString());
         }
         instance.SetProperty("HttpsGetEnabled", behavior5.HttpsGetEnabled);
         if (null != behavior5.HttpsGetUrl)
         {
             instance.SetProperty("HttpsGetUrl", behavior5.HttpsGetUrl.ToString());
         }
         this.FillMetadataExporterInfo(instance, behavior5.MetadataExporter);
     }
     else if (behavior is ServiceThrottlingBehavior)
     {
         instance = existingInstance.NewInstance("ServiceThrottlingBehavior");
         ServiceThrottlingBehavior behavior6 = (ServiceThrottlingBehavior)behavior;
         instance.SetProperty("MaxConcurrentCalls", behavior6.MaxConcurrentCalls);
         instance.SetProperty("MaxConcurrentSessions", behavior6.MaxConcurrentSessions);
         instance.SetProperty("MaxConcurrentInstances", behavior6.MaxConcurrentInstances);
     }
     else if (behavior is ServiceTimeoutsBehavior)
     {
         instance = existingInstance.NewInstance("ServiceTimeoutsBehavior");
         ServiceTimeoutsBehavior behavior7 = (ServiceTimeoutsBehavior)behavior;
         instance.SetProperty("TransactionTimeout", behavior7.TransactionTimeout);
     }
     else if (behavior is IWmiInstanceProvider)
     {
         IWmiInstanceProvider provider = (IWmiInstanceProvider)behavior;
         instance = existingInstance.NewInstance(provider.GetInstanceType());
         provider.FillInstance(instance);
     }
     else
     {
         instance = existingInstance.NewInstance("Behavior");
     }
     if (instance != null)
     {
         instance.SetProperty("Type", behavior.GetType().FullName);
     }
 }
        static void FillBehaviorInfo(IEndpointBehavior behavior, IWmiInstance existingInstance, out IWmiInstance instance)
        {
            Fx.Assert(null != existingInstance, "");
            Fx.Assert(null != behavior, "");
            instance = null;
            if (behavior is ClientCredentials)
            {
                instance = existingInstance.NewInstance("ClientCredentials");
                ClientCredentials specificBehavior = (ClientCredentials)behavior;
                instance.SetProperty(AdministrationStrings.SupportInteractive, specificBehavior.SupportInteractive);
                if (specificBehavior.ClientCertificate != null && specificBehavior.ClientCertificate.Certificate != null)
                {
                    instance.SetProperty(AdministrationStrings.ClientCertificate, specificBehavior.ClientCertificate.Certificate.ToString());
                }
                if (specificBehavior.IssuedToken != null)
                {
                    string result = String.Format(CultureInfo.InvariantCulture,
                                                  "{0}: {1}",
                                                  AdministrationStrings.CacheIssuedTokens, specificBehavior.IssuedToken.CacheIssuedTokens);
                    instance.SetProperty(AdministrationStrings.IssuedToken, result);
                }
                if (specificBehavior.HttpDigest != null)
                {
                    string result = String.Format(CultureInfo.InvariantCulture,
                                                  "{0}: {1}",
                                                  AdministrationStrings.AllowedImpersonationLevel, specificBehavior.HttpDigest.AllowedImpersonationLevel.ToString());
                    instance.SetProperty(AdministrationStrings.HttpDigest, result);
                }
                if (specificBehavior.Peer != null && specificBehavior.Peer.Certificate != null)
                {
                    instance.SetProperty(AdministrationStrings.Peer, specificBehavior.Peer.Certificate.ToString(true));
                }
                if (specificBehavior.UserName != null)
                {
                    instance.SetProperty(AdministrationStrings.UserName, "********");
                }
                if (specificBehavior.Windows != null)
                {
#pragma warning disable 618 // To suppress AllowNtlm warning.
                    string result = String.Format(CultureInfo.InvariantCulture,
                                                  "{0}: {1}, {2}: {3}",
                                                  AdministrationStrings.AllowedImpersonationLevel,
                                                  specificBehavior.Windows.AllowedImpersonationLevel.ToString(),
                                                  AdministrationStrings.AllowNtlm,
                                                  specificBehavior.Windows.AllowNtlm);
#pragma warning restore 618

                    instance.SetProperty(AdministrationStrings.Windows, result);
                }
            }
            else if (behavior is MustUnderstandBehavior)
            {
                instance = existingInstance.NewInstance("MustUnderstandBehavior");
            }
            else if (behavior is SynchronousReceiveBehavior)
            {
                instance = existingInstance.NewInstance("SynchronousReceiveBehavior");
            }
            else if (behavior is DispatcherSynchronizationBehavior)
            {
                instance = existingInstance.NewInstance("DispatcherSynchronizationBehavior");
            }
            else if (behavior is TransactedBatchingBehavior)
            {
                instance = existingInstance.NewInstance("TransactedBatchingBehavior");
                instance.SetProperty(AdministrationStrings.MaxBatchSize, ((TransactedBatchingBehavior)behavior).MaxBatchSize);
            }
            else if (behavior is ClientViaBehavior)
            {
                instance = existingInstance.NewInstance("ClientViaBehavior");
                instance.SetProperty(AdministrationStrings.Uri, ((ClientViaBehavior)behavior).Uri.ToString());
            }
            else if (behavior is IWmiInstanceProvider)
            {
                IWmiInstanceProvider instanceProvider = (IWmiInstanceProvider)behavior;
                instance = existingInstance.NewInstance(instanceProvider.GetInstanceType());
                instanceProvider.FillInstance(instance);
            }
            else
            {
                instance = existingInstance.NewInstance("Behavior");
            }
            if (null != instance)
            {
                instance.SetProperty(AdministrationStrings.Type, behavior.GetType().FullName);
            }
        }
        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 FillBehaviorInfo(IEndpointBehavior behavior, IWmiInstance existingInstance, out IWmiInstance instance)
 {
     instance = null;
     if (behavior is ClientCredentials)
     {
         instance = existingInstance.NewInstance("ClientCredentials");
         ClientCredentials credentials = (ClientCredentials)behavior;
         instance.SetProperty("SupportInteractive", credentials.SupportInteractive);
         if ((credentials.ClientCertificate != null) && (credentials.ClientCertificate.Certificate != null))
         {
             instance.SetProperty("ClientCertificate", credentials.ClientCertificate.Certificate.ToString());
         }
         if (credentials.IssuedToken != null)
         {
             string str = string.Format(CultureInfo.InvariantCulture, "{0}: {1}", new object[] { "CacheIssuedTokens", credentials.IssuedToken.CacheIssuedTokens });
             instance.SetProperty("IssuedToken", str);
         }
         if (credentials.HttpDigest != null)
         {
             string str2 = string.Format(CultureInfo.InvariantCulture, "{0}: {1}", new object[] { "AllowedImpersonationLevel", credentials.HttpDigest.AllowedImpersonationLevel.ToString() });
             instance.SetProperty("HttpDigest", str2);
         }
         if ((credentials.Peer != null) && (credentials.Peer.Certificate != null))
         {
             instance.SetProperty("Peer", credentials.Peer.Certificate.ToString(true));
         }
         if (credentials.UserName != null)
         {
             instance.SetProperty("UserName", "********");
         }
         if (credentials.Windows != null)
         {
             string str3 = string.Format(CultureInfo.InvariantCulture, "{0}: {1}, {2}: {3}", new object[] { "AllowedImpersonationLevel", credentials.Windows.AllowedImpersonationLevel.ToString(), "AllowNtlm", credentials.Windows.AllowNtlm });
             instance.SetProperty("Windows", str3);
         }
     }
     else if (behavior is MustUnderstandBehavior)
     {
         instance = existingInstance.NewInstance("MustUnderstandBehavior");
     }
     else if (behavior is SynchronousReceiveBehavior)
     {
         instance = existingInstance.NewInstance("SynchronousReceiveBehavior");
     }
     else if (behavior is DispatcherSynchronizationBehavior)
     {
         instance = existingInstance.NewInstance("DispatcherSynchronizationBehavior");
     }
     else if (behavior is TransactedBatchingBehavior)
     {
         instance = existingInstance.NewInstance("TransactedBatchingBehavior");
         instance.SetProperty("MaxBatchSize", ((TransactedBatchingBehavior)behavior).MaxBatchSize);
     }
     else if (behavior is ClientViaBehavior)
     {
         instance = existingInstance.NewInstance("ClientViaBehavior");
         instance.SetProperty("Uri", ((ClientViaBehavior)behavior).Uri.ToString());
     }
     else if (behavior is IWmiInstanceProvider)
     {
         IWmiInstanceProvider provider = (IWmiInstanceProvider)behavior;
         instance = existingInstance.NewInstance(provider.GetInstanceType());
         provider.FillInstance(instance);
     }
     else
     {
         instance = existingInstance.NewInstance("Behavior");
     }
     if (instance != null)
     {
         instance.SetProperty("Type", behavior.GetType().FullName);
     }
 }
 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);
             }
         }
     }
 }