Module Module1 Dim amount, min, max, file, loadProgress Sub Main() colours.whiteText("Enter a minimum amount: ", False, False) colours.cyanText("", False, False) min = Console.ReadLine() colours.whiteText("Enter a maximum amount: ", False, False) colours.cyanText("", False, False) max = Console.ReadLine() colours.whiteText("Enter an amount of number pairs: ", False, False) colours.cyanText("", False, False) amount = Console.ReadLine() colours.whiteText("Enter a file location: ", False, False) colours.cyanText("", False, False) file = Console.ReadLine() loadProgress = 0 colours.whiteText("Loading", False, False) lines() reset() colours.whiteText(TextFile.read(file), True, False) Console.ReadLine() Console.ReadLine() End Sub Sub lines() Dim length = amount Dim lines(length - 1) Dim loops = 0 If (min > max Or min = max) Then colours.whiteText("The minimum value is greater than the maximum one.", False, False) Main() End If Dim rnd As New System.Random Dim FILE_NAME As String = file Dim i As Integer Dim x As Integer Dim y As Integer Do Until loops = length x = rnd.Next(min, max) y = rnd.Next(min, max) lines(loops) = x & "," & y loops += 1 Loop Dim objWriter As New System.IO.StreamWriter(FILE_NAME) For i = 0 To length - 1 objWriter.WriteLine(lines(i)) loadProgress += 1 Threading.Thread.Sleep(1) reset() Next objWriter.Close() End Sub Sub reset() Console.Clear() colours.whiteText("Enter a minimum amount: ", False, False) colours.cyanText(min, True, False) colours.whiteText("Enter a maximum amount: ", False, False) colours.cyanText(max, True, False) colours.whiteText("Enter an amount of number pairs: ", False, False) colours.cyanText(amount, True, False) colours.whiteText("Enter a file location: ", False, False) colours.cyanText(file, True, False) colours.whiteText("Loading : ", False, False) colours.cyanText(loadProgress, False, False) colours.whiteText(" out of ", False, False) colours.cyanText(amount, True, False) Threading.Thread.Sleep(1) End Sub End Module Module colours Dim ran As Integer 'Parameter 1: Text ("Hello") 'Parameter 2: If it should be on its own line (True) 'Parameter 3: If it should be dark (False) Sub whiteText(ByVal text As String, ByVal ownLine As Boolean, ByVal dark As Boolean) If (dark = True) Then Console.ForegroundColor = ConsoleColor.Black Else : Console.ForegroundColor = ConsoleColor.White End If If (ownLine = True) Then Console.WriteLine(text) Else : Console.Write(text) End If End Sub Sub greenText(ByVal text As String, ByVal ownLine As Boolean, ByVal dark As Boolean) If (dark = True) Then Console.ForegroundColor = ConsoleColor.DarkGreen Else : Console.ForegroundColor = ConsoleColor.Green End If If (ownLine = True) Then Console.WriteLine(text) Else : Console.Write(text) End If End Sub Sub cyanText(ByVal text As String, ByVal ownLine As Boolean, ByVal dark As Boolean) If (dark = True) Then Console.ForegroundColor = ConsoleColor.DarkCyan Else : Console.ForegroundColor = ConsoleColor.Cyan End If If (ownLine = True) Then Console.WriteLine(text) Else : Console.Write(text) End If End Sub Sub redText(ByVal text As String, ByVal ownLine As Boolean, ByVal dark As Boolean) If (dark = True) Then Console.ForegroundColor = ConsoleColor.DarkRed Else : Console.ForegroundColor = ConsoleColor.Red End If If (ownLine = True) Then Console.WriteLine(text) Else : Console.Write(text) End If End Sub 'Parameter 1: Text ("Hello") 'Parameter 2: If it should be on its own line (True) Sub randomText(ByVal text As String, ByVal ownLine As Boolean) Randomize() ' The program will generate a number from 0 to 5 ran = Int(Rnd() * 5) + 1 If (ran = 1) Then Console.ForegroundColor = ConsoleColor.White ElseIf (ran = 2) Then Console.ForegroundColor = ConsoleColor.Green ElseIf (ran = 3) Then Console.ForegroundColor = ConsoleColor.Cyan ElseIf (ran = 4) Then Console.ForegroundColor = ConsoleColor.Red ElseIf (ran = 5) Then Console.ForegroundColor = ConsoleColor.Yellow End If If (ownLine = True) Then Console.WriteLine(text) Else : Console.Write(text) End If End Sub End Module Module TextFile Dim readFile As String Function read(ByVal position As String) Try readFile = My.Computer.FileSystem.ReadAllText(position) Catch ex As Exception Console.WriteLine(ex.Message) End Try Return (readFile) End Function Sub write(ByVal position As String, ByVal text As String) Try My.Computer.FileSystem.WriteAllText(position, text, True) Catch ex As Exception Console.WriteLine(ex.Message) End Try End Sub Sub delete(ByVal position As String) Try My.Computer.FileSystem.DeleteFile(position, Microsoft.VisualBasic.FileIO.UIOption.AllDialogs, Microsoft.VisualBasic.FileIO.RecycleOption.DeletePermanently, Microsoft.VisualBasic.FileIO.UICancelOption.DoNothing) Catch ex As Exception Console.WriteLine(ex.Message) End Try End Sub Sub moveFile(ByVal filePos1 As String, ByVal filePos2 As String) Try My.Computer.FileSystem.MoveFile(filePos1, filePos2) Catch ex As Exception console.writeline(ex.message) End Try End Sub End Module