Advertisement
Guest User

Minecraft Name Generator

a guest
Feb 10th, 2016
1,400
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VB.NET 4.37 KB | None | 0 0
  1. Imports System.IO
  2. Imports System.Net
  3.  
  4. Public Class Form1
  5.     Dim count As Integer = 0
  6.     Private Function checkName(ByVal name As String) As Boolean
  7.         count += 1
  8.         Label3.Text = "Requests Sent: " & count
  9.  
  10.         Dim address As String = "https://minecraft.net/haspaid.jsp?user=" & name
  11.         Dim client As WebClient = New WebClient()
  12.         Dim reader As StreamReader = New StreamReader(client.OpenRead(address))
  13.         RichTextBox1.Text = reader.ReadToEnd
  14.         If RichTextBox1.Text = True Then
  15.             Return False
  16.         End If
  17.         Return True
  18.     End Function
  19.  
  20.     Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
  21.         ListBox1.Items.Clear()
  22.         ProgressBar1.Value = 0
  23.  
  24.         If RadioButton1.Checked Then
  25.             Do While ListBox1.Items.Count < CInt(TextBox1.Text)
  26.                 Dim s As String = lettersOnly(3, False)
  27.                 If checkName(s) = True Then
  28.                     ListBox1.Items.Add(s)
  29.                     ProgressBar1.Value += 1
  30.                 End If
  31.             Loop
  32.             MsgBox("Done")
  33.             ProgressBar1.Value = ProgressBar1.Value
  34.         End If
  35.         If RadioButton2.Checked Then
  36.             Do While ListBox1.Items.Count < CInt(TextBox1.Text)
  37.                 Dim s As String = numbersOnly(3, False)
  38.                 If checkName(s) = True Then
  39.                     ListBox1.Items.Add(s)
  40.                     ProgressBar1.Value += 1
  41.                 End If
  42.             Loop
  43.             MsgBox("Done")
  44.             ProgressBar1.Value = ProgressBar1.Value
  45.         End If
  46.         If RadioButton3.Checked Then
  47.             Do While ListBox1.Items.Count < CInt(TextBox1.Text)
  48.                 Dim s As String = both(3, False)
  49.                 If checkName(s) = True Then
  50.                     ListBox1.Items.Add(s)
  51.                     ProgressBar1.Value += 1
  52.                 End If
  53.             Loop
  54.             MsgBox("Done")
  55.             ProgressBar1.Value = ProgressBar1.Value
  56.         End If
  57.         If RadioButton4.Checked Then
  58.             Do While ListBox1.Items.Count < CInt(TextBox1.Text)
  59.                 Dim s As String = all(3, False)
  60.                 If checkName(s) = True Then
  61.                     ListBox1.Items.Add(s)
  62.                     ProgressBar1.Value += 1
  63.                 End If
  64.             Loop
  65.             MsgBox("Done")
  66.             ProgressBar1.Value = ProgressBar1.Value
  67.         End If
  68.     End Sub
  69.  
  70.     Public Function both(ByRef len As Integer, ByRef upper As Boolean) As String
  71.         Dim rand As New Random()
  72.         Dim allowableChars() As Char = "abcdefghijklmnopqrstuvwxyz1234567890".ToCharArray()
  73.         Dim final As String = String.Empty
  74.         For i As Integer = 0 To len - 1
  75.             final += allowableChars(rand.Next(allowableChars.Length - 1))
  76.         Next
  77.  
  78.         Return IIf(upper, final.ToUpper(), final)
  79.     End Function
  80.  
  81.     Public Function lettersOnly(ByRef len As Integer, ByRef upper As Boolean) As String
  82.         Dim rand As New Random()
  83.         Dim allowableChars() As Char = "abcdefghijklmnopqrstuvwxyz".ToCharArray()
  84.         Dim final As String = String.Empty
  85.         For i As Integer = 0 To len - 1
  86.             final += allowableChars(rand.Next(allowableChars.Length - 1))
  87.         Next
  88.  
  89.         Return IIf(upper, final.ToUpper(), final)
  90.     End Function
  91.  
  92.     Public Function numbersOnly(ByRef len As Integer, ByRef upper As Boolean) As String
  93.         Dim rand As New Random()
  94.         Dim allowableChars() As Char = "1234567890".ToCharArray()
  95.         Dim final As String = String.Empty
  96.         For i As Integer = 0 To len - 1
  97.             final += allowableChars(rand.Next(allowableChars.Length - 1))
  98.         Next
  99.  
  100.         Return IIf(upper, final.ToUpper(), final)
  101.     End Function
  102.  
  103.     Public Function all(ByRef len As Integer, ByRef upper As Boolean) As String
  104.         Dim rand As New Random()
  105.         Dim allowableChars() As Char = "abcdefghijklmnopqrstuvwxyz1234567890_".ToCharArray()
  106.         Dim final As String = String.Empty
  107.         For i As Integer = 0 To len - 1
  108.             final += allowableChars(rand.Next(allowableChars.Length - 1))
  109.         Next
  110.  
  111.         Return IIf(upper, final.ToUpper(), final)
  112.     End Function
  113.  
  114.     Private Sub TextBox1_TextChanged(sender As Object, e As EventArgs) Handles TextBox1.Validated
  115.         ProgressBar1.Maximum = CInt(TextBox1.Text)
  116.     End Sub
  117. End Class
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement