public string FindIpAddressByMacAddress(string macAddress, string currentIpAddress) { Parallel.ForEach(GetListOfSubnetIps(currentIpAddress), delegate(string s) { DeviceScanner.IsHostAccessible(s); }); var arpEntities = new ArpHelper().GetArpResult(); var ip = arpEntities.FirstOrDefault( a => string.Equals( a.MacAddress, macAddress, StringComparison.CurrentCultureIgnoreCase))?.Ip; return(ip); }
/// <summary> /// Printa na tela a lista ARP. Semelhante à /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnArpList_Click(object sender, EventArgs e) { // Classe usada para listar o ARP (Todos os IP's registrados no gateway) ArpHelper arp = new ArpHelper(); // Gera a lista ARP. listArp = arp.GetArpResult(); // txtResult.Clear(); // txtResult.AppendText(string.Format("Lista de Equipamentos Encontrados:\r\n")); // foreach (var item in listArp) { // Exibe os dados do equipamento txtResult.AppendText(string.Format("\r\nIP: {0}, MAC: {1}, Type: {2}", item.Ip, item.MacAddress, item.Type)); } }