예제 #1
0
파일: Form1.cs 프로젝트: og3niuz/TcpViewer
        public void netstat_islemleri()
        {
            netstat nt = new netstat();

            nt.cmd_calistir();
            panel3.Visible = true;

            dataGridView2.Visible = false;
            dataGridView1.Visible = true;

            dataGridView1.Location = new Point(3, 3);
            dataGridView1.Width    = 977;
            dataGridView1.Height   = 645;
        }
예제 #2
0
파일: Form1.cs 프로젝트: og3niuz/TcpViewer
        /*
         # islem listele metodu ile netstat sınıfından yeni bir nesne türetilip, o an çalışan proccessler alınır ve datagride aktarılır
         #
         */

        public void islem_listele()

        {
            dataGridView1.Rows.Clear();
            netstat ntt = new netstat();

            ntt.cmd_calistir();
            int i     = 0;
            int limit = ntt.aray.Count;



            for (int a = 9; a < 300; a += 5)
            {
                try
                {
                    dataGridView1.Rows.Add();
                    PID = ntt.aray[a + 4].ToString();
                    var procees_name = Process.GetProcessById(Convert.ToInt32(PID)).ProcessName;


                    dataGridView1.Rows[i].Cells[1].Value = procees_name;
                    dataGridView1.Rows[i].Cells[0].Value = PID;

                    dataGridView1.Rows[i].Cells[2].Value = ntt.aray[a + 1].ToString();
                    dataGridView1.Rows[i].Cells[3].Value = ntt.aray[a + 2].ToString();
                    dataGridView1.Rows[i].Cells[4].Value = ntt.aray[a + 3].ToString();
                    if (dataGridView1.Rows[i].Cells[4].Value.ToString() == "ESTABLISHED")
                    {
                        dataGridView1.Rows[i].Cells[4].Style.BackColor = Color.Green;
                    }
                    i++;
                }

                catch (Exception error)
                {
                }

                this.dataGridView1.Sort(this.dataGridView1.Columns["Column6"], ListSortDirection.Descending);
            }
        }