private void button1_Click(object sender, EventArgs e) { using (ScpClient client = new ScpClient(hostname, username, password)) { client.Connect(); if (client.IsConnected) { j = Nayta.GetCounter() - 1; if (j > 0) { for (int i = j; i >= 0; i--) { address = "C:/Temp/" + Nayta.GetFileName(i); if (!File.Exists(address)) { using (Stream localFile = File.Create(address)) { client.Download("/home/pi/Pictures/" + Nayta.GetFileName(i), localFile); } } } } } } }
private void button2_Click(object sender, EventArgs e) { Nayta nayta = new Nayta(hostname, username, password); i = Nayta.GetCounter() - 1; for (int j = i; j >= 0; j--) { textBox1.Text = textBox1.Text + Nayta.GetFileName(j) + Environment.NewLine; } button1.Enabled = true; }