📄 console.bas
字号:
Attribute VB_Name = "Console"
Option Explicit
' This module handles all of Bob's console commands
' it parses them and sets the appropriate options
'
' There are two types of consoles in Bob, the client
' and the administrative console. The administrative
' console is the more powerful of the two consoles
' and overrides anything set by the client console
'
' The job of the client console is to modify data
' travelling into or out of the exclusive mode and
' thus by modifying or appending data, it is possible
' to control the server.
'
' Functions in this Module
' 1. ParseClientCommand (sCommand as string) as string
' Client Console functions
Public Function ParseClientCommand(sCommand As String) As String
'This function accepts a client command and then
'interprets it. It will accept input from any source
'and returns an answering string.
On Error GoTo ErrorTrap
Dim CommandArray() As String 'A local variable where the query is split into
Dim CurrentWord As Integer 'Stores the current position in the array
Dim TempString As String 'Stores a tempory String before it is sent
Dim Counter As Integer 'Used in loops
'Check that the the scommand has text in it
If Len(sCommand) = 0 Then 'seems to be the fastest method
Err.Raise 1
End If
'Spilt the command into separate words
CommandArray = Split(sCommand, " ")
'Check the first word to what type of command
Select Case Trim(LCase(CommandArray(0)))
'General Values Functions (not specific)
Case "set"
'find the object they are changing
Select Case Trim(LCase(CommandArray(1)))
Case "debugmode"
'They are trying to set the debug mode
Select Case Trim(LCase(CommandArray(2)))
Case "on"
'Turning on voicemode
DebugMode = True
ParseClientCommand = "Debugging Mode is active - All systems set to debug mode"
Case "off"
'turning it off
DebugMode = False
ParseClientCommand = "Debugging Mode is shutting down - All Log files have been closed"
Case Else
ParseClientCommand = "Type Mismatch - On/Off syntax required "
End Select
Case "voicemode"
'They are changing the voicemode
Select Case Trim(LCase(CommandArray(2)))
Case "on"
'Turning on voicemode
Speaking = True
ParseClientCommand = "Voice Mode set to True"
Case "off"
'turning it off
Speaking = False
ParseClientCommand = "Voice Mode set to False"
Case Else
ParseClientCommand = "Type Mismatch - On/Off syntax required "
End Select
Case Else
'undetermined object
ParseClientCommand = "Object not found in SET statement"
End Select
Case "get"
'Find the object that they want to retrieve
Select Case Trim(LCase(CommandArray(1)))
Case "voicemode"
ParseClientCommand = "Voice Mode is currently set to: " & Speaking
Case "debugmode"
ParseClientCommand = "Debuging System status is set to: " & DebugMode
Case Else
ParseClientCommand = "Object not found in GET statement"
End Select
' Encryption System Functions
Case "encrypt"
'Find the string they are encrypting
If CommandArray(1) <> "" Then
ParseClientCommand = SimpleEncrypt(CommandArray(1), "bob")
Else
ParseClientCommand = "No Text Specified in ENCRYPT statement"
End If
Case "decrypt"
'Find the string they are decrypting
If CommandArray(1) <> "" Then
ParseClientCommand = SimpleDeCrypt(CommandArray(1), "bob")
Else
ParseClientCommand = "No Text Specified in DECRYPT statement"
End If
Case Else
'unrecognised command
ParseClientCommand = "Unrecognised Command"
End Select
Exit Function
ErrorTrap:
Dim TempError As LogEntry
ParseClientCommand = "There was an Error Processing your command - Please try again"
TempError.sName = "Parsing Error"
TempError.sGenerated = "ParseClientCommand"
TempError.sDescription = "Error Parsing Client Command (" & sCommand & ")"
AddtoErrorLog TempError
End Function
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -