Friend Module Program
Public Declare Function SetConsoleTitle Lib "kernel32" Alias "SetConsoleTitleA" (ByVal lpConsoleTitle As String) As Long
Declare Function ShellExecuteA Lib "shell32.dll" ( _
ByVal hWnd As IntPtr, _
ByVal lpOperation As String, _
ByVal lpFile As String, _
ByVal lpParameters As String, _
ByVal lpDirectory As String, _
ByVal nShowCmd As Integer) As IntPtr
Dim run As String = "Run"
Dim opstring As String
Private Const OK As Integer = 0
Private Const Errenous As Integer = 1
Sub Main()
InitConsole()
While run = "Run"
Console.Write(">>")
GetLine()
End While
End Sub
Sub InitConsole()
SetConsoleTitle("Digital Console")
opstring = String.Empty
Console.WriteLine("Initialized")
End Sub
Function GetLine() As Integer
opstring = Console.ReadLine
CommandRun()
Return 0
End Function
Private Sub CommandRun()
If opstring = "Hello" Then
Console.WriteLine("Hi")
End If
If opstring = "Scramble" Then
opstring = ""
Console.WriteLine("Enter string to scramble.")
opstring = Console.ReadLine
Console.WriteLine(ScrambleToLog(StringScramble))
Process.Start("notepad", "./Logs/scramble.txt")
End If
End Sub
Function StringScramble() As String
Dim x As Integer = 0
Dim output As String
For Each character As String In opstring
If character = "a" Then
output = output + "cpw"
End If
If character = "b" Then
output = output + "pwl"
End If
If character = "c" Then
output = output + "lwb"
End If
If character = "d" Then
output = output + "CV"
End If
If character = "e" Then
output = output + "VC"
End If
If character = "g" Then
output = output + "VnB"
End If
If character = "h" Then
output = output + "Bgw"
End If
If character = "i" Then
output = output + "epN"
End If
If character = "j" Then
output = output + "qWt"
End If
If character = "k" Then
output = output + "dlP"
End If
If character = "l" Then
output = output + "poT"
End If
If character = "m" Then
output = output + "erV"
End If
If character = "n" Then
output = output + "poV"
End If
If character = "o" Then
output = output + "zXN"
End If
If character = "p" Then
output = output + "oIe"
End If
If character = "q" Then
output = output + "QxG"
End If
If character = "r" Then
output = output + "lDJ"
End If
If character = "s" Then
output = output + "RyM"
End If
If character = "t" Then
output = output + "kSf"
End If
If character = "u" Then
output = output + "ioN"
End If
If character = "v" Then
output = output + "xQI"
End If
If character = "w" Then
output = output + "fZE"
End If
If character = "x" Then
output = output + "tRe"
End If
If character = "y" Then
output = output + "aAD"
End If
If character = "z" Then
output = output + "jjK"
End If
Next
Return output
End Function
Function ScrambleToLog(ByVal input As String) As Integer
Dim fsvar As IO.FileStream
If IO.Directory.Exists("./Logs/") Then
Console.WriteLine("Logs Directory is there")
Else
IO.Directory.CreateDirectory("./Logs")
End If
Try
Dim fs As IO.FileStream = IO.File.Create("./Logs/" + "scramble" + ".txt")
fs.Write(System.Text.ASCIIEncoding.ASCII.GetBytes(input), 0, System.Text.ASCIIEncoding.ASCII.GetBytes(input).Length)
fs.Close()
GC.Collect()
Catch ex As IO.IOException
Console.WriteLine(ex.Message & ex.InnerException.ToString)
Return Errenous
End Try
Return OK
End Function
End Module
What ya think? Type in a string and a scrambled one appears in notepad.