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, IpAdapterAddresses ipAdapterAddresses)
 {
     this.id                  = ipAdapterAddresses.AdapterName;
     this.name                = ipAdapterAddresses.friendlyName;
     this.description         = ipAdapterAddresses.description;
     this.index               = ipAdapterAddresses.index;
     this.physicalAddress     = ipAdapterAddresses.address;
     this.addressLength       = ipAdapterAddresses.addressLength;
     this.type                = ipAdapterAddresses.type;
     this.operStatus          = ipAdapterAddresses.operStatus;
     this.ipv6Index           = ipAdapterAddresses.ipv6Index;
     this.adapterFlags        = ipAdapterAddresses.flags;
     this.interfaceProperties = new SystemIPInterfaceProperties(fixedInfo, ipAdapterAddresses);
 }
        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, IpAdapterAddresses ipAdapterAddresses)
 {
     this.id = ipAdapterAddresses.AdapterName;
     this.name = ipAdapterAddresses.friendlyName;
     this.description = ipAdapterAddresses.description;
     this.index = ipAdapterAddresses.index;
     this.physicalAddress = ipAdapterAddresses.address;
     this.addressLength = ipAdapterAddresses.addressLength;
     this.type = ipAdapterAddresses.type;
     this.operStatus = ipAdapterAddresses.operStatus;
     this.ipv6Index = ipAdapterAddresses.ipv6Index;
     this.adapterFlags = ipAdapterAddresses.flags;
     this.interfaceProperties = new SystemIPInterfaceProperties(fixedInfo, ipAdapterAddresses);
 }
        /// <summary>
        /// Gets the first <see cref="System.Net.NetworkInformation.NetworkInterface"/> by the given criteria.
        /// </summary>
        /// <param name="status">The status of the interface.</param>
        /// <param name="interfaceTypes">The types of interfaces.</param>
        /// <returns>If any, the interfaces which correspond to the given criteria.</returns>
        public static System.Collections.Generic.IEnumerable <System.Net.NetworkInformation.NetworkInterface> GetNetworkInterface(System.Net.NetworkInformation.OperationalStatus status, params System.Net.NetworkInformation.NetworkInterfaceType[] interfaceTypes)
        {
            if (interfaceTypes == null)
            {
                yield break;
            }

            foreach (System.Net.NetworkInformation.NetworkInterface networkInterface in System.Net.NetworkInformation.NetworkInterface.GetAllNetworkInterfaces())
            {
                if (0 >= System.Array.IndexOf(interfaceTypes, networkInterface.NetworkInterfaceType) && networkInterface.OperationalStatus.Equals(status))
                {
                    yield return(networkInterface);
                }
            }
        }