SHARE
TWEET

test

a guest Sep 16th, 2019 96 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         private void Button1_Click(object sender, EventArgs e)
  2.         {
  3.             location = textBox1.Text;
  4.             amount = Int32.Parse(textBox2.Text);
  5.             progressBar1.Maximum = amount;
  6.             progressBar1.Step = 1;
  7.             for(int i = 0; i < amount; i++)
  8.             {
  9.                 progressBar1.PerformStep();
  10.                 string path = location + "/" + RandomString(7) + ".txt";
  11.                 if (!File.Exists(path))
  12.                 {
  13.                     using (StreamWriter sw = File.CreateText(path))
  14.                     {
  15.                         sw.WriteLine("Hello");
  16.                         sw.WriteLine("And");
  17.                         sw.WriteLine("Welcome");
  18.                     }
  19.                 }
  20.  
  21.             }
  22.         }
  23.  
  24.         public static string RandomString(int length)
  25.         {
  26.             const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
  27.             return new string(Enumerable.Repeat(chars, length)
  28.               .Select(s => s[random.Next(s.Length)]).ToArray());
  29.         }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top