Example #1
0
        #pragma warning disable 2202
         void button2_Click(object sender, EventArgs e) {
            if(len.Text.Length>0&&how.Text.Length>0) {
                int le=int.Parse(len.Text);
                int ho=int.Parse(how.Text);
                s.richTextBox1.Text="";
                s.Close();
                s=new PasswordResult();
                s.Show();
               for(int b=0;b<ho;b++) {
                    s.richTextBox1.SelectionColor=Color.Cyan;
                    string init=(b+1).ToString();
                    while(init.Length<ho.ToString().Length) {init="0"+init; }
                    s.richTextBox1.AppendText(init+" ");
                    s.richTextBox1.SelectionColor=Color.White;
                    string pass="";
                    while(pass.Length<le) {
                        int k=rnd.Next(5);
                        if(k==0&&num.Checked) {pass+=nume.ToCharArray()[rnd.Next(10)].ToString(); }
                        else if(k==1&&upp.Checked) {pass+=uppe.ToCharArray()[rnd.Next(26)].ToString(); }
                        else if(k==2&&low.Checked) {pass+=lowe.ToCharArray()[rnd.Next(26)].ToString(); }
                        else if(k==3&&spe.Checked) {pass +=spec.ToCharArray()[rnd.Next(31)].ToString(); }
                        else if(k==4&&use.TextLength>0) {pass+=use.Text.ToCharArray()[rnd.Next(use.TextLength)].ToString(); }
                        else { pass+="";}
                    }
                     if(save.Checked&&path.Text!="") {{try{
					using (StreamWriter sw = File.AppendText(path.Text))
					{
                                     if(b+1<ho) { sw.WriteLine(init+" : "+pass);}
                                     else {sw.Write(init+" : "+pass); }
						sw.WriteLine(init+" : "+pass);
					    sw.Dispose();
						}
                            } catch(Exception){}
				}
                }
                    s.richTextBox1.AppendText(pass);
                    if(b+1<ho) {s.richTextBox1.AppendText("\n"); }
                }
            }
        }
Example #2
0
 #pragma warning disable 2202
 void button2_Click(object sender, EventArgs e)
 {
     if (len.Text.Length > 0 && how.Text.Length > 0)
     {
         int le = int.Parse(len.Text);
         int ho = int.Parse(how.Text);
         s.richTextBox1.Text = "";
         s.Close();
         s = new PasswordResult();
         s.Show();
         for (int b = 0; b < ho; b++)
         {
             s.richTextBox1.SelectionColor = Color.Cyan;
             string init = (b + 1).ToString();
             while (init.Length < ho.ToString().Length)
             {
                 init = "0" + init;
             }
             s.richTextBox1.AppendText(init + " ");
             s.richTextBox1.SelectionColor = Color.White;
             string pass = "";
             while (pass.Length < le)
             {
                 int k = rnd.Next(5);
                 if (k == 0 && num.Checked)
                 {
                     pass += nume.ToCharArray()[rnd.Next(10)].ToString();
                 }
                 else if (k == 1 && upp.Checked)
                 {
                     pass += uppe.ToCharArray()[rnd.Next(26)].ToString();
                 }
                 else if (k == 2 && low.Checked)
                 {
                     pass += lowe.ToCharArray()[rnd.Next(26)].ToString();
                 }
                 else if (k == 3 && spe.Checked)
                 {
                     pass += spec.ToCharArray()[rnd.Next(31)].ToString();
                 }
                 else if (k == 4 && use.TextLength > 0)
                 {
                     pass += use.Text.ToCharArray()[rnd.Next(use.TextLength)].ToString();
                 }
                 else
                 {
                     pass += "";
                 }
             }
             if (save.Checked && path.Text != "")
             {
                 { try{
                       using (StreamWriter sw = File.AppendText(path.Text))
                       {
                           if (b + 1 < ho)
                           {
                               sw.WriteLine(init + " : " + pass);
                           }
                           else
                           {
                               sw.Write(init + " : " + pass);
                           }
                           sw.WriteLine(init + " : " + pass);
                           sw.Dispose();
                       }
                   } catch (Exception) {} }
             }
             s.richTextBox1.AppendText(pass);
             if (b + 1 < ho)
             {
                 s.richTextBox1.AppendText("\n");
             }
         }
     }
 }