From 47d0c108df76229c0469d2f7b62563904eae141a Mon Sep 17 00:00:00 2001 From: EverythingWindows Date: Mon, 14 Nov 2022 10:25:13 +0700 Subject: [PATCH] Migration from Console to TerminalInteralApps and TerminalExternalApps for some commands. --- .../MainForms/Console.Designer.vb | 2 + ShiftOS-TheRevival/MainForms/Console.vb | 169 +++--------------- ShiftOS-TheRevival/MainForms/ConsoleAPI.vb | 4 + .../MainForms/SaveLoadSystem.vb | 2 +- .../MainForms/TerminalInternalApps.vb | 140 +++++++++++++++ 5 files changed, 176 insertions(+), 141 deletions(-) diff --git a/ShiftOS-TheRevival/MainForms/Console.Designer.vb b/ShiftOS-TheRevival/MainForms/Console.Designer.vb index 505c77a..3e07714 100644 --- a/ShiftOS-TheRevival/MainForms/Console.Designer.vb +++ b/ShiftOS-TheRevival/MainForms/Console.Designer.vb @@ -56,8 +56,10 @@ Partial Class Console Me.InfoBar.Location = New System.Drawing.Point(0, 432) Me.InfoBar.Name = "InfoBar" Me.InfoBar.ReadOnly = True + Me.InfoBar.ShortcutsEnabled = False Me.InfoBar.Size = New System.Drawing.Size(800, 18) Me.InfoBar.TabIndex = 0 + Me.InfoBar.TabStop = False Me.InfoBar.Text = "Infobar" Me.InfoBar.TextAlign = System.Windows.Forms.HorizontalAlignment.Right Me.InfoBar.Visible = False diff --git a/ShiftOS-TheRevival/MainForms/Console.vb b/ShiftOS-TheRevival/MainForms/Console.vb index f4c5d1c..893b752 100644 --- a/ShiftOS-TheRevival/MainForms/Console.vb +++ b/ShiftOS-TheRevival/MainForms/Console.vb @@ -97,10 +97,6 @@ Public Class Console End If End Sub - Private Sub Undeveloped() - NewLine("Oopsie! It's only for newer version") - End Sub - Public Sub DoCommand() AdvancedCommand = True BadCommand = True @@ -194,112 +190,7 @@ Public Class Console BadCommand = False 'Undeveloped() Case "help" - NewLine("ShiftOS Help Manual") - NewLine(Nothing) - NewLine("You can type 'help' to get all available commands and its corresponding action.") - If Strings.AvailableFeature(0) = 1 Then - NewLine("To get help on each command, you can type 'man [command]'") - NewLine(Nothing) - Else - NewLine(Nothing) - End If - If Strings.AvailableFeature(9) = 1 Then - NewLine("BC Basic Calculator for simple calculation") - End If - If Strings.AvailableFeature(16) = 1 Then - NewLine("CD Changes directory to a selected one") - End If - If Strings.AvailableFeature(1) = 1 Then - NewLine("CLEAR Clear the terminal") - End If - NewLine("CODEPOINT Display Codepoint(s) from your wallet") - NewLine("COLOR Changes Terminal Text And Background color To the corresponding choice") - NewLine("COLORS Shows available colors support For the terminal") - If Strings.AvailableFeature(22) = 1 Then - NewLine("COWSAY Spawn a cow And saying anything you want") - End If - If Strings.AvailableFeature(24) = 1 Then - NewLine("DATE Displays date in days since first day of the year format") - ElseIf Strings.AvailableFeature(24) = 3 Then - If Strings.AvailableFeature(25) = 1 Then - NewLine("DATE Displays date in weeks since first week of the year format") - ElseIf Strings.AvailableFeature(25) = 3 Then - If Strings.AvailableFeature(26) = 1 Then - NewLine("DATE Displays date in months since first month of the year format") - ElseIf Strings.AvailableFeature(26) = 3 Then - If Strings.AvailableFeature(27) = 1 Then - NewLine("DATE Displays date in year format format") - ElseIf Strings.AvailableFeature(27) = 3 Then - If Strings.AvailableFeature(28) = 1 Then - NewLine("DATE Displays date in MM/YYYY format") - ElseIf Strings.AvailableFeature(28) = 3 Then - If Strings.AvailableFeature(29) = 1 Then - NewLine("DATE Displays date in general DD/MM/YYYY format") - End If - End If - End If - End If - End If - End If - If Strings.AvailableFeature(16) = 1 Then - NewLine("DEL Delete a selected file from the directory") - NewLine("DIR Displays subdirectories And files In a directory") - End If - NewLine("GUESS Runs 'Guess the Number' application") - NewLine("HELP Shows all commands available and its corresponding action") - If Strings.AvailableFeature(20) = 1 Then - NewLine("HOSTNAME Sets the name of current hostname/computer name with a new one") - End If - If Strings.AvailableFeature(4) = 1 Then - NewLine("INFOBAR Displays informations about current session such as current app, current user, current time, etc.") - End If - If Strings.AvailableFeature(0) = 1 Then - NewLine("MAN Shows a command, its corresponding action, and its example usage") - End If - If Strings.AvailableFeature(16) = 1 Then - NewLine("MKDIR Creating a directory") - End If - If Strings.AvailableFeature(16) = 1 Then - NewLine("PWD Display current directory navigated on ShiftOS") - End If - If Strings.AvailableFeature(2) = 1 Then - NewLine("PRINT Prints a corresponding text entered in the command") - End If - NewLine("REBOOT Terminate and re-run ShiftOS session") - If Strings.AvailableFeature(21) = 1 Then - NewLine("REV Turn any sentences you want and making it reversed") - End If - If Strings.AvailableFeature(16) = 1 Then - NewLine("RMDIR Deleting a directory") - End If - If Strings.AvailableFeature(8) = 1 Then - NewLine("SHIFTFETCH Shows informations about your computer") - End If - NewLine("SHIFTORIUM A software center for upgrading features on ShiftOS") - NewLine("SHUTDOWN Terminate ShiftOS session") - NewLine("SU Runs terminal as super user") - If Strings.AvailableFeature(17) = 1 Then - NewLine("TEXTPAD Simple text-editor for ShiftOS") - End If - If Strings.AvailableFeature(5) = 1 Then - NewLine("TIME Display the current time in the form of seconds since midnight") - ElseIf Strings.AvailableFeature(5) = 3 Then - If Strings.AvailableFeature(6) = 1 Then - NewLine("TIME Display the current time in the form of minutes since midnight") - ElseIf Strings.AvailableFeature(6) = 3 Then - If Strings.AvailableFeature(7) = 1 Then - NewLine("TIME Display the current time in the form of hours since midnight") - ElseIf Strings.AvailableFeature(7) = 3 Then - If Strings.AvailableFeature(12) = 1 Then - NewLine("TIME Display the current time in the form of PM and AM format") - End If - End If - End If - End If - If Strings.AvailableFeature(20) = 1 Then - NewLine("USERNAME Sets the name of current user with a new one") - End If - NewLine("VER Printing current version of ShiftOS TheRevival") + Help() AdvancedCommand = False BadCommand = False Case "infobar" @@ -324,34 +215,7 @@ Public Class Console BadCommand = False Case "shiftfetch" If Strings.AvailableFeature(8) = "1" Then - If Strings.OnceInfo(0) = "Yes" Then - NewLine(" :^!7?JJJJJ?7!^: root@shiftos") - Else - NewLine(" :^!7?JJJJJ?7!^: " & Strings.ComputerInfo(1) & "@" & Strings.ComputerInfo(0)) - End If - NewLine(" .~?PB###BGP555PGB###BP?~. ----------------------") - NewLine(" .!P#&B57^..:: ^~~!!~^::~7YG!. OS: ShiftOS TheRevival") - NewLine(" .?#@G7: .^ :^::!5&#?. Host: " & Environment.MachineName) - NewLine(" .?#@5^ ! .^!!..J&#? Kernel: " & My.Resources.CurrentVersion) - NewLine(" B@G^ .J : 7?..J@G: Uptime : N/ A") - NewLine(" ~&@Y 7 ~PB&#Y:. ~G7 ~&&^ Packages: " & Strings.ComputerInfo(4)) - NewLine(" ^&@Y Y 5#5??YB@&B~ .GJ :&&: Shell: sos-justshell") - NewLine(" G@B ? 5P ^YB! .#! ~@G Window Manager: -") - NewLine(" ^@@! : @Y .:::^~:. 7# Y@^ Window Manager Theme: -") - NewLine(" 7@@: ! B@&BBBBGPPB@#Y. :&^ ^@? Terminal: shiftos-terminal") - NewLine(" ?@@: 7 :??7~:. 5@@5 :&^ .&? Terminal Font: Consolas, 11pt") - NewLine(" ~@@! !@ G#&B!. Y@@B 7#. Y~ CPU: " & My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0", "ProcessorNameString", Nothing)) - NewLine(" B@G B@J ...~&G. 7@@@? .#? 7 GPU: N/A") - Dim TripleDigitRAM As String - TripleDigitRAM = (My.Computer.Info.TotalPhysicalMemory / 1024 / 1024 / 1024) - NewLine(" ~&@? ^@Y !G#57~~!YB@#Y^ .GP .. Memory: " & TripleDigitRAM.Substring(0, 4) & " GB") - NewLine(" !@@7 ~#J 5#&&BG57^ ~BY Codepoint: " & Strings.ComputerInfo(2)) - NewLine(" ~#@Y .5P~ ^5G~ ") - NewLine(" .J&#! ^JY!:. ^?P5! ") - NewLine(" :J&B?..!JYY7!~::...::~!7Y5Y7: ") - NewLine(" .7PBP?^::~!?JJJJJJJ?7~: ") - NewLine(" .~?55Y?!^:... ") - NewLine(" .:~~^~^^::. ") + Shiftfetch() AdvancedCommand = False BadCommand = False End If @@ -601,8 +465,9 @@ Public Class Console End If End If TrackPos = 0 - Case Keys.ShiftKey, Keys.Alt, Keys.ControlKey, Keys.LWin, Keys.RWin + Case Keys.ShiftKey, Keys.LShiftKey, Keys.RShiftKey, Keys.Alt, Keys.ControlKey, Keys.LWin, Keys.RWin e.SuppressKeyPress = True + TrackPos = TrackPos Case Keys.Back If TrackPos <= 0 Then e.SuppressKeyPress = True @@ -763,7 +628,31 @@ Public Class Console End If End If End If - If Strings.OnceInfo(0) = "Yes" Then + If Strings.AvailableFeature(24) = 1 Then + InfoBar.Text = InfoBar.Text & " " & Date.Now.DayOfYear & " |" + ElseIf Strings.AvailableFeature(24) = 3 Then + If Strings.AvailableFeature(25) = 1 Then + Dim WeekOfYear As String = Date.Now.DayOfYear / 7 + InfoBar.Text = InfoBar.Text & " " & WeekOfYear.Substring(0, 2) & " |" + ElseIf Strings.AvailableFeature(25) = 3 Then + If Strings.AvailableFeature(26) = 1 Then + InfoBar.Text = InfoBar.Text & " " & Date.Now.Month & " |" + ElseIf Strings.AvailableFeature(26) = 3 Then + If Strings.AvailableFeature(27) = 1 Then + InfoBar.Text = InfoBar.Text & " " & Date.Now.Year & " |" + ElseIf Strings.AvailableFeature(27) = 3 Then + If Strings.AvailableFeature(28) = 1 Then + InfoBar.Text = InfoBar.Text & " " & Date.Now.Day & "/" & Date.Now.Month & " |" + ElseIf Strings.AvailableFeature(28) = 3 Then + If Strings.AvailableFeature(29) = 1 Then + InfoBar.Text = InfoBar.Text & " " & Date.Now.Day & "/" & Date.Now.Month & "/" & Date.Now.Year & " |" + End If + End If + End If + End If + End If + End If + If Strings.OnceInfo(0) = "Yes" Then InfoBar.Text = InfoBar.Text & " root |" Else InfoBar.Text = InfoBar.Text & " user |" diff --git a/ShiftOS-TheRevival/MainForms/ConsoleAPI.vb b/ShiftOS-TheRevival/MainForms/ConsoleAPI.vb index 155173e..7021e2e 100644 --- a/ShiftOS-TheRevival/MainForms/ConsoleAPI.vb +++ b/ShiftOS-TheRevival/MainForms/ConsoleAPI.vb @@ -11,6 +11,10 @@ Console.TextBox1.Text = str End Sub + Public Sub Undeveloped() + NewLine("Oopsie! It's only for newer version") + End Sub + Public Sub TextRebind() Console.TextBox1.Select(Console.TextBox1.Text.Length, 0) Console.TextBox1.ScrollToCaret() diff --git a/ShiftOS-TheRevival/MainForms/SaveLoadSystem.vb b/ShiftOS-TheRevival/MainForms/SaveLoadSystem.vb index 9f15e8b..5b7f77e 100644 --- a/ShiftOS-TheRevival/MainForms/SaveLoadSystem.vb +++ b/ShiftOS-TheRevival/MainForms/SaveLoadSystem.vb @@ -50,7 +50,7 @@ Module SaveLoadSystem Strings.ComputerInfo(0) = "shiftos" Strings.ComputerInfo(1) = "user" Strings.ComputerInfo(2) = "0" - Strings.ComputerInfo(4) = "23" + Strings.ComputerInfo(4) = "31" Strings.AvailableFeature(0) = "1" Strings.AvailableFeature(1) = "1" Strings.AvailableFeature(2) = "1" diff --git a/ShiftOS-TheRevival/MainForms/TerminalInternalApps.vb b/ShiftOS-TheRevival/MainForms/TerminalInternalApps.vb index baba0e0..944954b 100644 --- a/ShiftOS-TheRevival/MainForms/TerminalInternalApps.vb +++ b/ShiftOS-TheRevival/MainForms/TerminalInternalApps.vb @@ -83,6 +83,115 @@ End Select End Sub + Public Sub Help() + NewLine("ShiftOS Help Manual") + NewLine(Nothing) + NewLine("You can type 'help' to get all available commands and its corresponding action.") + If Strings.AvailableFeature(0) = 1 Then + NewLine("To get help on each command, you can type 'man [command]'") + NewLine(Nothing) + Else + NewLine(Nothing) + End If + If Strings.AvailableFeature(9) = 1 Then + NewLine("BC Basic Calculator for simple calculation") + End If + If Strings.AvailableFeature(16) = 1 Then + NewLine("CD Changes directory to a selected one") + End If + If Strings.AvailableFeature(1) = 1 Then + NewLine("CLEAR Clear the terminal") + End If + NewLine("CODEPOINT Display Codepoint(s) from your wallet") + NewLine("COLOR Changes Terminal Text And Background color To the corresponding choice") + NewLine("COLORS Shows available colors support For the terminal") + If Strings.AvailableFeature(22) = 1 Then + NewLine("COWSAY Spawn a cow And saying anything you want") + End If + If Strings.AvailableFeature(24) = 1 Then + NewLine("DATE Displays date in days since first day of the year format") + ElseIf Strings.AvailableFeature(24) = 3 Then + If Strings.AvailableFeature(25) = 1 Then + NewLine("DATE Displays date in weeks since first week of the year format") + ElseIf Strings.AvailableFeature(25) = 3 Then + If Strings.AvailableFeature(26) = 1 Then + NewLine("DATE Displays date in months since first month of the year format") + ElseIf Strings.AvailableFeature(26) = 3 Then + If Strings.AvailableFeature(27) = 1 Then + NewLine("DATE Displays date in year format format") + ElseIf Strings.AvailableFeature(27) = 3 Then + If Strings.AvailableFeature(28) = 1 Then + NewLine("DATE Displays date in MM/YYYY format") + ElseIf Strings.AvailableFeature(28) = 3 Then + If Strings.AvailableFeature(29) = 1 Then + NewLine("DATE Displays date in general DD/MM/YYYY format") + End If + End If + End If + End If + End If + End If + If Strings.AvailableFeature(16) = 1 Then + NewLine("DEL Delete a selected file from the directory") + NewLine("DIR Displays subdirectories And files In a directory") + End If + NewLine("GUESS Runs 'Guess the Number' application") + NewLine("HELP Shows all commands available and its corresponding action") + If Strings.AvailableFeature(20) = 1 Then + NewLine("HOSTNAME Sets the name of current hostname/computer name with a new one") + End If + If Strings.AvailableFeature(4) = 1 Then + NewLine("INFOBAR Displays informations about current session such as current app, current user, current time, etc.") + End If + If Strings.AvailableFeature(0) = 1 Then + NewLine("MAN Shows a command, its corresponding action, and its example usage") + End If + If Strings.AvailableFeature(16) = 1 Then + NewLine("MKDIR Creating a directory") + End If + If Strings.AvailableFeature(16) = 1 Then + NewLine("PWD Display current directory navigated on ShiftOS") + End If + If Strings.AvailableFeature(2) = 1 Then + NewLine("PRINT Prints a corresponding text entered in the command") + End If + NewLine("REBOOT Terminate and re-run ShiftOS session") + If Strings.AvailableFeature(21) = 1 Then + NewLine("REV Turn any sentences you want and making it reversed") + End If + If Strings.AvailableFeature(16) = 1 Then + NewLine("RMDIR Deleting a directory") + End If + If Strings.AvailableFeature(8) = 1 Then + NewLine("SHIFTFETCH Shows informations about your computer") + End If + NewLine("SHIFTORIUM A software center for upgrading features on ShiftOS") + NewLine("SHUTDOWN Terminate ShiftOS session") + NewLine("SU Runs terminal as super user") + If Strings.AvailableFeature(17) = 1 Then + NewLine("TEXTPAD Simple text-editor for ShiftOS") + End If + If Strings.AvailableFeature(5) = 1 Then + NewLine("TIME Display the current time in the form of seconds since midnight") + ElseIf Strings.AvailableFeature(5) = 3 Then + If Strings.AvailableFeature(6) = 1 Then + NewLine("TIME Display the current time in the form of minutes since midnight") + ElseIf Strings.AvailableFeature(6) = 3 Then + If Strings.AvailableFeature(7) = 1 Then + NewLine("TIME Display the current time in the form of hours since midnight") + ElseIf Strings.AvailableFeature(7) = 3 Then + If Strings.AvailableFeature(12) = 1 Then + NewLine("TIME Display the current time in the form of PM and AM format") + End If + End If + End If + End If + If Strings.AvailableFeature(20) = 1 Then + NewLine("USERNAME Sets the name of current user with a new one") + End If + NewLine("VER Printing current version of ShiftOS TheRevival") + End Sub + Public Sub Manual(Command As String) 'MAN command starts with this kinda format 'ShiftOS Help Manual @@ -241,4 +350,35 @@ NewLine("MAN : Invalid command") End Select End Sub + + Public Sub Shiftfetch() + If Strings.OnceInfo(0) = "Yes" Then + NewLine(" :^!7?JJJJJ?7!^: root@" & Strings.ComputerInfo(0)) + Else + NewLine(" :^!7?JJJJJ?7!^: " & Strings.ComputerInfo(1) & "@" & Strings.ComputerInfo(0)) + End If + NewLine(" .~?PB###BGP555PGB###BP?~. ----------------------") + NewLine(" .!P#&B57^..:: ^~~!!~^::~7YG!. OS: ShiftOS TheRevival") + NewLine(" .?#@G7: .^ :^::!5&#?. Host: " & Environment.MachineName) + NewLine(" .?#@5^ ! .^!!..J&#? Kernel: " & My.Resources.CurrentVersion) + NewLine(" B@G^ .J : 7?..J@G: Uptime : N/ A") + NewLine(" ~&@Y 7 ~PB&#Y:. ~G7 ~&&^ Packages: " & Strings.ComputerInfo(4)) + NewLine(" ^&@Y Y 5#5??YB@&B~ .GJ :&&: Shell: sos-justshell") + NewLine(" G@B ? 5P ^YB! .#! ~@G Window Manager: -") + NewLine(" ^@@! : @Y .:::^~:. 7# Y@^ Window Manager Theme: -") + NewLine(" 7@@: ! B@&BBBBGPPB@#Y. :&^ ^@? Terminal: shiftos-terminal") + NewLine(" ?@@: 7 :??7~:. 5@@5 :&^ .&? Terminal Font: Consolas, 11pt") + NewLine(" ~@@! !@ G#&B!. Y@@B 7#. Y~ CPU: " & My.Computer.Registry.GetValue("HKEY_LOCAL_MACHINE\HARDWARE\DESCRIPTION\System\CentralProcessor\0", "ProcessorNameString", Nothing)) + NewLine(" B@G B@J ...~&G. 7@@@? .#? 7 GPU: N/A") + Dim TripleDigitRAM As String + TripleDigitRAM = (My.Computer.Info.TotalPhysicalMemory / 1024 / 1024 / 1024) + NewLine(" ~&@? ^@Y !G#57~~!YB@#Y^ .GP .. Memory: " & TripleDigitRAM.Substring(0, 4) & " GB") + NewLine(" !@@7 ~#J 5#&&BG57^ ~BY Codepoint: " & Strings.ComputerInfo(2)) + NewLine(" ~#@Y .5P~ ^5G~ ") + NewLine(" .J&#! ^JY!:. ^?P5! ") + NewLine(" :J&B?..!JYY7!~::...::~!7Y5Y7: ") + NewLine(" .7PBP?^::~!?JJJJJJJ?7~: ") + NewLine(" .~?55Y?!^:... ") + NewLine(" .:~~^~^^::. ") + End Sub End Module