Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private void button1_Click(object sender, EventArgs e)
- {
- if (radioButton1.Checked)
- {
- backgroundWorker1.RunWorkerAsync();
- }
- if (radioButton2.Checked)
- {
- StreamReader sr = new StreamReader(Application.StartupPath + @"hakimler.txt");
- while ((satir = sr.ReadLine()) != null)
- {
- try
- {
- bool copy = CopyDirectory(DosyaYolu.kaynak, @"\" + satir + @"" + DosyaYolu.hedef, true);
- if (copy)
- {
- kopya += 1;
- }
- else
- {
- sw.WriteLine(satir);
- }
- }
- catch (Exception)
- {
- }
- }
- sw.Close();
- MessageBox.Show("İşlem tamamlandı", "İşlem Sonu", MessageBoxButtons.OK, MessageBoxIcon.Information);
- lblkopya.Text = "Başarıyla tamamlanan iş sayısı : " + kopya.ToString();
- return;
- }
- if (chkPersonel.Checked == true)
- {
- StreamReader sr = new StreamReader(Application.StartupPath + @"personel.txt");
- while ((satir = sr.ReadLine()) != null)
- {
- try
- {
- bool copy = CopyDirectory(DosyaYolu.kaynak, @"\ab04500-" + satir + @"" + DosyaYolu.hedef, true);
- //bool copy = CopyDirectory(Application.StartupPath + @"TELEFON REHBERİ", @"\" + satir + @"c$Documents and SettingsAll UsersStart Menu", true);
- if (copy)
- {
- kopya += 1;
- }
- else
- {
- sw.WriteLine(satir);
- }
- }
- catch (Exception)
- {
- }
- }
- sw.Close();
- MessageBox.Show("İşlem tamamlandı", "İşlem Sonu", MessageBoxButtons.OK, MessageBoxIcon.Information);
- lblkopya.Text = "Başarıyla tamamlanan iş sayısı : " + kopya.ToString();
- return;
- }
- else
- {
- if (txtBilgisayar.Text == "" && txtDongu.Text == "")
- {
- MessageBox.Show("Boşlukları dolduralım bi zahmet :@", "Bilgisayar Kodlarını girelim lütfen!", MessageBoxButtons.OK, MessageBoxIcon.Warning);
- return;
- }
- bilgisayar = Convert.ToInt32(txtBilgisayar.Text);
- dongu = Convert.ToInt32(txtDongu.Text);
- for (int i = bilgisayar; i <= dongu; i++)
- {
- try
- {
- bool copy = CopyDirectory(DosyaYolu.kaynak, @"\ab04500-" + bilgisayar + @"" + DosyaYolu.hedef, true);
- if (copy)
- {
- kopya += 1;
- }
- else
- {
- sw.WriteLine(satir);
- }
- }
- catch (Exception)
- {
- }
- if (i == dongu)
- {
- sw.Close();
- MessageBox.Show("İşlem tamamlandı", "İşlem Sonu", MessageBoxButtons.OK, MessageBoxIcon.Information);
- lblkopya.Text = "Başarıyla tamamlanan iş sayısı : " + kopya.ToString();
- }
- bilgisayar += 1;
- }
- }
- private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
- {
- sw = new StreamWriter(DateTime.Today.ToShortDateString().ToString() + "_ulasmayanlar.txt", true);
- StreamReader sr = new StreamReader(Application.StartupPath + @"savcilar.txt");
- while ((satir = sr.ReadLine()) != null)
- {
- try
- {
- bool copy = CopyDirectory(DosyaYolu.kaynak, @"\" + satir + @"" + DosyaYolu.hedef, true);
- //bool copy = CopyDirectory(Application.StartupPath + @"TELEFON REHBERİ", @"\" + satir + @"c$Documents and SettingsAll UsersStart Menu", true);
- if (copy)
- {
- kopya += 1;
- }
- else
- {
- sw.WriteLine(satir);
- }
- }
- catch (Exception)
- {
- }
- }
- }
- private void backgroundWorker1_RunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
- {
- sw.Close();
- MessageBox.Show("İşlem tamamlandı", "İşlem Sonu", MessageBoxButtons.OK, MessageBoxIcon.Information);
- lblkopya.Text = "Başarıyla tamamlanan iş sayısı : " + kopya.ToString();
- }
Add Comment
Please, Sign In to add comment