コード例 #1
0
 internal EditRDP(RDP connection)
 {
     //
     // The InitializeComponent() call is required for Windows Forms designer support.
     //
     InitializeComponent();
     this.connection = connection;
     this.NewRDPFile = this.connection.RDPFile;
 }
コード例 #2
0
        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;
        }