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


C# IWmiInstance类代码示例

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


IWmiInstance类属于命名空间,在下文中一共展示了IWmiInstance类的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:

        bool IWmiProvider.GetInstance(IWmiInstance instance)
        {
            string serviceRef = instance.GetProperty(AdministrationStrings.Service) as string;
            string endpointRef = instance.GetProperty(AdministrationStrings.Endpoint) as string;

            return !String.IsNullOrEmpty(serviceRef) && !String.IsNullOrEmpty(endpointRef);
        }
开发者ID:krytht,项目名称:DotNetReferenceSource,代码行数:7,代码来源:ServiceEndpointAssociationProvider.cs

示例3: FillOperation

        static void FillOperation(IWmiInstance operation, OperationDescription operationDescription)
        {
            operation.SetProperty(AdministrationStrings.Name, operationDescription.Name);
            operation.SetProperty(AdministrationStrings.Action, FixWildcardAction(operationDescription.Messages[0].Action));
            if (operationDescription.Messages.Count > 1)
            {
                operation.SetProperty(AdministrationStrings.ReplyAction, FixWildcardAction(operationDescription.Messages[1].Action));
            }
            operation.SetProperty(AdministrationStrings.IsOneWay, operationDescription.IsOneWay);
            operation.SetProperty(AdministrationStrings.IsInitiating, operationDescription.IsInitiating);
            operation.SetProperty(AdministrationStrings.IsTerminating, operationDescription.IsTerminating);
            operation.SetProperty(AdministrationStrings.AsyncPattern, null != operationDescription.BeginMethod);
            if (null != operationDescription.SyncMethod)
            {
                if (null != operationDescription.SyncMethod.ReturnType)
                {
                    operation.SetProperty(AdministrationStrings.ReturnType, operationDescription.SyncMethod.ReturnType.Name);
                }
                operation.SetProperty(AdministrationStrings.MethodSignature, operationDescription.SyncMethod.ToString());
                ParameterInfo[] parameterInfo = operationDescription.SyncMethod.GetParameters();
                string[] parameterTypes = new string[parameterInfo.Length];
                for (int i = 0; i < parameterInfo.Length; i++)
                {
                    parameterTypes[i] = parameterInfo[i].ParameterType.ToString();
                }
                operation.SetProperty(AdministrationStrings.ParameterTypes, parameterTypes);
            }
            operation.SetProperty(AdministrationStrings.IsCallback, operationDescription.Messages[0].Direction == MessageDirection.Output);

            FillBehaviorsInfo(operation, operationDescription.Behaviors);

        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:32,代码来源:ContractInstanceProvider.cs

示例4: 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

示例5:

        bool IWmiProvider.GetInstance(IWmiInstance instance)
        {
            Fx.Assert(null != instance, "");
            string serviceRef = instance.GetProperty(AdministrationStrings.Service) as string;
            string appDomainInfoRef = instance.GetProperty(AdministrationStrings.AppDomainInfo) as string;

            return !String.IsNullOrEmpty(serviceRef) && !String.IsNullOrEmpty(appDomainInfoRef);
        }
开发者ID:nlh774,项目名称:DotNetReferenceSource,代码行数:8,代码来源:ServiceAppDomainAssociationProvider.cs

示例6: FillCollectionInfo

 public static void FillCollectionInfo(ICollection info, IWmiInstance instance, string propertyName)
 {
     string[] strArray = new string[info.Count];
     int num = 0;
     foreach (object obj2 in info)
     {
         strArray[num++] = obj2.ToString();
     }
     instance.SetProperty(propertyName, strArray);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:10,代码来源:ProviderBase.cs

示例7: 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

示例8: FillAppDomainInfo

        bool IWmiProvider.GetInstance(IWmiInstance instance)
        {
            Fx.Assert(null != instance, "");
            bool bFound = false;
            if ((int)instance.GetProperty(AdministrationStrings.ProcessId) == AppDomainInfo.Current.ProcessId
                && String.Equals((string)instance.GetProperty(AdministrationStrings.Name), AppDomainInfo.Current.Name, StringComparison.Ordinal))
            {
                FillAppDomainInfo(instance);
                bFound = true;
            }

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

示例9: FillAddressInfo

 private static void FillAddressInfo(System.ServiceModel.Administration.EndpointInfo endpoint, IWmiInstance instance)
 {
     string[] info = new string[endpoint.Headers.Count];
     int num = 0;
     foreach (AddressHeader header in endpoint.Headers)
     {
         PlainXmlWriter writer = new PlainXmlWriter();
         header.WriteAddressHeader(writer);
         info[num++] = writer.ToString();
     }
     ProviderBase.FillCollectionInfo(info, instance, "AddressHeaders");
     instance.SetProperty("Address", (endpoint.Address == null) ? string.Empty : endpoint.Address.ToString());
     instance.SetProperty("ListenUri", (endpoint.ListenUri == null) ? string.Empty : endpoint.ListenUri.ToString());
     instance.SetProperty("AddressIdentity", (endpoint.Identity == null) ? string.Empty : endpoint.Identity.ToString());
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:15,代码来源:EndpointInstanceProvider.cs

示例10: FillBehaviorsInfo

 void FillBehaviorsInfo(ServiceInfo info, IWmiInstance instance)
 {
     Fx.Assert(null != instance, "");
     List<IWmiInstance> behaviors = new List<IWmiInstance>(info.Behaviors.Count);
     foreach (IServiceBehavior behavior in info.Behaviors)
     {
         IWmiInstance behaviorInstance;
         FillBehaviorInfo(behavior, instance, out behaviorInstance);
         if (null != behaviorInstance)
         {
             behaviors.Add(behaviorInstance);
         }
     }
     instance.SetProperty(AdministrationStrings.Behaviors, behaviors.ToArray());
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:15,代码来源:ServiceInstanceProvider.cs

示例11: FillCollectionInfo

        public static void FillCollectionInfo(ICollection info, IWmiInstance instance, string propertyName)
        {
            Fx.Assert(null != info, "");
            Fx.Assert(null != instance, "");
//warning 56507 : Prefer 'string.IsNullOrEmpty(action)' over checks for null and/or emptiness.
#pragma warning suppress 56507 //[....]; Asserting non-null object for marshalling reasons.  Empty string may be valid input.
            Fx.Assert(null != propertyName, "");

            string[] data = new string[info.Count];
            int i = 0;
            foreach (object o in info)
            {
                data[i++] = o.ToString();
            }
            instance.SetProperty(propertyName, data);
        }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:16,代码来源:ProviderBase.cs

示例12: foreach

        bool IWmiProvider.GetInstance(IWmiInstance instance)
        {
            Fx.Assert(null != instance, "");
            bool bFound = false;
            if ((int)instance.GetProperty(AdministrationStrings.ProcessId) == AppDomainInfo.Current.ProcessId)
            {
                foreach (ServiceInfo info in new ServiceInfoCollection(ManagementExtension.Services))
                {
                    if (String.Equals((string)instance.GetProperty(AdministrationStrings.DistinguishedName), info.DistinguishedName, StringComparison.OrdinalIgnoreCase))
                    {
                        FillServiceInfo(info, instance);
                        bFound = true;
                        break;
                    }
                }
            }

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

示例13: 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

示例14: 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

示例15: 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


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