Advertisement
Guest User

Untitled

a guest
Jun 14th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.64 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Data;
  5. using System.Drawing;
  6. using System.Linq;
  7. using System.Text;
  8. using System.Windows.Forms;
  9. using Tamir.SharpSsh;
  10.  
  11. namespace WindowsFormsApplication1
  12. {
  13.     public partial class Form1 : Form
  14.     {
  15.         public Form1()
  16.         {
  17.  
  18.             InitializeComponent();
  19.  
  20.         }
  21.  
  22.  
  23.  
  24.         private void button1_Click(object sender, EventArgs e)
  25.         {
  26.  
  27.  
  28.             //List<string> files = new List<string>();
  29.  
  30.             string username = textBox1.Text;
  31.             string password = textBox2.Text;
  32.  
  33.             Sftp sftp = new Sftp("109.71.49.69", username, password);
  34.             sftp.Connect();
  35.            
  36.             //string[] files = sftp.GetFileList("//var/www").Cast<string>().ToArray();
  37.             string location = "/var/www";
  38.             foreach (string f in sftp.GetFileList(location))
  39.             {
  40.                 if(f != ".." && f != "."){
  41.  
  42.                 listView1.Items.Add(new ListViewItem(f));        
  43.                 }
  44.             }
  45.  
  46.             label1.Text = "SUCCESVOL";
  47.  
  48.            
  49.             sftp.Close();
  50.            
  51. /*            catch
  52.             {
  53.                 sftp.Close();
  54.                 username = null;
  55.                 label1.Text = "Please enter a correct username and/or password";
  56.                 return;
  57.             }
  58. */            
  59.            
  60.         }
  61.  
  62.         private void textBox2_TextChanged(object sender, EventArgs e)
  63.         {
  64.  
  65.         }
  66.  
  67.         private void Form1_FormClosing(object sender, FormClosingEventArgs e)
  68.         {
  69.            
  70.         }
  71.     }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement