Moving more commands from TerminalAPI into its own module

This commit is contained in:
EverythingWindows 2022-11-16 08:07:44 +07:00
parent 8b879eb638
commit 5aceb7cf1e
9 changed files with 158 additions and 122 deletions

View file

@ -218,7 +218,7 @@
End If End If
If command Like "cowsay *" Then If command Like "cowsay *" Then
If Strings.AvailableFeature(22) = 1 Then If Strings.AvailableFeature(22) = 1 Then
Cowsay_Say(RawCommand.Substring(7)) Cowsay(RawCommand.Substring(7))
Console.BadCommand = False Console.BadCommand = False
End If End If
End If End If
@ -231,35 +231,14 @@
End If End If
If command Like "hostname *" Then If command Like "hostname *" Then
If Strings.AvailableFeature(20) = 1 Then If Strings.AvailableFeature(20) = 1 Then
Strings.ComputerInfo(0) = command.Substring(command.LastIndexOf(" ") + 1, command.Length - (command.LastIndexOf(" ") + 1)) Hostname()
Terminal_AssignPrompt()
AdvancedCommand = False AdvancedCommand = False
Console.BadCommand = False Console.BadCommand = False
End If End If
End If End If
If command Like "infobar *" Then If command Like "infobar *" Then
If Strings.AvailableFeature(4) = "1" Then If Strings.AvailableFeature(4) = "1" Then
'Infobar panel-ish and some sort Infobar()
Dim infobarcommand As String = command.Replace("infobar ", "")
Dim advancedtool As Boolean = True
Select Case infobarcommand
Case "on"
Strings.OnceInfo(2) = "True"
Console.CheckFeature()
Console.BadCommand = False
advancedtool = False
Case "off"
Strings.OnceInfo(2) = "False"
Console.CheckFeature()
Console.BadCommand = False
advancedtool = False
End Select
If advancedtool = True Then
If infobarcommand Like "color *" Then
GetColor("infobar", infobarcommand.Substring(6, 1), infobarcommand.Substring(7, 1))
Console.BadCommand = False
End If
End If
End If End If
End If End If
If command Like "man *" Then If command Like "man *" Then
@ -283,7 +262,7 @@
End If End If
If command Like "rev *" Then If command Like "rev *" Then
If Strings.AvailableFeature(21) = 1 Then If Strings.AvailableFeature(21) = 1 Then
NewLine(StrReverse(RawCommand.Substring(4))) Reverse()
Console.BadCommand = False Console.BadCommand = False
AdvancedCommand = False AdvancedCommand = False
End If End If
@ -303,20 +282,7 @@
End If End If
End If End If
If command Like "shiftorium *" Then If command Like "shiftorium *" Then
Dim prompt As String = command.Replace("shiftorium ", "") Shiftorium()
NewLine("Shiftorium ShiftOS Center")
If prompt Like "info *" Then
Shiftoriums.prompt = command.Replace("shiftorium info ", "")
Shiftorium_InformationFeatures()
End If
If prompt Like "install *" Then
Shiftoriums.prompt = command.Replace("shiftorium install ", "")
Shiftorium_DetectInstallFeatures()
End If
If prompt = "list" Then
Shiftorium_ListFeatures()
Console.BadCommand = False
End If
End If End If
If command Like "textpad *" Then If command Like "textpad *" Then
If Strings.AvailableFeature(17) = 1 Then If Strings.AvailableFeature(17) = 1 Then
@ -332,8 +298,7 @@
If command.Substring(9) = "root" Then If command.Substring(9) = "root" Then
NewLine("This username is already taken!") NewLine("This username is already taken!")
Else Else
Strings.ComputerInfo(1) = command.Substring(command.LastIndexOf(" ") + 1, command.Length - (command.LastIndexOf(" ") + 1)) Username()
Terminal_AssignPrompt()
End If End If
AdvancedCommand = False AdvancedCommand = False
Console.BadCommand = False Console.BadCommand = False

View file

@ -154,10 +154,16 @@
<Compile Include="Functions\InGame\TerminalColorSystem.vb" /> <Compile Include="Functions\InGame\TerminalColorSystem.vb" />
<Compile Include="Terminal Applications\Internal\Com_05tray.vb" /> <Compile Include="Terminal Applications\Internal\Com_05tray.vb" />
<Compile Include="Terminal Applications\Internal\Com_Codepoint.vb" /> <Compile Include="Terminal Applications\Internal\Com_Codepoint.vb" />
<Compile Include="Terminal Applications\Internal\Com_Cowsay.vb" />
<Compile Include="Terminal Applications\Internal\Com_Help.vb" /> <Compile Include="Terminal Applications\Internal\Com_Help.vb" />
<Compile Include="Terminal Applications\Internal\Com_Hostname.vb" />
<Compile Include="Terminal Applications\Internal\Com_Infobar.vb" />
<Compile Include="Terminal Applications\Internal\Com_Pwd.vb" /> <Compile Include="Terminal Applications\Internal\Com_Pwd.vb" />
<Compile Include="Terminal Applications\Internal\Com_Rev.vb" />
<Compile Include="Terminal Applications\Internal\Com_Shiftfetch.vb" /> <Compile Include="Terminal Applications\Internal\Com_Shiftfetch.vb" />
<Compile Include="Terminal Applications\Internal\Com_Shiftorium.vb" />
<Compile Include="Terminal Applications\Internal\Com_Su.vb" /> <Compile Include="Terminal Applications\Internal\Com_Su.vb" />
<Compile Include="Terminal Applications\Internal\Com_Username.vb" />
<Compile Include="Terminal Applications\Internal\Com_Ver.vb" /> <Compile Include="Terminal Applications\Internal\Com_Ver.vb" />
<Compile Include="Terminal Applications\Internal\Com_Date.vb" /> <Compile Include="Terminal Applications\Internal\Com_Date.vb" />
<Compile Include="Terminal Applications\Internal\TerminalInternalApps.vb" /> <Compile Include="Terminal Applications\Internal\TerminalInternalApps.vb" />

View file

@ -0,0 +1,85 @@
Module Com_Cowsay
Public Sub Cowsay(Say As String)
Select Case Say.Length
Case 1 To 40
Dim SubtractLength As Integer = Say.Length + 1
NewLine(" ")
Do
AddLine("_")
SubtractLength = SubtractLength - 1
If SubtractLength = 0 Then
AddLine("_")
SubtractLength = Say.Length + 1
Exit Do
End If
Loop
NewLine("< " & Say & " >")
NewLine(" ")
Do
AddLine("-")
SubtractLength = SubtractLength - 1
If SubtractLength = 0 Then
AddLine("-")
SubtractLength = Say.Length + 1
Exit Do
End If
Loop
NewLine(" \ ^__^")
NewLine(" \ (oo)\_______")
NewLine(" (__)\ )\/\")
NewLine(" ||----w |")
NewLine(" || ||")
Case 41 To 80
NewLine(" __________________________________________ ")
NewLine("/ " & Say.Substring(0, 40) & " \")
Say = Say.Substring(40, Say.Length - 40)
NewLine("\ " & Say)
Dim Spaces As Integer = 40 - Say.Length
Do
AddLine(" ")
If Spaces = 0 Then
AddLine("/")
Exit Do
End If
Spaces = Spaces - 1
Loop
NewLine(" ------------------------------------------ ")
NewLine(" \ ^__^")
NewLine(" \ (oo)\_______")
NewLine(" (__)\ )\/\")
NewLine(" ||----w |")
NewLine(" || ||")
Case >= 81
NewLine("cowsay: Character limit exceeded")
'Dim SubtractLength As Integer = Say.Length + 1
'Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & " __________________________________________ "
'Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "/ " & Say.Substring(0, 40) & " \"
'Dim CurrentLength As Integer = 40
'Dim WhatSay As String
'Dim Spaces As Integer
'Do
' Try
' WhatSay = Say.Substring(CurrentLength, 40)
' Catch ex As Exception
' WhatSay = Say.Substring(CurrentLength, (CurrentLength + 40) - Say.Length)
' End Try
' Spaces = 40 - WhatSay.Length
' If Spaces > 0 Then
' Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "\ " & WhatSay
' Do
' Terminal.TextBox1.Text = Terminal.TextBox1.Text & " "
' If Spaces = 0 Then
' Terminal.TextBox1.Text = Terminal.TextBox1.Text & "/"
' Exit Do
' End If
' Spaces = Spaces - 1
' Loop
' Exit Do
' Else
' Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "| " & WhatSay & " |"
' CurrentLength = CurrentLength + 40
' End If
'Loop
End Select
End Sub
End Module

View file

@ -0,0 +1,6 @@
Module Com_Hostname
Public Sub Hostname()
Strings.ComputerInfo(0) = command.Substring(command.LastIndexOf(" ") + 1, command.Length - (command.LastIndexOf(" ") + 1))
Terminal_AssignPrompt()
End Sub
End Module

View file

@ -0,0 +1,25 @@
Module Com_Infobar
Public Sub Infobar()
'Infobar panel-ish and some sort
Dim infobarcommand As String = command.Replace("infobar ", "")
Dim advancedtool As Boolean = True
Select Case infobarcommand
Case "on"
Strings.OnceInfo(2) = "True"
Console.CheckFeature()
Console.BadCommand = False
advancedtool = False
Case "off"
Strings.OnceInfo(2) = "False"
Console.CheckFeature()
Console.BadCommand = False
advancedtool = False
End Select
If advancedtool = True Then
If infobarcommand Like "color *" Then
GetColor("infobar", infobarcommand.Substring(6, 1), infobarcommand.Substring(7, 1))
Console.BadCommand = False
End If
End If
End Sub
End Module

View file

@ -0,0 +1,5 @@
Module Com_Rev
Public Sub Reverse()
NewLine(StrReverse(RawCommand.Substring(4)))
End Sub
End Module

View file

@ -0,0 +1,18 @@
Module Com_Shiftorium
Public Sub Shiftorium()
Dim prompt As String = command.Replace("shiftorium ", "")
NewLine("Shiftorium ShiftOS Center")
If prompt Like "info *" Then
Shiftoriums.prompt = command.Replace("shiftorium info ", "")
Shiftorium_InformationFeatures()
End If
If prompt Like "install *" Then
Shiftoriums.prompt = command.Replace("shiftorium install ", "")
Shiftorium_DetectInstallFeatures()
End If
If prompt = "list" Then
Shiftorium_ListFeatures()
Console.BadCommand = False
End If
End Sub
End Module

View file

@ -0,0 +1,6 @@
Module Com_Username
Public Sub Username()
Strings.ComputerInfo(1) = command.Substring(command.LastIndexOf(" ") + 1, command.Length - (command.LastIndexOf(" ") + 1))
Terminal_AssignPrompt()
End Sub
End Module

View file

@ -1,86 +1,6 @@
Module TerminalInternalApps Module TerminalInternalApps
Public Sub Cowsay_Say(Say As String) Public Sub Cowsay_Say(Say As String)
Select Case Say.Length
Case 1 To 40
Dim SubtractLength As Integer = Say.Length + 1
NewLine(" ")
Do
AddLine("_")
SubtractLength = SubtractLength - 1
If SubtractLength = 0 Then
AddLine("_")
SubtractLength = Say.Length + 1
Exit Do
End If
Loop
NewLine("< " & Say & " >")
NewLine(" ")
Do
AddLine("-")
SubtractLength = SubtractLength - 1
If SubtractLength = 0 Then
AddLine("-")
SubtractLength = Say.Length + 1
Exit Do
End If
Loop
NewLine(" \ ^__^")
NewLine(" \ (oo)\_______")
NewLine(" (__)\ )\/\")
NewLine(" ||----w |")
NewLine(" || ||")
Case 41 To 80
NewLine(" __________________________________________ ")
NewLine("/ " & Say.Substring(0, 40) & " \")
Say = Say.Substring(40, Say.Length - 40)
NewLine("\ " & Say)
Dim Spaces As Integer = 40 - Say.Length
Do
AddLine(" ")
If Spaces = 0 Then
AddLine("/")
Exit Do
End If
Spaces = Spaces - 1
Loop
NewLine(" ------------------------------------------ ")
NewLine(" \ ^__^")
NewLine(" \ (oo)\_______")
NewLine(" (__)\ )\/\")
NewLine(" ||----w |")
NewLine(" || ||")
Case >= 81
NewLine("cowsay: Character limit exceeded")
'Dim SubtractLength As Integer = Say.Length + 1
'Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & " __________________________________________ "
'Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "/ " & Say.Substring(0, 40) & " \"
'Dim CurrentLength As Integer = 40
'Dim WhatSay As String
'Dim Spaces As Integer
'Do
' Try
' WhatSay = Say.Substring(CurrentLength, 40)
' Catch ex As Exception
' WhatSay = Say.Substring(CurrentLength, (CurrentLength + 40) - Say.Length)
' End Try
' Spaces = 40 - WhatSay.Length
' If Spaces > 0 Then
' Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "\ " & WhatSay
' Do
' Terminal.TextBox1.Text = Terminal.TextBox1.Text & " "
' If Spaces = 0 Then
' Terminal.TextBox1.Text = Terminal.TextBox1.Text & "/"
' Exit Do
' End If
' Spaces = Spaces - 1
' Loop
' Exit Do
' Else
' Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "| " & WhatSay & " |"
' CurrentLength = CurrentLength + 40
' End If
'Loop
End Select
End Sub End Sub
Public Sub DateTerm() Public Sub DateTerm()