internal SystemIPv4InterfaceProperties(FixedInfo fixedInfo, IpAdapterInfo ipAdapterInfo)
 {
     this.index = ipAdapterInfo.index;
     this.routingEnabled = fixedInfo.EnableRouting;
     this.dhcpEnabled = ipAdapterInfo.dhcpEnabled;
     this.haveWins = ipAdapterInfo.haveWins;
     this.gatewayAddresses = ipAdapterInfo.gatewayList.ToIPGatewayAddressCollection();
     this.dhcpAddresses = ipAdapterInfo.dhcpServer.ToIPAddressCollection();
     IPAddressCollection addresss = ipAdapterInfo.primaryWinsServer.ToIPAddressCollection();
     IPAddressCollection addresss2 = ipAdapterInfo.secondaryWinsServer.ToIPAddressCollection();
     this.winsServerAddresses = new IPAddressCollection();
     foreach (IPAddress address in addresss)
     {
         this.winsServerAddresses.InternalAdd(address);
     }
     foreach (IPAddress address2 in addresss2)
     {
         this.winsServerAddresses.InternalAdd(address2);
     }
     SystemIPv4InterfaceStatistics statistics = new SystemIPv4InterfaceStatistics((long) this.index);
     this.mtu = (uint) statistics.Mtu;
     if (ComNetOS.IsWin2K)
     {
         this.GetPerAdapterInfo(ipAdapterInfo.index);
     }
     else
     {
         this.dnsAddresses = fixedInfo.DnsAddresses;
     }
 }
Esempio n. 2
0
        internal SystemIPv4InterfaceProperties(FixedInfo fixedInfo, IpAdapterInfo ipAdapterInfo)
        {
            this.index            = ipAdapterInfo.index;
            this.routingEnabled   = fixedInfo.EnableRouting;
            this.dhcpEnabled      = ipAdapterInfo.dhcpEnabled;
            this.haveWins         = ipAdapterInfo.haveWins;
            this.gatewayAddresses = ipAdapterInfo.gatewayList.ToIPGatewayAddressCollection();
            this.dhcpAddresses    = ipAdapterInfo.dhcpServer.ToIPAddressCollection();
            IPAddressCollection addresss  = ipAdapterInfo.primaryWinsServer.ToIPAddressCollection();
            IPAddressCollection addresss2 = ipAdapterInfo.secondaryWinsServer.ToIPAddressCollection();

            this.winsServerAddresses = new IPAddressCollection();
            foreach (IPAddress address in addresss)
            {
                this.winsServerAddresses.InternalAdd(address);
            }
            foreach (IPAddress address2 in addresss2)
            {
                this.winsServerAddresses.InternalAdd(address2);
            }
            SystemIPv4InterfaceStatistics statistics = new SystemIPv4InterfaceStatistics((long)this.index);

            this.mtu = (uint)statistics.Mtu;
            if (ComNetOS.IsWin2K)
            {
                this.GetPerAdapterInfo(ipAdapterInfo.index);
            }
            else
            {
                this.dnsAddresses = fixedInfo.DnsAddresses;
            }
        }
        internal SystemNetworkInterface(FixedInfo fixedInfo, IpAdapterInfo ipAdapterInfo)
        {
            this.id              = ipAdapterInfo.adapterName;
            this.name            = string.Empty;
            this.description     = ipAdapterInfo.description;
            this.index           = ipAdapterInfo.index;
            this.physicalAddress = ipAdapterInfo.address;
            this.addressLength   = ipAdapterInfo.addressLength;
            if (ComNetOS.IsWin2K && !ComNetOS.IsPostWin2K)
            {
                this.name = this.ReadAdapterName(this.id);
            }
            if (this.name.Length == 0)
            {
                this.name = this.description;
            }
            SystemIPv4InterfaceStatistics statistics = new SystemIPv4InterfaceStatistics((long)this.index);

            this.operStatus = statistics.OperationalStatus;
            switch (ipAdapterInfo.type)
            {
            case OldInterfaceType.Ppp:
                this.type = System.Net.NetworkInformation.NetworkInterfaceType.Ppp;
                break;

            case OldInterfaceType.Loopback:
                this.type = System.Net.NetworkInformation.NetworkInterfaceType.Loopback;
                break;

            case OldInterfaceType.Slip:
                this.type = System.Net.NetworkInformation.NetworkInterfaceType.Slip;
                break;

            case OldInterfaceType.Fddi:
                this.type = System.Net.NetworkInformation.NetworkInterfaceType.Fddi;
                break;

            case OldInterfaceType.Ethernet:
                this.type = System.Net.NetworkInformation.NetworkInterfaceType.Ethernet;
                break;

            case OldInterfaceType.TokenRing:
                this.type = System.Net.NetworkInformation.NetworkInterfaceType.TokenRing;
                break;

            default:
                this.type = System.Net.NetworkInformation.NetworkInterfaceType.Unknown;
                break;
            }
            this.interfaceProperties = new SystemIPInterfaceProperties(fixedInfo, ipAdapterInfo);
        }
        internal SystemNetworkInterface(FixedInfo fixedInfo, IpAdapterInfo ipAdapterInfo)
        {
            this.id = ipAdapterInfo.adapterName;
            this.name = string.Empty;
            this.description = ipAdapterInfo.description;
            this.index = ipAdapterInfo.index;
            this.physicalAddress = ipAdapterInfo.address;
            this.addressLength = ipAdapterInfo.addressLength;
            if (ComNetOS.IsWin2K && !ComNetOS.IsPostWin2K)
            {
                this.name = this.ReadAdapterName(this.id);
            }
            if (this.name.Length == 0)
            {
                this.name = this.description;
            }
            SystemIPv4InterfaceStatistics statistics = new SystemIPv4InterfaceStatistics((long) this.index);
            this.operStatus = statistics.OperationalStatus;
            switch (ipAdapterInfo.type)
            {
                case OldInterfaceType.Ppp:
                    this.type = System.Net.NetworkInformation.NetworkInterfaceType.Ppp;
                    break;

                case OldInterfaceType.Loopback:
                    this.type = System.Net.NetworkInformation.NetworkInterfaceType.Loopback;
                    break;

                case OldInterfaceType.Slip:
                    this.type = System.Net.NetworkInformation.NetworkInterfaceType.Slip;
                    break;

                case OldInterfaceType.Fddi:
                    this.type = System.Net.NetworkInformation.NetworkInterfaceType.Fddi;
                    break;

                case OldInterfaceType.Ethernet:
                    this.type = System.Net.NetworkInformation.NetworkInterfaceType.Ethernet;
                    break;

                case OldInterfaceType.TokenRing:
                    this.type = System.Net.NetworkInformation.NetworkInterfaceType.TokenRing;
                    break;

                default:
                    this.type = System.Net.NetworkInformation.NetworkInterfaceType.Unknown;
                    break;
            }
            this.interfaceProperties = new SystemIPInterfaceProperties(fixedInfo, ipAdapterInfo);
        }