示例#1
0
        public static HostNetInfo ForThisHost()
        {
            var computerProps = IPGlobalProperties.GetIPGlobalProperties();

            var result = new HostNetInfo
            {
                m_Name              = "{0}.{1}".Args(computerProps.HostName, computerProps.DomainName),
                m_HostNameSegment   = computerProps.HostName,
                m_DomainNameSegment = computerProps.DomainName
            };

            var adapters = new OrderedRegistry <NetAdapterInfo>();
            var nics     = NetworkInterface.GetAllNetworkInterfaces();
            var ord      = 0;

            foreach (var nic in nics)
            {
                adapters.Register(new NetAdapterInfo(nic, ord));
                ord++;
            }

            result.m_Adapters = adapters;
            return(result);
        }
示例#2
0
        public static HostNetInfo ForThisHost()
        {
            var computerProps = IPGlobalProperties.GetIPGlobalProperties();

              var result = new HostNetInfo
              {
                m_Name = "{0}.{1}".Args(computerProps.HostName, computerProps.DomainName),
                m_HostNameSegment = computerProps.HostName,
                m_DomainNameSegment = computerProps.DomainName
              };

              var adapters = new OrderedRegistry<NetAdapterInfo>();
              var nics = NetworkInterface.GetAllNetworkInterfaces();
              var ord = 0;
              foreach(var nic in nics)
              {
                adapters.Register( new NetAdapterInfo(nic, ord) );
                ord++;
              }

              result.m_Adapters = adapters;
              return result;
        }