From b6ad60f56854bdf720c1e7177f011329048516db Mon Sep 17 00:00:00 2001 From: EverythingWindows Date: Thu, 17 Nov 2022 11:03:57 +0700 Subject: [PATCH] CodepointSystem module, ColorSystem module, Completing TerminalInternalApps migrating to modules --- ShiftOS-TheRevival/API/TerminalAPI.vb | 6 +-- .../Functions/InGame/CodepointSystem.vb | 11 +++++ ...{TerminalColorSystem.vb => ColorSystem.vb} | 49 +------------------ ShiftOS-TheRevival/MainForms/Console.vb | 4 -- ShiftOS-TheRevival/ShiftOS-TheRevival.vbproj | 7 ++- .../External/TerminalExternalApps.vb | 10 ---- .../Internal/Com_Color.vb | 3 ++ .../Internal/Com_Colors.vb | 48 ++++++++++++++++++ ...{TerminalInternalApps.vb => Com_Manual.vb} | 10 +--- 9 files changed, 72 insertions(+), 76 deletions(-) create mode 100644 ShiftOS-TheRevival/Functions/InGame/CodepointSystem.vb rename ShiftOS-TheRevival/Functions/InGame/{TerminalColorSystem.vb => ColorSystem.vb} (80%) create mode 100644 ShiftOS-TheRevival/TerminalApplications/Internal/Com_Color.vb create mode 100644 ShiftOS-TheRevival/TerminalApplications/Internal/Com_Colors.vb rename ShiftOS-TheRevival/TerminalApplications/Internal/{TerminalInternalApps.vb => Com_Manual.vb} (98%) diff --git a/ShiftOS-TheRevival/API/TerminalAPI.vb b/ShiftOS-TheRevival/API/TerminalAPI.vb index e9b7bde..e830f41 100644 --- a/ShiftOS-TheRevival/API/TerminalAPI.vb +++ b/ShiftOS-TheRevival/API/TerminalAPI.vb @@ -8,7 +8,7 @@ If Strings.AvailableFeature(18) = 1 Then ShOSKey_InputCommand(command) End If - Console.DoCommand() + Terminal_DoCommand() Terminal_PrintPrompt() TextRebind() End Sub @@ -67,7 +67,7 @@ Dim i As Integer = 1 While i <= linenum command = sr.ReadLine() - Console.DoCommand() + Terminal_DoCommand() NewLine(Nothing) i = i + 1 End While @@ -106,7 +106,7 @@ AdvancedCommand = False Console.BadCommand = False Case "colors" - DisplayColors() + Colors() AdvancedCommand = False Console.BadCommand = False Case "date" diff --git a/ShiftOS-TheRevival/Functions/InGame/CodepointSystem.vb b/ShiftOS-TheRevival/Functions/InGame/CodepointSystem.vb new file mode 100644 index 0000000..6a76a28 --- /dev/null +++ b/ShiftOS-TheRevival/Functions/InGame/CodepointSystem.vb @@ -0,0 +1,11 @@ +Module CodepointSystem + Public Sub ChangeCP(Addition As Boolean, NeededCP As Integer) + Dim TempCP As Integer = Convert.ToInt32(Strings.ComputerInfo(2)) + If Addition = True Then + TempCP = TempCP + NeededCP + Else + TempCP = TempCP - NeededCP + End If + Strings.ComputerInfo(2) = Convert.ToString(TempCP) + End Sub +End Module diff --git a/ShiftOS-TheRevival/Functions/InGame/TerminalColorSystem.vb b/ShiftOS-TheRevival/Functions/InGame/ColorSystem.vb similarity index 80% rename from ShiftOS-TheRevival/Functions/InGame/TerminalColorSystem.vb rename to ShiftOS-TheRevival/Functions/InGame/ColorSystem.vb index 9042910..80f1c8f 100644 --- a/ShiftOS-TheRevival/Functions/InGame/TerminalColorSystem.vb +++ b/ShiftOS-TheRevival/Functions/InGame/ColorSystem.vb @@ -1,4 +1,4 @@ -Module TerminalColorSystem +Module ColorSystem 'GUIDE to COLORS in TERMINAL 'Using the same Hexadecimal numbering as what Command Prompt used to: '0 = Black 8 = Gray @@ -12,53 +12,6 @@ Public BgColor As Color Public FgColor As Color - Public Sub DisplayColors() - NewLine("TERMINAL SUPPORTED COLORS") - NewLine(Nothing) - NewLine(Nothing) - If Strings.AvailableFeature(10) = "1" Then - NewLine("0 = Black 8 = Gray") - Else - NewLine("0 = Black 8 = ???") - End If - If Strings.AvailableFeature(14) = "1" Then - NewLine("1 = Blue 9 = Light Blue") - NewLine("2 = Green A = Light Green") - Else - If Strings.AvailableFeature(13) = "1" Then - NewLine("1 = ??? 9 = Light Blue") - NewLine("2 = Green A = ???") - Else - NewLine("1 = ??? 9 = ???") - NewLine("2 = ??? A = ???") - End If - End If - If Strings.AvailableFeature(15) = "1" Then - NewLine("3 = Aqua B = Light Aqua") - Else - NewLine("3 = ??? B = ???") - End If - If Strings.AvailableFeature(14) = "1" Then - NewLine("4 = Red C = Light Red") - ElseIf Strings.AvailableFeature(13) = "1" Then - NewLine("4 = ??? C = Light Red") - Else - NewLine("4 = ??? C = ???") - End If - If Strings.AvailableFeature(15) = "1" Then - NewLine("5 = Purple D = Light Purple") - NewLine("6 = Yellow E = Yellow") - Else - NewLine("5 = ??? D = ???") - NewLine("6 = ??? E = ???") - End If - If Strings.AvailableFeature(10) = "1" Then - NewLine("7 = Dark Gray F = White") - Else - NewLine("7 = ??? F = White") - End If - End Sub - Public Sub GetColor(App As String, Bg As String, Fg As String) Select Case App Case "terminal" diff --git a/ShiftOS-TheRevival/MainForms/Console.vb b/ShiftOS-TheRevival/MainForms/Console.vb index 048fdfa..5e8ef82 100644 --- a/ShiftOS-TheRevival/MainForms/Console.vb +++ b/ShiftOS-TheRevival/MainForms/Console.vb @@ -96,10 +96,6 @@ Public Class Console End If End Sub - Public Sub DoCommand() - - End Sub - Private Sub txtterm_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown KeyInput = e.KeyData Select Case e.KeyData diff --git a/ShiftOS-TheRevival/ShiftOS-TheRevival.vbproj b/ShiftOS-TheRevival/ShiftOS-TheRevival.vbproj index 400da4f..4f5e7ba 100644 --- a/ShiftOS-TheRevival/ShiftOS-TheRevival.vbproj +++ b/ShiftOS-TheRevival/ShiftOS-TheRevival.vbproj @@ -93,6 +93,7 @@ + BugSlap.vb @@ -160,13 +161,16 @@ - + + + + @@ -175,7 +179,6 @@ - diff --git a/ShiftOS-TheRevival/TerminalApplications/External/TerminalExternalApps.vb b/ShiftOS-TheRevival/TerminalApplications/External/TerminalExternalApps.vb index 24a6435..3f91782 100644 --- a/ShiftOS-TheRevival/TerminalApplications/External/TerminalExternalApps.vb +++ b/ShiftOS-TheRevival/TerminalApplications/External/TerminalExternalApps.vb @@ -19,16 +19,6 @@ Module TerminalExternalApps Public TextPad_FileName As String Public TextPad_TempText As New Timer - Public Sub ChangeCP(Addition As Boolean, NeededCP As Integer) - Dim TempCP As Integer = Convert.ToInt32(Strings.ComputerInfo(2)) - If Addition = True Then - TempCP = TempCP + NeededCP - Else - TempCP = TempCP - NeededCP - End If - Strings.ComputerInfo(2) = Convert.ToString(TempCP) - End Sub - Public Sub AppHost(App As Object, UseToolBar As Boolean) Select Case App Case "bc" diff --git a/ShiftOS-TheRevival/TerminalApplications/Internal/Com_Color.vb b/ShiftOS-TheRevival/TerminalApplications/Internal/Com_Color.vb new file mode 100644 index 0000000..ac9d52e --- /dev/null +++ b/ShiftOS-TheRevival/TerminalApplications/Internal/Com_Color.vb @@ -0,0 +1,3 @@ +Module Com_Color + +End Module diff --git a/ShiftOS-TheRevival/TerminalApplications/Internal/Com_Colors.vb b/ShiftOS-TheRevival/TerminalApplications/Internal/Com_Colors.vb new file mode 100644 index 0000000..867bdcc --- /dev/null +++ b/ShiftOS-TheRevival/TerminalApplications/Internal/Com_Colors.vb @@ -0,0 +1,48 @@ +Module Com_Colors + Public Sub Colors() + NewLine("TERMINAL SUPPORTED COLORS") + NewLine(Nothing) + NewLine(Nothing) + If Strings.AvailableFeature(10) = "1" Then + NewLine("0 = Black 8 = Gray") + Else + NewLine("0 = Black 8 = ???") + End If + If Strings.AvailableFeature(14) = "1" Then + NewLine("1 = Blue 9 = Light Blue") + NewLine("2 = Green A = Light Green") + Else + If Strings.AvailableFeature(13) = "1" Then + NewLine("1 = ??? 9 = Light Blue") + NewLine("2 = Green A = ???") + Else + NewLine("1 = ??? 9 = ???") + NewLine("2 = ??? A = ???") + End If + End If + If Strings.AvailableFeature(15) = "1" Then + NewLine("3 = Aqua B = Light Aqua") + Else + NewLine("3 = ??? B = ???") + End If + If Strings.AvailableFeature(14) = "1" Then + NewLine("4 = Red C = Light Red") + ElseIf Strings.AvailableFeature(13) = "1" Then + NewLine("4 = ??? C = Light Red") + Else + NewLine("4 = ??? C = ???") + End If + If Strings.AvailableFeature(15) = "1" Then + NewLine("5 = Purple D = Light Purple") + NewLine("6 = Yellow E = Yellow") + Else + NewLine("5 = ??? D = ???") + NewLine("6 = ??? E = ???") + End If + If Strings.AvailableFeature(10) = "1" Then + NewLine("7 = Dark Gray F = White") + Else + NewLine("7 = ??? F = White") + End If + End Sub +End Module diff --git a/ShiftOS-TheRevival/TerminalApplications/Internal/TerminalInternalApps.vb b/ShiftOS-TheRevival/TerminalApplications/Internal/Com_Manual.vb similarity index 98% rename from ShiftOS-TheRevival/TerminalApplications/Internal/TerminalInternalApps.vb rename to ShiftOS-TheRevival/TerminalApplications/Internal/Com_Manual.vb index f4bba89..a3c7de9 100644 --- a/ShiftOS-TheRevival/TerminalApplications/Internal/TerminalInternalApps.vb +++ b/ShiftOS-TheRevival/TerminalApplications/Internal/Com_Manual.vb @@ -1,12 +1,4 @@ -Module TerminalInternalApps - Public Sub Cowsay_Say(Say As String) - - End Sub - - Public Sub DateTerm() - - End Sub - +Module Com_Manual Public Sub Manual(Command As String) 'MAN command starts with this kinda format 'ShiftOS Help Manual