public void ScanAdditional(NetworkInterface ni) { NetworkInterface = ni; InterfaceIPAddress = GetAdapterIP(NetworkInterface); //Determine if a scan has already been run on that network adapter, if so, refresh the scan bool exists = false; int index = 0; foreach (NetworkScan ns in Tabs) { if (ns.TabHeader.Equals(NetworkInterface.Name)) { exists = true; break; } index++; } if (exists) { Tabs[index].AdapterIP = InterfaceIPAddress; Tabs[index].ARPResults = IPInfo.GetInterfaceIPInfo(InterfaceIPAddress); } else { Tabs.Add(new NetworkScan(NetworkInterface.Name)); Tabs[Tabs.Count - 1].AdapterIP = InterfaceIPAddress; Tabs[Tabs.Count - 1].ARPResults = IPInfo.GetInterfaceIPInfo(InterfaceIPAddress); } tab_ScanResults.ItemsSource = Tabs; tab_ScanResults.Items.Refresh(); }
/// <summary> /// Retrieves the IPInfo for the machine on the local network with the specified MAC Address. /// </summary> /// <param name="macAddress">The MAC Address of the IPInfo to retrieve.</param> /// <returns></returns> public static IPInfo GetIPInfo(string macAddress) { var ipinfo = (from ip in IPInfo.GetIPInfo() where ip.MacAddress.ToLowerInvariant() == macAddress.ToLowerInvariant() select ip).FirstOrDefault(); return ipinfo; }
private void Loaded_Scan_Results(object sender, RoutedEventArgs e) { Tabs.Add(new NetworkScan(NetworkInterface.Name)); Tabs[0].AdapterIP = InterfaceIPAddress; Tabs[0].ARPResults = IPInfo.GetInterfaceIPInfo(InterfaceIPAddress); tab_ScanResults.ItemsSource = Tabs; tab_ScanResults.Items.Refresh(); }
private void Click_btn_RefreshScan(object sender, RoutedEventArgs e) { Tabs[tab_ScanResults.SelectedIndex].ARPResults = IPInfo.GetInterfaceIPInfo(Tabs[tab_ScanResults.SelectedIndex].AdapterIP); }