190 lines
7.0 KiB
Plaintext
190 lines
7.0 KiB
Plaintext
Imports System.Collections.Generic
|
|
Imports System.Threading
|
|
|
|
Namespace TestingxConsole
|
|
Class Program
|
|
Friend Shared Sub Main(args As String())
|
|
Console.Title = "overpowered.it/xconsole-project"
|
|
xConsole.MultiThreadSupport = True
|
|
xConsole.CoolWriteSettings.CoolWritingDelay = 40
|
|
|
|
' Turn OFF stats
|
|
'xConsole.Settings.xStatReq = true; // yes true is off
|
|
xConsole.CheckForUpdatesEnabled = True
|
|
|
|
xConsole.Credits()
|
|
|
|
xConsole.Wait(666)
|
|
xConsole.CoolWriteLine(vbCr & vbLf & "^mHello^!, this program will guide you to discover some features of ^yxConsole^!!")
|
|
xConsole.CoolWriteLine("^5Please set ^6Lucida Console^5 as the default font :).^!")
|
|
xConsole.Wait(500)
|
|
|
|
|
|
' Colors tes
|
|
xConsole.CoolWriteLine(vbCr & vbLf & "^gxConsole^! is used to ^rcolor^! and ^5animate^! your ^6console^!!")
|
|
|
|
xConsole.CoolWriteLine("You can set the text and background color using ^g^^! and ^g*^! chars.")
|
|
xConsole.CoolWriteLine("You have ^mthree^! ways to set colors:")
|
|
xConsole.CoolWriteLine(vbTab & "1) With letters, \^r^rITS RED^!. \^y^yITS YELLOW^!. \^g^gITS GREEN^!. \^b^bITS BLUE^!.")
|
|
xConsole.CoolWriteLine(vbTab & "2) HEX code, \^F00^F00ITS RED^!. \^0F0^0F0ITS GREEN^!")
|
|
xConsole.CoolWriteLine(vbTab & vbTab & "the ^yHEX^! code ^rMUST^! be UPPER CASE!")
|
|
xConsole.CoolWriteLine(vbTab & "3) or using the ^9Microsoft^! ConsoleColor enum (see reference)")
|
|
xConsole.CoolWriteLine(vbTab & "0) Get random color ^g\^.^!")
|
|
xConsole.CoolWriteLine(vbTab & vbTab & "^!it will never be equal to the ^yfont^!/*1back*! color.")
|
|
xConsole.CoolWriteLine(vbTab & "-1) Same story for the background. (*2\*2*!, *r\*r*!, *FFF\*FFF*!)")
|
|
|
|
xConsole.CoolWriteLine(vbTab & "-2) ..then restore with \^! and \*! tags.")
|
|
|
|
|
|
|
|
' ReadLine test
|
|
|
|
xConsole.CoolWriteLine(vbCr & vbLf & vbCr & vbLf & "The next example is ^2xConsole^!.^wReadLine^! function." & vbCr & vbLf & "this converts an input string into a ^gList^!<^11string^!>.")
|
|
xConsole.CoolWriteLine("Type some string and agruments (ex: run ""the program"" 777)")
|
|
|
|
xConsole.WaitQueue()
|
|
Dim input = xConsole.ReadLine(True)
|
|
Dim c As Integer = 0
|
|
For Each i As String In input
|
|
xConsole.CoolWriteLine(vbTab & "[^y{0}^!]" & vbTab & "^m{1}^!", c, i)
|
|
c += 1
|
|
Next
|
|
|
|
|
|
xConsole.CoolWriteLine(vbCr & vbLf & "Well, the ReadKeys function allow you to save ^rall^! the ^yuser-input chars^!.")
|
|
xConsole.CoolWriteLine("Just an example:")
|
|
|
|
xConsole.CoolWriteLine("Password is: ^mhello^r[backspace]^mbro^!" & vbCr & vbLf)
|
|
Dim k As Integer = 0
|
|
Dim thepassword As String = "hello" & ChrW(8) & "bro"
|
|
|
|
For Each s As String In thepassword
|
|
xConsole.CoolWriteLine("[^y{0}^!]:" & vbTab & "^g{1}^!" & vbTab & "(code)^m{2}^!", System.Threading.Interlocked.Increment(k), s.ToString(), AscW(s))
|
|
Next
|
|
|
|
xConsole.CoolWriteLine(vbCr & vbLf & "The input will be not displayed!")
|
|
|
|
xConsole.WaitQueue()
|
|
While True
|
|
xConsole.CoolWrite("Please type the above password:")
|
|
Dim r As String = xConsole.ReadKeys(True)
|
|
If r = thepassword Then
|
|
xConsole.CoolWriteLine("^gPassword MATCH!^!")
|
|
Exit While
|
|
Else
|
|
xConsole.CoolWriteLine("^rIncorrect password! Use backspace^!")
|
|
End If
|
|
End While
|
|
|
|
xConsole.WriteLine()
|
|
xConsole.Wait(600)
|
|
|
|
Dim ListOfCmds = New List(Of xConsole.Comparer)() From { _
|
|
New xConsole.Comparer("kick", "Chuck norrize a user"), _
|
|
New xConsole.Comparer("ping", "Ping, pong..."), _
|
|
New xConsole.Comparer("pig", "\*Scroff*"), _
|
|
New xConsole.Comparer("roll", "Roll the dice!"), _
|
|
New xConsole.Comparer("exit", "Close the comparer") _
|
|
}
|
|
|
|
xConsole.CoolWriteLine(vbCr & vbLf & "^yThe String comparer^! allows you to shorten the user's input mailorder looking forthe most similar to the typed string.")
|
|
|
|
xConsole.CoolWriteLine("List of avaiable commands:" & vbCr & vbLf)
|
|
|
|
For Each l As Comparer In ListOfCmds
|
|
xConsole.CoolWriteLine(vbTab & "^b{0}^!" & vbTab & "({1})", l.Word, l.Description)
|
|
Next
|
|
|
|
xConsole.CoolWriteLine(vbCr & vbLf & "Example: type ^mk^!, the comparator will find ^mkick^! keyword")
|
|
xConsole.CoolWriteLine("Example: type ^mpi^!, ^y2 results found^!, then it returns an empty string!")
|
|
xConsole.CoolWriteLine("Example: type ^mr^!, the comparer will find ^mroll^! keyword.. etc...")
|
|
|
|
|
|
Dim cmd As String = String.Empty
|
|
While String.IsNullOrWhiteSpace(cmd)
|
|
xConsole.CoolWrite("^2Try yourself:")
|
|
input = xConsole.ReadLine(True)
|
|
cmd = xConsole.Comparer.Find(input(0).ToLower(), ListOfCmds)
|
|
|
|
xConsole.CoolWriteLine("Word found: ^y{0}^!", cmd)
|
|
|
|
Select Case cmd
|
|
Case "kick"
|
|
xConsole.CoolWriteLine(vbTab & "^.ChuckNorris^.ChuckNorris^.ChuckNorris^.ChuckNorris^!")
|
|
Case "ping"
|
|
xConsole.CoolWriteLine(vbTab & "^gPong^!")
|
|
Case "pig"
|
|
xConsole.CoolWriteLine(vbTab & "Do you like swine?")
|
|
Case "roll"
|
|
xConsole.CoolWriteLine(vbTab & "Roll the diceee!")
|
|
Case "exit"
|
|
xConsole.CoolWriteLine(vbTab & "^2Leaving..")
|
|
Case Else
|
|
xConsole.CoolWriteLine(vbTab & "^rNo matches found^!!")
|
|
End Select
|
|
|
|
cmd = String.Empty
|
|
End While
|
|
|
|
xConsole.Wait(600)
|
|
|
|
xConsole.CoolWriteLine("xConsole can ^yWriteLine asynchronously^!! No more slow down by console output..")
|
|
xConsole.CoolWriteLine("^gMultiThreadSupport^! is *g^0{0}^!*!", xConsole.MultiThreadSupport.ToString().ToUpper())
|
|
xConsole.WriteLine(vbCr & vbLf & vbCr & vbLf & vbCr & vbLf)
|
|
' Wait until xConsole have no more actions.
|
|
xConsole.WaitQueue()
|
|
|
|
For i As Integer = 9 To 0 Step -1
|
|
xConsole.Write(vbCr & "~Time left:{0}.. (a stress test?)", i)
|
|
xConsole.Wait(600)
|
|
Next
|
|
xConsole.WriteLine()
|
|
|
|
Dim j As Integer = 0
|
|
While j < 1000
|
|
j += 1
|
|
xConsole.WriteLine("*.^.LoL*.^.LoL*.^.LoL*.^.LoL*.^.LoL*.^.LoL*.^.LoL*.^.LoL*.^.LoL*.^.LoL*.^.LoL*.^.LoL*.^.LoL*.^.LoL*.^.LoL*.^.LoL*.^.LoL*.^.LoL*.^.LoL*.^.LoL*.^.LoL*.^.LoL*.^.LoL*.^.LoL*.^.LoL*.^.LoL^!*!")
|
|
End While
|
|
|
|
While j > 0
|
|
j -= 1
|
|
Console.Title = "Count down " & j
|
|
Thread.Sleep(10)
|
|
End While
|
|
|
|
xConsole.WaitQueue()
|
|
xConsole.Wait(600)
|
|
|
|
|
|
xConsole.CoolWriteLine(vbCr & vbLf & "*2What about Spinning?*!")
|
|
xConsole.CoolWriteLine("PRESS any KEY to break.")
|
|
|
|
For i As Integer = 0 To 3
|
|
Dim Spin = New xConsole.Spinner(i)
|
|
Spin.SpinText = "{0} ^.Load^.ing^....^!"
|
|
|
|
xConsole.CoolWrite(vbCr & "Status:" & vbTab)
|
|
|
|
Call New Thread(Sub()
|
|
xConsole.ClearInput()
|
|
Console.ReadKey(True)
|
|
Spin.Break()
|
|
|
|
End Sub).Start()
|
|
|
|
While Spin.Turn()
|
|
|
|
|
|
End While
|
|
Next
|
|
|
|
xConsole.CoolWriteLine("^gOK" & vbCr & vbLf)
|
|
|
|
xConsole.CoolWriteLine("The tour is over... thx:)")
|
|
|
|
|
|
Console.ReadLine()
|
|
End Sub
|
|
End Class
|
|
End Namespace
|