Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.ComponentModel;
- using System.Data;
- using System.Drawing;
- using System.Linq;
- using System.Text;
- using System.Windows.Forms;
- using Tamir.SharpSsh;
- namespace WindowsFormsApplication1
- {
- public partial class Form1 : Form
- {
- public Form1()
- {
- InitializeComponent();
- }
- private void button1_Click(object sender, EventArgs e)
- {
- //List<string> files = new List<string>();
- string username = textBox1.Text;
- string password = textBox2.Text;
- Sftp sftp = new Sftp("109.71.49.69", username, password);
- sftp.Connect();
- //string[] files = sftp.GetFileList("//var/www").Cast<string>().ToArray();
- string location = "/var/www";
- foreach (string f in sftp.GetFileList(location))
- {
- if(f != ".." && f != "."){
- listView1.Items.Add(new ListViewItem(f));
- }
- }
- label1.Text = "SUCCESVOL";
- sftp.Close();
- /* catch
- {
- sftp.Close();
- username = null;
- label1.Text = "Please enter a correct username and/or password";
- return;
- }
- */
- }
- private void textBox2_TextChanged(object sender, EventArgs e)
- {
- }
- private void Form1_FormClosing(object sender, FormClosingEventArgs e)
- {
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement