Exemplo n.º 1
0
        /// <summary>获取IP地址的物理地址位置</summary>
        /// <param name="addr"></param>
        /// <returns></returns>
        public static String GetAddress(this IPAddress addr)
        {
            if (addr.IsAny())
            {
                return("任意地址");
            }
            if (IPAddress.IsLoopback(addr))
            {
                return("本地环回");
            }
            if (addr.IsLocal())
            {
                return("本机地址");
            }

            if (IpProvider == null)
            {
                IpProvider = new MyIpProvider();
            }

            return(IpProvider.GetAddress(addr));
        }
Exemplo n.º 2
0
        /// <summary>获取IP地址的物理地址位置</summary>
        /// <param name="addr"></param>
        /// <returns></returns>
        public static String GetAddress(this IPAddress addr)
        {
            if (addr.IsAny())
            {
                return("任意地址");
            }
            else if (IPAddress.IsLoopback(addr))
            {
                return("本地环回地址");
            }
            else if (addr.IsLocal())
            {
                return("本机地址");
            }

            if (_IpProvider == null)
            {
                _IpProvider = ObjectContainer.Current.AutoRegister <IPProvider, IpProviderDefault>().Resolve <IPProvider>();
            }

            return(_IpProvider.GetAddress(addr));
        }