private void button2_Click(object sender, EventArgs e) { if (SunucuIP != null) { TFTPClient tftp = new TFTPClient(SunucuIP); tftp.Put(DosyaAdi, DosyaYolu); if (!listView1.Items.ContainsKey(DosyaAdi)) { StreamWriter Dosya = File.AppendText(tempDir);//dosyayı açtık. Dosya.WriteLine(DosyaAdi); Dosya.Close(); tftp.Put("dir.txt", tempDir); } listView1.Clear(); tftp.Get("dir.txt", tempDir); StreamReader dosya = File.OpenText(tempDir); //dosyayı açtık. string siradaki_satir = dosya.ReadLine(); // ilk satırı okutuyoruz ve alt satıra geçiyoruz. while (siradaki_satir != null) //satır boş olana kadar okutuyoruz { listView1.Items.Add(siradaki_satir); //okunan veriyi listboxa eklettik. siradaki_satir = dosya.ReadLine(); //satırı bidaha okuttuk. } dosya.Close(); textBox2.Text = ""; MessageBox.Show("Dosya başarıyla sunucuya gönderildi", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { MessageBox.Show("Sunucu IP boş olamaz!!"); } }
private void button5_Click(object sender, EventArgs e) { if (textBox3.Enabled == true) { SunucuIP = textBox3.Text; textBox3.Enabled = false; } else { textBox3.Enabled = true; } listView1.Clear(); TFTPClient tftp = new TFTPClient(SunucuIP); tftp.Get("dir.txt", tempDir); StreamReader dosya = File.OpenText(tempDir); //dosyayı açtık. string siradaki_satir = dosya.ReadLine(); // ilk satırı okutuyoruz ve alt satıra geçiyoruz. while (siradaki_satir != null) //satır boş olana kadar okutuyoruz { listView1.Items.Add(siradaki_satir); //okunan veriyi listboxa eklettik. siradaki_satir = dosya.ReadLine(); //satırı bidaha okuttuk. } dosya.Close(); }
private void button1_Click(object sender, EventArgs e) { if (SunucuIP == null) { MessageBox.Show("Sunucu IP boş olamaz!!"); } else if (SDosyaAdi == null) { MessageBox.Show("Yandaki listeden bir dosya seçmelisiniz"); } else { TFTPClient tftp = new TFTPClient(SunucuIP); tftp.Get(SDosyaAdi, DosyaYolu); textBox1.Text = ""; MessageBox.Show("Dosya başarıyla kaydedildi", "Bilgi", MessageBoxButtons.OK, MessageBoxIcon.Information); } }