Advertisement
Guest User

Untitled

a guest
Jun 8th, 2017
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1.  
  2. private void button1_Click(object sender, EventArgs e)
  3. {
  4. string[] gmail = GetGmails(txtGmail.Text);
  5. for (int i = 0; i < gmail.Count(); i++)
  6. {
  7. gmail[i] += "@gmail.com";
  8. }
  9. txtEmail.Lines = gmail;
  10. }
  11.  
  12. /// <summary>
  13. /// Gets a list of all possible dot tricked gmails.
  14. /// </summary>
  15. /// <param name="acc">The account name without @gmail.com.</param>
  16. /// <returns>All the possible doted gmails without @gmail.com</returns>
  17. public string[] GetGmails(string acc)
  18. {
  19. if (acc.Length > 1 && acc.Length < 31)
  20. {
  21. string head = acc.Substring(0, 1);
  22. string tail = acc.Substring(1, acc.Length - 1);
  23. string[] tails = GetGmails(tail);
  24. string[] ret = new string[tails.Length * 2];
  25. int iRet = 0;
  26. foreach (string t in tails)
  27. {
  28. ret[iRet] = head.ToString() + t;
  29. iRet++;
  30. ret[iRet] = head.ToString() + '.' + t;
  31. iRet++;
  32. }
  33. return ret;
  34. }
  35. else
  36. {
  37. string[] ret = { acc };
  38. return ret;
  39. }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement