資源簡(jiǎn)介
查詢與指定端口相關(guān)的進(jìn)程列表,并提供殺進(jìn)程按鈕.實(shí)際內(nèi)容為將控制臺(tái)命令"netstat"數(shù)據(jù)解析顯示為列表,并提供殺進(jìn)程的按鈕;
代碼片段和文件信息
using?System;
using?System.Windows.Forms;
using?System.Diagnostics;
using?Util;
namespace?WhoUseThePort
{
????public?partial?class?Form1?:?Form
????{
????????public?Form1()
????????{
????????????InitializeComponent();
????????}
????????private?void?btnSearch_Click(object?sender?EventArgs?e)
????????{
????????????int?port?=?(int)numericUpDown1.Value;
????????????var?proc?=?WhoUsePort.NetStatus(portcheckBox1.Checked);
????????????dataGridView1.Rows.Clear();
????????????foreach?(var?p?in?proc)
????????????{
????????????????int?index?=?dataGridView1.RowCount;
????????????????dataGridView1.Rows.Insert(index?new?string[]?{?““
????????????????????p.ProcessName
????????????????????p.Pid.ToString()
????????????????????p.LocolPort.ToString()
????????????????????p.T
?屬性????????????大小?????日期????時(shí)間???名稱
-----------?---------??----------?-----??----
?????文件?????????80??2019-04-18?08:30??WhoUseThePort\.git\COMMIT_EDITMSG
?????文件????????772??2019-04-17?16:12??WhoUseThePort\.git\config
?????文件?????????73??2019-04-17?16:12??WhoUseThePort\.git\desc
?????文件?????????23??2019-04-17?16:12??WhoUseThePort\.git\HEAD
?????文件????????478??2019-04-17?16:12??WhoUseThePort\.git\hooks\applypatch-msg.sample
?????文件????????896??2019-04-17?16:12??WhoUseThePort\.git\hooks\commit-msg.sample
?????文件????????189??2019-04-17?16:12??WhoUseThePort\.git\hooks\post-update.sample
?????文件????????424??2019-04-17?16:12??WhoUseThePort\.git\hooks\pre-applypatch.sample
?????文件???????1642??2019-04-17?16:12??WhoUseThePort\.git\hooks\pre-commit.sample
?????文件???????1348??2019-04-17?16:12??WhoUseThePort\.git\hooks\pre-push.sample
?????文件???????4898??2019-04-17?16:12??WhoUseThePort\.git\hooks\pre-reba
?????文件????????544??2019-04-17?16:12??WhoUseThePort\.git\hooks\pre-receive.sample
?????文件???????1239??2019-04-17?16:12??WhoUseThePort\.git\hooks\prepare-commit-msg.sample
?????文件???????3610??2019-04-17?16:12??WhoUseThePort\.git\hooks\update.sample
?????文件???????1564??2019-04-18?08:30??WhoUseThePort\.git\index
?????文件????????240??2019-04-17?16:12??WhoUseThePort\.git\info\exclude
?????文件????????542??2019-04-18?08:30??WhoUseThePort\.git\logs\HEAD
?????文件????????542??2019-04-18?08:30??WhoUseThePort\.git\logs\refs\heads\master
?????文件????????151??2019-04-18?08:30??WhoUseThePort\.git\ms-persist.xm
?????文件????????159??2019-04-17?16:12??WhoUseThePort\.git\ob
?????文件???????2013??2019-04-18?08:30??WhoUseThePort\.git\ob
?????文件????????751??2019-04-17?16:12??WhoUseThePort\.git\ob
?????文件???????1138??2019-04-17?16:12??WhoUseThePort\.git\ob
?????文件????????186??2019-04-17?16:12??WhoUseThePort\.git\ob
?????文件???????2112??2019-04-17?16:12??WhoUseThePort\.git\ob
?????文件????????233??2019-04-17?16:12??WhoUseThePort\.git\ob
?????文件????????182??2019-04-17?16:12??WhoUseThePort\.git\ob
?????文件????????459??2019-04-17?16:12??WhoUseThePort\.git\ob
?????文件????????235??2019-04-18?08:30??WhoUseThePort\.git\ob
?????文件????????289??2019-04-18?08:30??WhoUseThePort\.git\ob
............此處省略105個(gè)文件信息
評(píng)論
共有 條評(píng)論