Config() public method

public Config ( string message ) : void
message string
return void
示例#1
0
        private AdvDnsClient GetDns()
        {
            string ip      = Config.Dns.Server;
            int    timeout = Config.Dns.Timeout;

            if (string.IsNullOrWhiteSpace(ip))
            {
                Logger.Config("Take the default DNS configured on this host");
                return(new AdvDnsClient(DnsClient.Default));
            }

            Logger.Config("Take the configured DNS: {0} with timeout {1}", ip, timeout);
            return(new AdvDnsClient(IPAddress.Parse(ip), timeout));
        }
示例#2
0
        private IPAddress[] GetDefaultNetworkInfo(out IPAddress ipv4, out IPAddress ipv6)
        {
            IPAddress[] ips = Advtools.AdvInterceptor.Network.GetIpsByWmi();
            ipv4 = null;
            ipv6 = null;

            foreach (IPAddress ip in ips)
            {
                if (ipv4 == null && ip.AddressFamily == AddressFamily.InterNetwork)
                {
                    Logger.Config("Default IPv4 address is {0}", ip);
                    ipv4 = ip;
                }

                if (ipv6 == null && ip.AddressFamily == AddressFamily.InterNetworkV6)
                {
                    Logger.Config("Default IPv6 address is {0}", ip);
                    ipv6 = ip;
                }

                if (ipv4 != null && ipv6 != null)
                {
                    break;
                }
            }

            if (ipv4 == null)
            {
                Logger.Warning("No valid default IPv4 address found, take the loopback");
                ipv4 = IPAddress.Loopback;
            }

            if (ipv6 == null)
            {
                Logger.Warning("No valid default IPv6 address found, take the loopback");
                ipv6 = IPAddress.IPv6Loopback;
            }

            return(ips);
        }