private void UIRs(string s) { try { Invoke(new Action(() => { TBRs.AppendText(s); })); } catch { } }
private void BTFindPort_Click(object sender, EventArgs e) { if (!string.IsNullOrWhiteSpace(TBPort.Text)) { var list = CMDNetstatTool.FindByPort(int.Parse(TBPort.Text)); if (ListTool.HasElements(list)) { list.ForEach(x => { string name = "-"; string file = "-"; try { Process p = Process.GetProcessById(x.Item2); name = p?.ProcessName; file = p?.MainModule.FileName; } catch { } TBRs.AppendText($"{x.Item1}, {x.Item2}, {name}, {file}"); TBRs.AppendText(Environment.NewLine); }); } } }