Пример #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            label_work.Visible = true;
            Application.DoEvents();
            List <IPInfo> info = IPInfo.GetIPInfo();

            foreach (var item in textBox1.Lines)
            {
                if (IPInfo.Contains(info, item))
                {
                    IPInfo ip = IPInfo.GetIPInfo(info, item);
                    if (ip != null)
                    {
                        textBox2.AppendText((ip.HostName ?? "NO HOSTNAME") + "," + ip.IPAddress + "," + ip.MacAddress + Environment.NewLine);
                    }
                    else
                    {
                        textBox2.AppendText("Can't Resolve MAC " + item + Environment.NewLine);
                    }
                }
                else
                {
                    textBox2.AppendText("Can't Find MAC " + item + Environment.NewLine);
                }
            }
            label_work.Visible = false;
        }
Пример #2
0
        /// <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);
        }
Пример #3
0
        private void button2_Click(object sender, EventArgs e)
        {
            label_work.Visible = true;
            Application.DoEvents();
            List <IPInfo> info = IPInfo.GetIPInfo();

            foreach (IPInfo item in info)
            {
                textBox2.AppendText((item.HostName ?? "NO HOSTNAME") + "," + item.IPAddress + "," + item.MacAddress + Environment.NewLine);
            }
            label_work.Visible = false;
        }