public PortStatus(PortStatus inPort) { this.Port = inPort.Port; this.Ip = inPort.Ip; this.Name = inPort.Name; this.Process = inPort.Process; this.Link = inPort.Link; this.Conf = inPort.Conf; }
//Загрузка файла public void LoadSomeFile(string path) { StreamReader reader = new StreamReader(path); PortStatus port = new PortStatus(); rep = 0; while (!reader.EndOfStream) { string line = reader.ReadLine(); this.Pars(line); } }
private void PortToWinList(PortStatus.PortStatus port) //заполнение строки в таблице { TekIndex = lstPorts.Items.Add(port.Port.ToString()).Index; lstPorts.Items[TekIndex].SubItems.Add(port.Link); lstPorts.Items[TekIndex].SubItems.Add(port.Conf); if (port.Name == "Can not obtain ownership information") { lstPorts.Items[TekIndex].SubItems.Add("Нет данных"); } else { lstPorts.Items[TekIndex].SubItems.Add(port.Name + " [" + port.Process + "]"); } lstPorts.Items[TekIndex].BackColor = Color.LightGreen; }
//Добавление в список public void AddPort(PortStatus newPort) { this.portList.Add(new PortStatus(newPort)); }