private void ReadPorts()
        {
            //var s = new Uri(Path.GetDirectoryName(Assembly.GetEntryAssembly().GetName().CodeBase) + @"\portsdb.txt").LocalPath;
            var s      = Properties.Settings.Default.PortsDBLocation;
            var reader = new StreamReader(File.OpenRead(s));

            while (!reader.EndOfStream)
            {
                var line   = reader.ReadLine();
                var values = line.Split(',');

                if (values.Length != 5)
                {
                    continue;
                }

                PortData p = new PortData();
                p.Name = values[0];
                CommsMode m;
                Enum.TryParse <CommsMode>(values[1], out m);
                p.Mode       = m;
                p.RemoteIP   = values[2];
                p.RemotePort = values[3];
                p.LocalPort  = values[4];

                PortsDatabase.Add(p);
            }
        }
 private void ListView_MouseDoubleClick(object sender, MouseButtonEventArgs e)
 {
     Result = lstPorts.SelectedValue as PortData;
     this.Close();
 }