コード例 #1
0
ファイル: NetLocal.cs プロジェクト: willnode/Network-Facts
        public void Arquire()
        {
            try
            {
                locals.Clear();

                var brs = new NetworkBrowser();
                foreach (string name in brs.getNetworkComputers())
                {
                    var tim = new Stopwatch();
                    tim.Start();
                    var ips = Dns.GetHostAddresses(name);
                    tim.Stop();
                    var t = tim.Elapsed;
                    locals.Add(new LocalUnit()
                    {
                        hostname = name,
                        ipv4     = (from ip in ips where ip.AddressFamily == AddressFamily.InterNetwork select ip).FirstOrDefault(),
                        ipv6     = (from ip in ips where ip.AddressFamily == AddressFamily.InterNetworkV6 select ip).ToArray(),
                        latency  = t,
                    });
                }
            }
            catch (Exception e)
            {
                MessageBox.Show("Error occured during arcquiring local computers", e.GetType().ToString(), MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
コード例 #2
0
        private void obtener_nombres_equipo_button_Click(object sender, EventArgs e)
        {
            NetworkBrowser nb    = new NetworkBrowser();
            List <string>  lista = new List <string>();

            foreach (string pc in nb.getNetworkComputers())
            {
                dataGridView1.Rows.Add(pc);
            }
        }
コード例 #3
0
        static void Main(string[] args)
        {
            IniFile ini = new IniFile("C:\\users\\ade\\test.ini");

            ini.IniWriteValue("marcha", "dos", "pescadores");
            String readString = ini.IniReadValue("marcha", "dos");

            System.Console.WriteLine("Hello " + readString);

            ArrayList networkComputers = new ArrayList();

            NetworkBrowser nb = new NetworkBrowser();

            networkComputers = nb.getNetworkComputers();

            Console.WriteLine(networkComputers[0]);
        }
コード例 #4
0
        public DatabaseSettings(MySqlDB db)
        {
            InitializeComponent();
            this.mySqlDb = db;

            try
            {
                NetworkBrowser nb = new NetworkBrowser();
                foreach (string pc in nb.getNetworkComputers()){
                    cmbHost.Items.Add(pc);
                }
            }
            catch (Exception)
            {
                MessageBox.Show("An error occurred trying to access the network computers", "error",
                                   MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }
コード例 #5
0
        public DatabaseSettings(MySqlDB db)
        {
            InitializeComponent();
            this.mySqlDb = db;

            try
            {
                NetworkBrowser nb = new NetworkBrowser();
                foreach (string pc in nb.getNetworkComputers())
                {
                    cmbHost.Items.Add(pc);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("An error occurred trying to access the network computers", "error",
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                Application.Exit();
            }
        }
コード例 #6
0
ファイル: network.cs プロジェクト: radtek/LAN-Messenger
            public static List <string> getLanHostnames()
            {
                var s_comps = new List <string>();

                var nb        = new NetworkBrowser();
                var computers = nb.getNetworkComputers();

                for (int i = 0; i < computers.Count; i++)
                {
                    var o = computers[i];
                    if (o.ToString() == Environment.MachineName)
                    {
                        computers.RemoveAt(i);
                    }
                }
                for (int i = 0; i < computers.Count; i++)
                {
                    s_comps.Add(computers[i].ToString());
                }

                return(s_comps);
            }
コード例 #7
0
ファイル: network.cs プロジェクト: Marox44/LAN-Messenger
            public static List<string> getLanHostnames()
            {
                var s_comps = new List<string>();

                var nb = new NetworkBrowser();
                var computers = nb.getNetworkComputers();
                for (int i = 0; i < computers.Count; i++)
                {
                    var o = computers[i];
                    if (o.ToString() == Environment.MachineName)
                    {
                        computers.RemoveAt(i);
                    }
                }
                for (int i = 0; i < computers.Count; i++)
                {
                    s_comps.Add(computers[i].ToString());
                }

                return s_comps;
            }