internal EditWinSCP(WinSCP connection) { // // The InitializeComponent() call is required for Windows Forms designer support. // InitializeComponent(); this.connection = connection; this.NewHost = this.connection.Host; this.NewPort = this.connection.Port; this.NewProtocol = this.connection.Protocol; this.NewUsername = this.connection.Username; this.textBoxHost.Text = this.connection.Host; this.textBoxPort.Text = this.connection.Port; this.textBoxUsername.Text = this.connection.Username; this.comboBoxProtocols.SelectedItem = this.connection.Protocol.ToUpper(); }
internal static void load(string file, string baseFolder) { if(!File.Exists(file)) { return; } var lines = File.ReadAllLines(file); if(lines.Length < 2) { return; } if(lines[1].Trim() == "RDP" && lines.Length >= 3) { var rdp = new RDP(baseFolder); rdp.Filename = file; rdp.Name = lines[0].Trim(); rdp.RDPFile = lines[2]; } if(lines[1].Trim() == "WinSCP" && lines.Length >= 6) { var winSCP = new WinSCP(baseFolder); winSCP.Filename = file; winSCP.Name = lines[0].Trim(); winSCP.Host = lines[2].Trim(); winSCP.Port = lines[3].Trim(); winSCP.Protocol = lines[4].Trim(); winSCP.Username = lines[5].Trim(); } if(lines[1].Trim() == "PuTTY" && lines.Length >= 9) { var putty = new PuTTY(baseFolder); putty.Filename = file; putty.Name = lines[0].Trim(); putty.Compression = lines[2].Trim() == "true"; putty.ForceIPv4 = lines[3].Trim() == "true"; putty.ForceIPv6 = lines[4].Trim() == "true"; putty.Host = lines[5].Trim(); putty.Port = lines[6].Trim(); putty.Username = lines[7].Trim(); putty.X11 = lines[8].Trim() == "true"; } if(lines[1].Trim() == "SSHTunnel" && lines.Length >= 9) { var tunnel = new SSHTunnel(baseFolder); tunnel.Filename = file; tunnel.Name = lines[0].Trim(); tunnel.Username = lines[2].Trim(); tunnel.LocalEndpoint = lines[3].Trim(); tunnel.LocalPort = lines[4].Trim(); tunnel.RemoteEndpoint = lines[5].Trim(); tunnel.RemotePort = lines[6].Trim(); tunnel.SSHHost = lines[7].Trim(); tunnel.SSHHostPort = lines[8].Trim(); } return; }