Пример #1
0
 public NetworkCard[] RefreshInternetCards(NetworkCard[] ncards)
 {
     List<NetworkCard> cards = new List<NetworkCard>();
     foreach(NetworkCard card in ncards)
         if(card.IsConnectedToInternet)
             cards.Add(card);
     return cards.ToArray();
 }
Пример #2
0
 private NetworkCard GetNetworkAdapter(Guid guid)
 {
     NetworkCard retval = null;
     foreach (NetworkInterface ni in NetworkInterface.GetAllNetworkInterfaces())
     {
         if(Guid.Parse(ni.Id) == guid)
         {
             foreach (UnicastIPAddressInformation ip in ni.GetIPProperties().UnicastAddresses)
             {
                 if (ip.Address.AddressFamily == System.Net.Sockets.AddressFamily.InterNetwork)
                 {
                     retval = new NetworkCard(ni.Name, ni.Id, ip.Address);
                     break;
                 }
             }
         }
     }
     return retval;
 }