当前位置: 首页>>代码示例>>C#>>正文


C# IWmiInstance.NewInstance方法代码示例

本文整理汇总了C#中IWmiInstance.NewInstance方法的典型用法代码示例。如果您正苦于以下问题:C# IWmiInstance.NewInstance方法的具体用法?C# IWmiInstance.NewInstance怎么用?C# IWmiInstance.NewInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在IWmiInstance的用法示例。


在下文中一共展示了IWmiInstance.NewInstance方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: FillBehaviorInfo

 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);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:29,代码来源:ContractInstanceProvider.cs

示例2: FillContract

        static void FillContract(IWmiInstance contract, ContractDescription contractDescription)
        {
            Fx.Assert(null != contractDescription, "contractDescription cannot be null");
            contract.SetProperty(AdministrationStrings.Type, contractDescription.ContractType.Name);
            if (null != contractDescription.CallbackContractType)
            {
                contract.SetProperty(AdministrationStrings.CallbackContract, ContractReference(contractDescription.CallbackContractType.Name));
            }

            contract.SetProperty(AdministrationStrings.Name, contractDescription.Name);
            contract.SetProperty(AdministrationStrings.Namespace, contractDescription.Namespace);
            contract.SetProperty(AdministrationStrings.SessionMode, contractDescription.SessionMode.ToString());

            IWmiInstance[] operations = new IWmiInstance[contractDescription.Operations.Count];
            for (int j = 0; j < operations.Length; ++j)
            {
                OperationDescription operationDescription = contractDescription.Operations[j];
                Fx.Assert(operationDescription.Messages.Count > 0, "");
                IWmiInstance operation = contract.NewInstance(AdministrationStrings.Operation);
                FillOperation(operation, operationDescription);
                operations[j] = operation;

            }
            contract.SetProperty(AdministrationStrings.Operations, operations);
            FillBehaviorsInfo(contract, contractDescription.Behaviors);
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:26,代码来源:ContractInstanceProvider.cs

示例3: GetAppDomainInfo

        internal static IWmiInstance GetAppDomainInfo(IWmiInstance instance)
        {
            Fx.Assert(null != instance, "");
            IWmiInstance appDomainInfo = instance.NewInstance(AdministrationStrings.AppDomainInfo);
            if (null != appDomainInfo)
            {
                AppDomainInstanceProvider.FillAppDomainInfo(appDomainInfo);
            }

            return appDomainInfo;
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:11,代码来源:ServiceInstanceProvider.cs

示例4: CreateListenersInfo

        static IWmiInstance[] CreateListenersInfo(TraceSource traceSource, IWmiInstance instance)
        {
            Fx.Assert(null != traceSource, "");
            Fx.Assert(null != instance, "");

            IWmiInstance[] traceListeners = new IWmiInstance[traceSource.Listeners.Count];

            for (int i = 0; i < traceSource.Listeners.Count; i++)
            {
                TraceListener traceListener = traceSource.Listeners[i];
                IWmiInstance traceListenerWmiInstance = instance.NewInstance(AdministrationStrings.TraceListener);
                traceListenerWmiInstance.SetProperty(AdministrationStrings.Name, traceListener.Name);
                List<IWmiInstance> traceListenerArguments = new List<IWmiInstance>(1);

                Type type = traceListener.GetType();
                string initializeData = (string)type.InvokeMember(AdministrationStrings.InitializeData, BindingFlags.GetField | BindingFlags.NonPublic | BindingFlags.Instance, null, traceListener, null, CultureInfo.InvariantCulture);
                string[] supportedAttributes = (string[])type.InvokeMember(AdministrationStrings.GetSupportedAttributes, BindingFlags.InvokeMethod | BindingFlags.NonPublic | BindingFlags.Instance, null, traceListener, null, CultureInfo.InvariantCulture);

                IWmiInstance argumentWmiInstance = instance.NewInstance(AdministrationStrings.TraceListenerArgument);
                argumentWmiInstance.SetProperty(AdministrationStrings.Name, AdministrationStrings.InitializeData);
                argumentWmiInstance.SetProperty(AdministrationStrings.Value, initializeData);
                traceListenerArguments.Add(argumentWmiInstance);

                if (null != supportedAttributes)
                {
                    foreach (string attribute in supportedAttributes)
                    {
                        argumentWmiInstance = instance.NewInstance(AdministrationStrings.TraceListenerArgument);
                        argumentWmiInstance.SetProperty(AdministrationStrings.Name, attribute);
                        argumentWmiInstance.SetProperty(AdministrationStrings.Value, traceListener.Attributes[attribute]);
                        traceListenerArguments.Add(argumentWmiInstance);
                    }
                }
                traceListenerWmiInstance.SetProperty(AdministrationStrings.TraceListenerArguments, traceListenerArguments.ToArray());
                traceListeners[i] = traceListenerWmiInstance;
            }

            return traceListeners;
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:39,代码来源:AppDomainInstanceProvider.cs

示例5: FillBindingInfo

        static void FillBindingInfo(EndpointInfo endpoint, IWmiInstance instance)
        {
            Fx.Assert(null != endpoint, "");
            Fx.Assert(null != instance, "");
            IWmiInstance binding = instance.NewInstance(AdministrationStrings.Binding);

            IWmiInstance[] bindings = new IWmiInstance[endpoint.Binding.Elements.Count];
            for (int j = 0; j < bindings.Length; ++j)
            {
                bindings[j] = binding;
                FillBindingInfo(endpoint.Binding.Elements[j], ref bindings[j]);
            }
            binding.SetProperty(AdministrationStrings.BindingElements, bindings);
            binding.SetProperty(AdministrationStrings.Name, endpoint.Binding.Name);
            binding.SetProperty(AdministrationStrings.Namespace, endpoint.Binding.Namespace);
            binding.SetProperty(AdministrationStrings.CloseTimeout, endpoint.Binding.CloseTimeout);
            binding.SetProperty(AdministrationStrings.Scheme, endpoint.Binding.Scheme);
            binding.SetProperty(AdministrationStrings.OpenTimeout, endpoint.Binding.OpenTimeout);
            binding.SetProperty(AdministrationStrings.ReceiveTimeout, endpoint.Binding.ReceiveTimeout);
            binding.SetProperty(AdministrationStrings.SendTimeout, endpoint.Binding.SendTimeout);

            instance.SetProperty(AdministrationStrings.Binding, binding);
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:23,代码来源:EndpointInstanceProvider.cs

示例6: FillBindingInfo

 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;
//.........这里部分代码省略.........
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:101,代码来源:EndpointInstanceProvider.cs

示例7: FillExtendedProtectionPolicy

        static void FillExtendedProtectionPolicy(IWmiInstance instance, ExtendedProtectionPolicy policy)
        {
            IWmiInstance extendedProtectionPolicy = instance.NewInstance(AdministrationStrings.ExtendedProtectionPolicy);
            extendedProtectionPolicy.SetProperty(AdministrationStrings.PolicyEnforcement, policy.PolicyEnforcement.ToString());
            extendedProtectionPolicy.SetProperty(AdministrationStrings.ProtectionScenario, policy.ProtectionScenario.ToString());

            if (policy.CustomServiceNames != null)
            {
                List<string> serviceNames = new List<string>(policy.CustomServiceNames.Count);
                foreach (string serviceName in policy.CustomServiceNames)
                {
                    serviceNames.Add(serviceName);
                }
                extendedProtectionPolicy.SetProperty(AdministrationStrings.CustomServiceNames, serviceNames.ToArray());
            }

            if (policy.CustomChannelBinding != null)
            {
                extendedProtectionPolicy.SetProperty(AdministrationStrings.CustomChannelBinding, policy.CustomChannelBinding.GetType().ToString());
            }

            instance.SetProperty(AdministrationStrings.ExtendedProtectionPolicy, extendedProtectionPolicy);
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:23,代码来源:EndpointInstanceProvider.cs

示例8: FillReaderQuotas

 static void FillReaderQuotas(IWmiInstance instance, XmlDictionaryReaderQuotas readerQuotas)
 {
     Fx.Assert(null != instance, "");
     Fx.Assert(null != readerQuotas, "");
     IWmiInstance readerQuotasInstance = instance.NewInstance(AdministrationStrings.XmlDictionaryReaderQuotas);
     readerQuotasInstance.SetProperty(AdministrationStrings.MaxArrayLength, readerQuotas.MaxArrayLength);
     readerQuotasInstance.SetProperty(AdministrationStrings.MaxBytesPerRead, readerQuotas.MaxBytesPerRead);
     readerQuotasInstance.SetProperty(AdministrationStrings.MaxDepth, readerQuotas.MaxDepth);
     readerQuotasInstance.SetProperty(AdministrationStrings.MaxNameTableCharCount, readerQuotas.MaxNameTableCharCount);
     readerQuotasInstance.SetProperty(AdministrationStrings.MaxStringContentLength, readerQuotas.MaxStringContentLength);
     instance.SetProperty(AdministrationStrings.ReaderQuotas, readerQuotasInstance);
 }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:12,代码来源:EndpointInstanceProvider.cs

示例9: FillBehaviorInfo

        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);
            }
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:90,代码来源:EndpointInstanceProvider.cs

示例10: FillMetadataExporterInfo

 private void FillMetadataExporterInfo(IWmiInstance instance, MetadataExporter exporter)
 {
     DiagnosticUtility.EventLog.LogEvent(TraceEventType.Information, EventLogCategory.Wmi, (EventLogEventId) (-1073610744), true, new string[] { "metadata exporter called" });
     IWmiInstance instance2 = instance.NewInstance("MetadataExporter");
     instance2.SetProperty("PolicyVersion", exporter.PolicyVersion.ToString());
     instance.SetProperty("MetadataExportInfo", instance2);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:7,代码来源:ServiceInstanceProvider.cs

示例11: FillBehaviorInfo

 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());
//.........这里部分代码省略.........
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:101,代码来源:ServiceInstanceProvider.cs

示例12: FillBehaviorInfo

 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);
     }
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:73,代码来源:EndpointInstanceProvider.cs

示例13: FillMetadataExporterInfo

 void FillMetadataExporterInfo(IWmiInstance instance, MetadataExporter exporter)
 {
     DiagnosticUtility.EventLog.LogEvent(TraceEventType.Information, (ushort)System.Runtime.Diagnostics.EventLogCategory.Wmi, (uint)System.Runtime.Diagnostics.EventLogEventId.MessageLoggingOn, true, "metadata exporter called");
     Fx.Assert(null != instance, "");
     Fx.Assert(null != exporter, "");
     IWmiInstance metadataExporterInstance = instance.NewInstance(AdministrationStrings.MetadataExporter);
     metadataExporterInstance.SetProperty(AdministrationStrings.PolicyVersion, exporter.PolicyVersion.ToString());
     instance.SetProperty(AdministrationStrings.MetadataExportInfo, metadataExporterInstance);
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:9,代码来源:ServiceInstanceProvider.cs

示例14: FillBehaviorInfo

        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;
//.........这里部分代码省略.........
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:101,代码来源:ServiceInstanceProvider.cs

示例15: GetAppDomainInfo

 internal static IWmiInstance GetAppDomainInfo(IWmiInstance instance)
 {
     IWmiInstance instance2 = instance.NewInstance("AppDomainInfo");
     if (instance2 != null)
     {
         AppDomainInstanceProvider.FillAppDomainInfo(instance2);
     }
     return instance2;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:ServiceInstanceProvider.cs


注:本文中的IWmiInstance.NewInstance方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。