-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfrmDebug.vb
73 lines (66 loc) · 3.16 KB
/
frmDebug.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
Imports System.Runtime.InteropServices
Module frmDebug
Public Sub Show()
Win32.AllocConsole()
Console.WriteLine("Welcome to the PearBox Debugger.")
CommandReader:
Console.WriteLine()
Console.Write("PearBox>")
Dim UserInput As String = Console.ReadLine
Select Case UserInput
Case "cls"
Console.Clear()
GoTo CommandReader
Case "exit"
Win32.FreeConsole()
Exit Sub
Case Else
If UserInput.Contains("edit config") Then
Dim ParArray As String() = Split(UserInput, " ")
Select Case ParArray(ParArray.Length - 1)
Case "size"
Console.WriteLine()
Console.Write("Write the new values for the size in the format X,Y: ")
Dim Answer As String = Replace(Console.ReadLine, " ", "")
Dim allowed As String = ("1234567890,")
For Each c As Char In Answer
If allowed.Contains(c) = False Then
Console.WriteLine()
Console.Write("Invalid values!")
GoTo CommandReader
End If
Next
Dim NewSize As String() = Split(Answer, ",")
My.Settings.LastSize = _
New System.Drawing.Size(NewSize(0), NewSize(1))
My.Settings.Save()
Console.WriteLine("Values written correctly.")
Case "location"
Console.WriteLine()
Console.Write("Write the new values for the location in the format X,Y: ")
Dim Answer As String = Replace(Console.ReadLine, " ", "")
Dim allowed As String = ("1234567890,")
For Each c As Char In Answer
If allowed.Contains(c) = False Then
Console.WriteLine()
Console.Write("Invalid values!")
GoTo CommandReader
End If
Next
Dim NewSize As String() = Split(Answer, ",")
My.Settings.LastLocation = _
New System.Drawing.Point(NewSize(0), NewSize(1))
My.Settings.Save()
Console.WriteLine("Values written correctly.")
End Select
End If
End Select
GoTo CommandReader
End Sub
End Module
Public Class Win32
<DllImport("kernel32.dll")> Public Shared Function AllocConsole() As Boolean
End Function
<DllImport("kernel32.dll")> Public Shared Function FreeConsole() As Boolean
End Function
End Class