Beispiel #1
0
        private void button3_Click(object sender, EventArgs e)
        {
            login login_form = new login();

            login_form.ShowDialog();
            this.Text = "SSH Frontend (connecting)";
            user      = login_form.GetUser();
            pass      = login_form.GetPass();
            try
            {
                ssh_client = new SshClient(host, user, pass);
                ssh_client.Connect();
            }
            catch (Exception exception)
            {
                if (exception is SshAuthenticationException || exception is ArgumentException)
                {
                    alert_form alert = new alert_form("Wrong username or password!");
                    alert.ShowDialog();
                }
                return;
            }
            ssh_cmd    = ssh_client.CreateCommand("");
            this.Text  = "SSH Frontend (connected)";
            r_explorer = new remote_explorer(host, listBox4, listBox3, ssh_cmd);
            listBox3.MouseDoubleClick += r_explorer.virtual_dir_double_click;
            listBox4.MouseDoubleClick += r_explorer.remote_dir_double_click;
            exchanger      = new explorer_exchange(host, user, pass, l_explorer, r_explorer);
            button1.Click += exchanger.upload_button_pressed;
            button2.Click += exchanger.download_button_pressed;
        }
 public void read_directory()
 {
     this.entries = new List <directory_entry>();
     entries.Add(new directory_entry(path + "..\\", path, true));
     try
     {
         foreach (string entry_path in System.IO.Directory.GetDirectories(path))
         {
             entries.Add(new directory_entry(entry_path + "\\", path, true));
         }
     }
     catch (UnauthorizedAccessException exception)
     {
         Form alert = new alert_form("Permission Denied!");
         alert.Show();
         path = Directory.GetParent(Directory.GetParent(path).FullName).FullName;
         read_directory();
         return;
     }
     foreach (string entry_path in System.IO.Directory.GetFiles(path))
     {
         entries.Add(new directory_entry(entry_path, path, false));
     }
 }