void IWmiProvider.EnumInstances(IWmiInstances instances)
 {
     foreach (ServiceInfo info in new ServiceInfoCollection(ManagementExtension.Services))
     {
         string reference = ServiceInstanceProvider.GetReference(info);
         foreach (EndpointInfo info2 in info.Endpoints)
         {
             IWmiInstance inst = instances.NewInstance(null);
             string       str2 = EndpointInstanceProvider.EndpointReference(info2.ListenUri, info2.Contract.Name);
             inst.SetProperty("Endpoint", str2);
             inst.SetProperty("Service", reference);
             instances.AddInstance(inst);
         }
     }
 }
        private void FillChannelInfo(IChannel channel, IWmiInstance instance)
        {
            instance.SetProperty("Type", channel.GetType().ToString());
            ServiceChannel serviceChannel = ServiceChannelFactory.GetServiceChannel(channel);

            if (serviceChannel != null)
            {
                string str = (serviceChannel.RemoteAddress == null) ? string.Empty : serviceChannel.RemoteAddress.ToString();
                instance.SetProperty("RemoteAddress", str);
                string contractName = (serviceChannel.ClientRuntime != null) ? serviceChannel.ClientRuntime.ContractName : string.Empty;
                string str3         = EndpointInstanceProvider.EndpointReference(str, contractName, false);
                instance.SetProperty("RemoteEndpoint", str3);
                instance.SetProperty("LocalAddress", (serviceChannel.LocalAddress == null) ? string.Empty : serviceChannel.LocalAddress.ToString());
                instance.SetProperty("SessionId", ((IContextChannel)serviceChannel).SessionId);
            }
        }
        void IWmiProvider.EnumInstances(IWmiInstances instances)
        {
            foreach (ServiceInfo info in new ServiceInfoCollection(ManagementExtension.Services))
            {
                string serviceRef = ServiceInstanceProvider.GetReference(info);

                foreach (EndpointInfo endpointInfo in info.Endpoints)
                {
                    IWmiInstance instance = instances.NewInstance(null);

                    string endpointRef = EndpointInstanceProvider.EndpointReference(endpointInfo.ListenUri, endpointInfo.Contract.Name);
                    instance.SetProperty(AdministrationStrings.Endpoint, endpointRef);
                    instance.SetProperty(AdministrationStrings.Service, serviceRef);

                    instances.AddInstance(instance);
                }
            }
        }
Esempio n. 4
0
        void FillChannelInfo(IChannel channel, IWmiInstance instance)
        {
            Fx.Assert(null != instance, "");
            Fx.Assert(null != channel, "");
            instance.SetProperty(AdministrationStrings.Type, channel.GetType().ToString());

            ServiceChannel serviceChannel = ServiceChannelFactory.GetServiceChannel(channel);

            if (null != serviceChannel)
            {
                string uri = serviceChannel.RemoteAddress == null ? String.Empty : serviceChannel.RemoteAddress.ToString();
                instance.SetProperty(AdministrationStrings.RemoteAddress, uri);
                string contractName   = null != serviceChannel.ClientRuntime ? serviceChannel.ClientRuntime.ContractName : String.Empty;
                string remoteEndpoint = EndpointInstanceProvider.EndpointReference(uri, contractName, false);
                instance.SetProperty(AdministrationStrings.RemoteEndpoint, remoteEndpoint);
                instance.SetProperty(AdministrationStrings.LocalAddress, serviceChannel.LocalAddress == null ? String.Empty : serviceChannel.LocalAddress.ToString());
                instance.SetProperty(AdministrationStrings.SessionId, ((IContextChannel)serviceChannel).SessionId);
            }
        }