ShiftOS-TheRevival-Old/ShiftOS-TheRevival/MainForms/Console.vb

779 lines
37 KiB
VB.net
Raw Normal View History

2022-11-02 21:28:19 +00:00
Imports System.IO
Public Class Console
2022-11-07 07:16:34 +00:00
Public TrackPos As Integer
2022-11-01 22:57:27 +00:00
Public DefaultPrompt As String
2022-11-02 04:17:14 +00:00
Public BadCommand As Boolean
2022-11-02 21:28:19 +00:00
Public DisplayStory As Integer
Public StoryToTell As String
2022-11-03 15:27:40 +00:00
Public ChangeInterpreter As Boolean = False
Public CurrentInterpreter As String = "terminal"
Public CurrentDirectory As String
2022-11-06 08:20:38 +00:00
Public Pseudodir As String
Public StayAtChapter As Boolean = False
2022-11-06 11:45:00 +00:00
Public ToolBarUse As Boolean = False
Public ReleaseCursor As Boolean = False
2022-11-08 03:22:01 +00:00
Public ShOSKey As String
2022-11-01 22:57:27 +00:00
Private Sub Console_Load(sender As Object, e As EventArgs) Handles MyBase.Load
2022-11-01 22:57:27 +00:00
FormBorderStyle = FormBorderStyle.None
WindowState = FormWindowState.Maximized
2022-11-04 23:27:35 +00:00
Cursor.Hide()
InitializeTerminal()
End Sub
Public Sub InitializeTerminal()
2022-11-06 09:22:35 +00:00
Strings.OnceInfo(1) = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\ShiftFS"
2022-11-06 08:20:38 +00:00
Strings.OnceInfo(4) = "!"
2022-11-08 06:02:02 +00:00
Strings.OnceInfo(7) = Width
Strings.OnceInfo(8) = Height
2022-11-01 22:57:27 +00:00
If Strings.IsFree = True Then
Strings.ComputerInfo(0) = "shiftos"
Strings.ComputerInfo(1) = "user"
CheckFeature()
Terminal_PrintPrompt()
Terminal_AssignPrompt()
2022-11-02 01:52:31 +00:00
Else
If StayAtChapter = True Then
2022-11-06 11:45:00 +00:00
LoadGame()
CheckFeature()
Terminal_PrintPrompt()
Terminal_AssignPrompt()
Else
If Strings.ComputerInfo(3) = "0" Then
TextBox1.ReadOnly = True
StayAtChapter = True
StoryOnlyTimer.Start()
Else
2022-11-06 11:45:00 +00:00
LoadGame()
CheckFeature()
Terminal_PrintPrompt()
Terminal_AssignPrompt()
End If
2022-11-02 21:28:19 +00:00
End If
2022-11-01 22:57:27 +00:00
End If
2022-11-06 08:20:38 +00:00
CurrentDirectory = Strings.OnceInfo(1)
Pseudodir = CurrentDirectory.Replace(Strings.OnceInfo(1), "!\")
TextRebind()
2022-11-01 22:57:27 +00:00
End Sub
Public Sub CheckFeature()
If Strings.AvailableFeature(4) = "1" Then
2022-11-06 11:45:00 +00:00
If ToolBarUse = True Then
If Strings.OnceInfo(2) = "True" Then
InfoBarTimer.Start()
TextBox1.Dock = DockStyle.None
ToolBar.Visible = True
ToolBar.SendToBack()
InfoBar.Visible = True
InfoBar.SendToBack()
TextBox1.Dock = DockStyle.Fill
Else
TextBox1.Dock = DockStyle.None
InfoBar.Visible = False
ToolBar.Visible = True
ToolBar.SendToBack()
TextBox1.Dock = DockStyle.Fill
End If
2022-11-06 07:24:53 +00:00
Else
2022-11-06 11:45:00 +00:00
If Strings.OnceInfo(2) = "True" Then
InfoBarTimer.Start()
TextBox1.Dock = DockStyle.None
InfoBar.Visible = True
InfoBar.SendToBack()
ToolBar.Visible = False
TextBox1.Dock = DockStyle.Fill
Else
TextBox1.Dock = DockStyle.None
InfoBar.Visible = False
ToolBar.Visible = False
TextBox1.Dock = DockStyle.Fill
End If
2022-11-06 07:24:53 +00:00
End If
Else
TextBox1.Dock = DockStyle.None
InfoBar.Visible = False
TextBox1.Dock = DockStyle.Fill
End If
End Sub
2022-11-02 04:17:14 +00:00
Private Sub Undeveloped()
NewLine("Oopsie! It's only for newer version")
2022-11-01 22:57:27 +00:00
End Sub
Public Sub DoCommand()
2022-11-02 01:52:31 +00:00
AdvancedCommand = True
2022-11-02 04:17:14 +00:00
BadCommand = True
2022-11-02 01:52:31 +00:00
Select Case command
2022-11-02 04:17:14 +00:00
Case ""
2022-11-02 01:52:31 +00:00
AdvancedCommand = False
2022-11-02 04:17:14 +00:00
BadCommand = False
Case "05tray"
Dim TempCP As Integer = Convert.ToInt32(Strings.ComputerInfo(2))
TempCP = TempCP + 50
Strings.ComputerInfo(2) = Convert.ToString(TempCP)
NewLine("you cheater!")
2022-11-05 15:24:30 +00:00
Case "bc"
If Strings.AvailableFeature(9) = "1" Then
ChangeInterpreter = True
2022-11-06 11:45:00 +00:00
AppHost("bc", False)
2022-11-05 15:24:30 +00:00
AdvancedCommand = False
BadCommand = False
End If
2022-11-02 04:17:14 +00:00
Case "clear"
If Strings.AvailableFeature(1) = "1" Then
TextBox1.Text = Nothing
AdvancedCommand = False
BadCommand = False
End If
2022-11-02 02:57:21 +00:00
Case "codepoint"
NewLine(Strings.ComputerInfo(2) & " Codepoint(s) available in your wallet")
2022-11-02 02:57:21 +00:00
AdvancedCommand = False
2022-11-02 04:17:14 +00:00
BadCommand = False
2022-11-06 07:24:53 +00:00
Case "colors"
DisplayColors()
AdvancedCommand = False
BadCommand = False
Case "date"
If Strings.AvailableFeature(24) = 1 Then
NewLine("The date is " & Date.Now.DayOfYear & " days since the first day of the year")
AdvancedCommand = False
BadCommand = False
ElseIf Strings.AvailableFeature(24) = 3 Then
If Strings.AvailableFeature(25) = 1 Then
Dim TheWeek As String = Date.Now.DayOfYear / 7
NewLine("The date is " & TheWeek.Substring(0, 2) & " weeks since the first week of the year")
AdvancedCommand = False
BadCommand = False
ElseIf Strings.AvailableFeature(25) = 3 Then
If Strings.AvailableFeature(26) = 1 Then
NewLine("The date is " & Date.Now.Month & " months since the first month of the year")
AdvancedCommand = False
BadCommand = False
ElseIf Strings.AvailableFeature(26) = 3 Then
If Strings.AvailableFeature(27) = 1 Then
NewLine("The year is " & Date.Now.Year)
AdvancedCommand = False
BadCommand = False
ElseIf Strings.AvailableFeature(27) = 3 Then
If Strings.AvailableFeature(28) = 1 Then
NewLine("The date is " & Date.Now.Day & "/" & Date.Now.Month)
AdvancedCommand = False
BadCommand = False
ElseIf Strings.AvailableFeature(28) = 3 Then
If Strings.AvailableFeature(29) = 1 Then
NewLine("The date is " & Date.Now.Day & "/" & Date.Now.Month & "/" & Date.Now.Year)
AdvancedCommand = False
BadCommand = False
End If
End If
End If
End If
End If
End If
2022-11-06 08:20:38 +00:00
Case "dir"
If Strings.AvailableFeature(16) = "1" Then
TerminalDirectories(CurrentDirectory)
AdvancedCommand = False
BadCommand = False
End If
2022-11-06 14:19:35 +00:00
Case "exit su"
If Strings.OnceInfo(0) = "No" Then
Else
AdvancedCommand = False
BadCommand = False
NewLine("Exitting root mode...")
2022-11-06 14:19:35 +00:00
Strings.OnceInfo(0) = "No"
Terminal_AssignPrompt()
2022-11-06 14:19:35 +00:00
End If
2022-11-02 04:17:14 +00:00
Case "guess"
2022-11-03 15:27:40 +00:00
ChangeInterpreter = True
2022-11-06 11:45:00 +00:00
AppHost("guess", False)
2022-11-03 15:27:40 +00:00
AdvancedCommand = False
BadCommand = False
'Undeveloped()
2022-11-02 02:57:21 +00:00
Case "help"
NewLine("ShiftOS Help Manual")
NewLine(Nothing)
NewLine("You can type 'help' to get all available commands and its corresponding action.")
2022-11-02 02:57:21 +00:00
If Strings.AvailableFeature(0) = 1 Then
NewLine("To get help on each command, you can type 'man [command]'")
NewLine(Nothing)
2022-11-02 04:17:14 +00:00
Else
NewLine(Nothing)
2022-11-02 02:57:21 +00:00
End If
If Strings.AvailableFeature(9) = 1 Then
NewLine("BC Basic Calculator for simple calculation")
End If
2022-11-07 00:13:50 +00:00
If Strings.AvailableFeature(16) = 1 Then
NewLine("CD Changes directory to a selected one")
2022-11-07 00:13:50 +00:00
End If
2022-11-02 02:57:21 +00:00
If Strings.AvailableFeature(1) = 1 Then
NewLine("CLEAR Clear the terminal")
2022-11-02 02:57:21 +00:00
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")
2022-11-09 00:02:59 +00:00
If Strings.AvailableFeature(22) = 1 Then
NewLine("COWSAY Spawn a cow And saying anything you want")
2022-11-09 00:02:59 +00:00
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
2022-11-07 00:13:50 +00:00
If Strings.AvailableFeature(16) = 1 Then
NewLine("DEL Delete a selected file from the directory")
NewLine("DIR Displays subdirectories And files In a directory")
2022-11-07 00:13:50 +00:00
End If
NewLine("GUESS Runs 'Guess the Number' application")
NewLine("HELP Shows all commands available and its corresponding action")
2022-11-08 06:02:02 +00:00
If Strings.AvailableFeature(20) = 1 Then
NewLine("HOSTNAME Sets the name of current hostname/computer name with a new one")
2022-11-08 06:02:02 +00:00
End If
2022-11-08 03:22:01 +00:00
If Strings.AvailableFeature(4) = 1 Then
NewLine("INFOBAR Displays informations about current session such as current app, current user, current time, etc.")
2022-11-08 03:22:01 +00:00
End If
2022-11-02 02:57:21 +00:00
If Strings.AvailableFeature(0) = 1 Then
NewLine("MAN Shows a command, its corresponding action, and its example usage")
2022-11-02 02:57:21 +00:00
End If
2022-11-07 00:13:50 +00:00
If Strings.AvailableFeature(16) = 1 Then
NewLine("MKDIR Creating a directory")
2022-11-07 00:13:50 +00:00
End If
If Strings.AvailableFeature(16) = 1 Then
NewLine("PWD Display current directory navigated on ShiftOS")
2022-11-07 00:13:50 +00:00
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")
2022-11-09 00:02:59 +00:00
If Strings.AvailableFeature(21) = 1 Then
NewLine("REV Turn any sentences you want and making it reversed")
2022-11-09 00:02:59 +00:00
End If
2022-11-07 00:13:50 +00:00
If Strings.AvailableFeature(16) = 1 Then
NewLine("RMDIR Deleting a directory")
2022-11-07 00:13:50 +00:00
End If
2022-11-04 23:27:35 +00:00
If Strings.AvailableFeature(8) = 1 Then
NewLine("SHIFTFETCH Shows informations about your computer")
2022-11-04 23:27:35 +00:00
End If
NewLine("SHIFTORIUM A software center for upgrading features on ShiftOS")
NewLine("SHUTDOWN Terminate ShiftOS session")
NewLine("SU Runs terminal as super user")
2022-11-07 07:38:42 +00:00
If Strings.AvailableFeature(17) = 1 Then
NewLine("TEXTPAD Simple text-editor for ShiftOS")
2022-11-07 07:38:42 +00:00
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
2022-11-08 06:02:02 +00:00
If Strings.AvailableFeature(20) = 1 Then
NewLine("USERNAME Sets the name of current user with a new one")
2022-11-08 06:02:02 +00:00
End If
NewLine("VER Printing current version of ShiftOS TheRevival")
2022-11-02 04:17:14 +00:00
AdvancedCommand = False
BadCommand = False
2022-11-08 03:22:01 +00:00
Case "infobar"
If Strings.AvailableFeature(4) = 1 Then
NewLine(My.Resources.man_infobar)
2022-11-08 03:22:01 +00:00
End If
2022-11-07 00:13:50 +00:00
Case "pwd"
2022-11-08 03:22:01 +00:00
If Strings.AvailableFeature(16) = 1 Then
NewLine(CurrentDirectory.Replace(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\ShiftFS", "!"))
2022-11-08 03:22:01 +00:00
AdvancedCommand = False
BadCommand = False
End If
Case "reboot"
TextBox1.Text = Nothing
AdvancedCommand = False
BadCommand = False
SaveGame()
InitializeTerminal()
2022-11-07 07:59:14 +00:00
Case "shiftorium"
NewLine(My.Resources.man_shiftorium)
2022-11-07 07:59:14 +00:00
AdvancedCommand = False
BadCommand = False
2022-11-04 22:36:43 +00:00
Case "shiftfetch"
If Strings.AvailableFeature(8) = "1" Then
If Strings.OnceInfo(0) = "Yes" Then
NewLine(" :^!7?JJJJJ?7!^: root@shiftos")
2022-11-04 22:36:43 +00:00
Else
NewLine(" :^!7?JJJJJ?7!^: " & Strings.ComputerInfo(1) & "@" & Strings.ComputerInfo(0))
2022-11-04 22:36:43 +00:00
End If
NewLine(" .~?PB###BGP555PGB###BP?~. ----------------------")
NewLine(" .!P#&B57^..:: ^~~!!~^::~7YG&#5!. 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(" .:~~^~^^::. ")
2022-11-04 22:36:43 +00:00
AdvancedCommand = False
BadCommand = False
End If
Case "shiftoriumfx"
2022-11-06 08:20:38 +00:00
'ChangeInterpreter = True
'AppHost("shiftoriumfx")
AdvancedCommand = False
2022-11-04 22:36:43 +00:00
BadCommand = False
Undeveloped()
2022-11-02 01:52:31 +00:00
Case "shutdown", "shut down"
NewLine("Saving game...")
2022-11-06 11:45:00 +00:00
If Strings.OnceInfo(6) = "story" Then
SaveGame()
End If
2022-11-04 23:27:35 +00:00
Cursor.Show()
2022-11-02 01:52:31 +00:00
ShiftOSMenu.Show()
Close()
2022-11-07 07:59:14 +00:00
Case "textpad"
If Strings.AvailableFeature(17) = "1" Then
NewLine("Type any filename after 'textpad'!, ex: textpad text.txt")
2022-11-07 07:59:14 +00:00
AdvancedCommand = False
BadCommand = False
End If
Case "time"
If Strings.AvailableFeature(5) = "1" Then
NewLine(Math.Floor(Date.Now.Subtract(Date.Today).TotalSeconds) & " seconds passed since midnight")
ElseIf Strings.AvailableFeature(5) = "3" Then
If Strings.AvailableFeature(6) = "1" Then
NewLine(Math.Floor(Date.Now.Subtract(Date.Today).TotalMinutes) & " minutes passed since midnight")
ElseIf Strings.AvailableFeature(6) = "3" Then
If Strings.AvailableFeature(7) = "1" Then
NewLine(Math.Floor(Date.Now.Subtract(Date.Today).TotalHours) & " hours passed since midnight")
ElseIf Strings.AvailableFeature(7) = "3" Then
If Strings.AvailableFeature(12) = "1" Then
If Date.Now.Hour < 12 Then
NewLine("The time is " & TimeOfDay.Hour & " AM")
Else
NewLine("The time is " & TimeOfDay.Hour - 12 & " PM")
End If
ElseIf Strings.AvailableFeature(23) = "1" Then
NewLine("The time is " & TimeOfDay.Hour & ":" & TimeOfDay.Minute)
End If
End If
End If
End If
AdvancedCommand = False
BadCommand = False
2022-11-06 08:20:38 +00:00
Case "su"
If Strings.OnceInfo(0) = "Yes" Then
NewLine("You already in root mode!")
2022-11-06 08:20:38 +00:00
Else
Strings.OnceInfo(0) = "Yes"
Terminal_AssignPrompt()
2022-11-06 08:20:38 +00:00
End If
AdvancedCommand = False
BadCommand = False
2022-11-02 18:52:22 +00:00
Case "ver"
NewLine("ShiftOS TheRevival version " & My.Resources.CurrentVersion)
2022-11-02 18:52:22 +00:00
AdvancedCommand = False
BadCommand = False
2022-11-02 01:52:31 +00:00
End Select
If AdvancedCommand = True Then
2022-11-06 14:19:35 +00:00
If command Like "cat *" Then
2022-11-07 07:16:34 +00:00
If Strings.AvailableFeature(16) = 1 Then
CatFile(command.Substring(4))
AdvancedCommand = False
BadCommand = False
End If
2022-11-06 14:19:35 +00:00
End If
2022-11-06 09:22:35 +00:00
If command Like "cd *" Then
2022-11-07 07:16:34 +00:00
If Strings.AvailableFeature(16) = 1 Then
NavigateDir(command.Replace("cd ", ""))
AdvancedCommand = False
BadCommand = False
End If
2022-11-06 09:22:35 +00:00
End If
2022-11-06 07:24:53 +00:00
If command Like "color *" Then
GetColor("terminal", command.Substring(6, 1), command.Substring(7, 1))
BadCommand = False
End If
2022-11-08 23:30:53 +00:00
If command Like "cowsay *" Then
If Strings.AvailableFeature(22) = 1 Then
Cowsay_Say(RawCommand.Substring(7))
BadCommand = False
End If
End If
If command Like "del *" Then
If Strings.AvailableFeature(16) = 1 Then
2022-11-08 23:30:53 +00:00
DeleteFile(RawCommand.Substring(4))
AdvancedCommand = False
BadCommand = False
End If
End If
2022-11-08 06:02:02 +00:00
If command Like "hostname *" Then
If Strings.AvailableFeature(20) = 1 Then
Strings.ComputerInfo(0) = command.Substring(command.LastIndexOf(" ") + 1, command.Length - (command.LastIndexOf(" ") + 1))
Terminal_AssignPrompt()
2022-11-08 23:30:53 +00:00
AdvancedCommand = False
BadCommand = False
2022-11-08 06:02:02 +00:00
End If
End If
2022-11-06 07:24:53 +00:00
If command Like "infobar *" Then
If Strings.AvailableFeature(4) = "1" Then
'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"
CheckFeature()
BadCommand = False
advancedtool = False
Case "off"
Strings.OnceInfo(2) = "False"
CheckFeature()
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))
BadCommand = False
End If
End If
End If
End If
2022-11-02 18:52:22 +00:00
If command Like "man *" Then
2022-11-02 19:46:32 +00:00
If Strings.AvailableFeature(0) = "1" Then
2022-11-09 00:02:59 +00:00
Manual(command)
2022-11-02 19:46:32 +00:00
End If
2022-11-02 18:52:22 +00:00
End If
2022-11-06 09:22:35 +00:00
If command Like "mkdir *" Then
2022-11-07 07:16:34 +00:00
If Strings.AvailableFeature(16) Then
CreateDir(command.Replace("mkdir ", ""))
AdvancedCommand = False
BadCommand = False
End If
End If
If command Like "print *" Then
If Strings.AvailableFeature(2) = "1" Then
NewLine(RawCommand.Substring(6))
2022-11-08 23:30:53 +00:00
'Dim printed As String = command.Replace("print ", "")
2022-11-07 07:16:34 +00:00
''It has the same issue, only displays in lowercase
'NewLine( printed
2022-11-07 07:16:34 +00:00
BadCommand = False
AdvancedCommand = False
End If
2022-11-06 09:22:35 +00:00
End If
2022-11-08 23:30:53 +00:00
If command Like "rev *" Then
If Strings.AvailableFeature(21) = 1 Then
NewLine(StrReverse(RawCommand.Substring(4)))
2022-11-08 23:30:53 +00:00
BadCommand = False
AdvancedCommand = False
End If
End If
2022-11-06 09:22:35 +00:00
If command Like "rmdir *" Then
2022-11-07 07:16:34 +00:00
If Strings.AvailableFeature(16) = 1 Then
RemoveDir(command.Replace("rmdir ", ""))
AdvancedCommand = False
BadCommand = False
End If
2022-11-06 09:22:35 +00:00
End If
If command Like "run *" Then
If Strings.AvailableFeature(30) = 1 Then
Terminal_RunTerminalFile(command.Substring(4))
AdvancedCommand = False
BadCommand = False
End If
End If
2022-11-02 18:52:22 +00:00
If command Like "shiftorium *" Then
Dim prompt As String = command.Replace("shiftorium ", "")
NewLine("Shiftorium ShiftOS Center")
2022-11-02 18:52:22 +00:00
If prompt Like "info *" Then
Shiftoriums.prompt = command.Replace("shiftorium info ", "")
Shiftorium_InformationFeatures()
2022-11-02 18:52:22 +00:00
End If
If prompt Like "install *" Then
Shiftoriums.prompt = command.Replace("shiftorium install ", "")
Shiftorium_DetectInstallFeatures()
2022-11-02 18:52:22 +00:00
End If
If prompt = "list" Then
Shiftorium_ListFeatures()
2022-11-02 19:46:32 +00:00
BadCommand = False
2022-11-02 18:52:22 +00:00
End If
End If
2022-11-07 07:16:34 +00:00
If command Like "textpad *" Then
If Strings.AvailableFeature(17) = 1 Then
ChangeInterpreter = True
2022-11-08 23:30:53 +00:00
command = RawCommand.Replace("textpad ", "")
2022-11-07 07:16:34 +00:00
AppHost("textpad", True)
AdvancedCommand = False
BadCommand = False
End If
2022-11-02 01:52:31 +00:00
End If
2022-11-08 06:02:02 +00:00
If command Like "username *" Then
If Strings.AvailableFeature(19) = 1 Then
If command.Substring(9) = "root" Then
NewLine("This username is already taken!")
2022-11-08 06:02:02 +00:00
Else
Strings.ComputerInfo(1) = command.Substring(command.LastIndexOf(" ") + 1, command.Length - (command.LastIndexOf(" ") + 1))
Terminal_AssignPrompt()
2022-11-08 06:02:02 +00:00
End If
2022-11-08 23:30:53 +00:00
AdvancedCommand = False
BadCommand = False
2022-11-08 06:02:02 +00:00
End If
End If
2022-11-02 21:28:19 +00:00
End If
If BadCommand = True Then
NewLine("Bad command or wrong file name")
2022-11-02 04:17:14 +00:00
End If
2022-11-02 01:52:31 +00:00
End Sub
2022-11-07 07:16:34 +00:00
Private Sub txtterm_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown
KeyInput = e.KeyData
2022-11-06 08:20:38 +00:00
Select Case e.KeyData
Case (Keys.Control + Keys.Q)
If CurrentInterpreter = "terminal" Then
Else
TerminateApp(KeyInput)
2022-11-07 07:16:34 +00:00
TextRebind()
2022-11-06 08:20:38 +00:00
End If
2022-11-07 07:16:34 +00:00
Case Else
CaptureKeyBinding(KeyInput)
2022-11-06 08:20:38 +00:00
End Select
2022-11-06 11:45:00 +00:00
If ReleaseCursor = True Then
Else
2022-11-07 07:16:34 +00:00
Select Case e.KeyData
Case Keys.Enter
e.SuppressKeyPress = True
If TextBox1.ReadOnly = True Then
2022-11-06 11:45:00 +00:00
2022-11-07 07:16:34 +00:00
Else
Terminal_ReadCommand()
2022-11-08 03:22:01 +00:00
If Strings.AvailableFeature(18) = 1 Then
ShOSKey_InputCommand(command)
End If
2022-11-07 07:16:34 +00:00
If ChangeInterpreter = True Then
DoChildCommand()
Terminal_PrintPrompt()
2022-11-07 07:16:34 +00:00
TextRebind()
2022-11-06 11:45:00 +00:00
Else
2022-11-07 07:16:34 +00:00
DoCommand()
Terminal_PrintPrompt()
2022-11-07 07:16:34 +00:00
TextRebind()
2022-11-06 11:45:00 +00:00
End If
2022-11-07 07:16:34 +00:00
End If
TrackPos = 0
Case Keys.ShiftKey, Keys.Alt, Keys.ControlKey, Keys.LWin, Keys.RWin
e.SuppressKeyPress = True
Case Keys.Back
If TrackPos <= 0 Then
2022-11-06 11:45:00 +00:00
e.SuppressKeyPress = True
Else
2022-11-07 07:16:34 +00:00
TrackPos = TrackPos - 1
'If TextBox1.SelectedText.Length < 1 Then
' TrackPos = TrackPos - 1
'Else
' e.SuppressKeyPress = True
'End If
2022-11-06 11:45:00 +00:00
End If
2022-11-07 07:16:34 +00:00
Case Keys.Right
If TextBox1.SelectionStart = TextBox1.TextLength Then
2022-11-06 11:45:00 +00:00
Else
TrackPos = TrackPos + 1
End If
2022-11-07 07:16:34 +00:00
'If TrackPos <= 0 Then
' Dim CommandChar As String
' CommandChar = TextBox1.Lines(TextBox1.Lines.Length - 1)
' CommandChar = CommandChar.Replace(DefaultPrompt, "")
' TrackPos = CommandChar.Length - 1
' TextBox1.Select(TextBox1.TextLength, 0)
' TextBox1.ScrollToCaret()
'End If
Case Keys.Left
If TextBox1.SelectionStart = 0 Then
2022-11-06 11:45:00 +00:00
e.SuppressKeyPress = True
Else
2022-11-07 07:16:34 +00:00
TrackPos = TrackPos - 1
2022-11-06 11:45:00 +00:00
End If
2022-11-07 07:16:34 +00:00
If TrackPos <= 0 Then
Dim CommandChar As String
CommandChar = TextBox1.Lines(TextBox1.Lines.Length - 1)
CommandChar = CommandChar.Replace(DefaultPrompt, "")
TrackPos = CommandChar.Length - 1
TextBox1.Select(TextBox1.TextLength, 0)
TextBox1.ScrollToCaret()
End If
'If TrackPos < 1 Then
' e.SuppressKeyPress = True
' TrackPos = TrackPos - 1
'Else
' TrackPos = TrackPos - 2
'End If
Case Keys.Up
e.SuppressKeyPress = True
2022-11-08 03:22:01 +00:00
If Strings.AvailableFeature(18) = 1 Then
ShOSKey_Display()
TextRebind()
End If
2022-11-07 07:16:34 +00:00
Case Keys.Down
e.SuppressKeyPress = True
2022-11-08 03:22:01 +00:00
If Strings.AvailableFeature(18) = 1 Then
ShOSKey_Display()
TextRebind()
End If
2022-11-07 07:16:34 +00:00
Case Else
TrackPos = TrackPos + 1
End Select
2022-11-06 11:45:00 +00:00
End If
2022-11-07 07:16:34 +00:00
'If e.KeyCode = Keys.Enter Then
' 'If command = "clear" Then
' ' txtterm.Text = txtterm.Text + ShiftOSDesktop.username & "@" & ShiftOSDesktop.osname & " $> "
' ' txtterm.Select(txtterm.Text.Length, 0)
' 'Else
' ' txtterm.Text = txtterm.Text + Environment.NewLine & ShiftOSDesktop.username & "@" & ShiftOSDesktop.osname & " $> "
' ' txtterm.Select(txtterm.Text.Length, 0)
' 'End If
'Else
' If e.KeyCode = Keys.Back Then
' Else
' TrackPos = TrackPos + 1
' End If
'End If
'If e.KeyCode = Keys.Back Then
' 'If TrackPos < 1 Then
' ' e.SuppressKeyPress = True
' 'Else
' ' If TextBox1.SelectedText.Length < 1 Then
' ' TrackPos = TrackPos - 1
' ' Else
' ' e.SuppressKeyPress = True
' ' End If
' 'End If
'End If
2022-11-01 22:57:27 +00:00
End Sub
Private Sub TextBox1_Click(sender As Object, e As EventArgs) Handles TextBox1.Click, TextBox1.MouseDoubleClick
TextRebind()
2022-11-01 22:57:27 +00:00
End Sub
2022-11-02 21:28:19 +00:00
Private Sub StoryOnlyTimer_Tick(sender As Object, e As EventArgs) Handles StoryOnlyTimer.Tick
Select Case Strings.ComputerInfo(3)
Case "0"
Select Case DisplayStory
Case 5
ResetLine("Connected to <null>")
2022-11-02 21:28:19 +00:00
Case 25
NewLine("<null>: Hey there, Unknown user!")
2022-11-08 06:02:02 +00:00
Case 60
NewLine("<null>: Congratulaions! You have been involuntarily selected for a test on my experimental operating system, ShiftOS.")
2022-11-08 06:02:02 +00:00
Case 125
NewLine("<null>: ShiftOS is an operating system that will evolve itself as you use it as I progressively add more features into ShiftOS.")
2022-11-08 06:02:02 +00:00
Case 160
NewLine("<null>: Currently ShiftOS isn't much from a basic command-line operating system.")
2022-11-08 06:02:02 +00:00
Case 210
NewLine("<null>: I don't wish to reveal my indentity at this point in time.")
2022-11-08 06:02:02 +00:00
Case 270
NewLine("<null>: I will install ShiftOS on your system once I leave while I work on... something else.")
2022-11-08 06:02:02 +00:00
Case 335
NewLine("<null>: Once you have ShiftOS rich feature enough, I will come back to you. In the mean time, goodbye!")
2022-11-08 06:02:02 +00:00
Case 400
NewLine("<null> Disconnected")
2022-11-08 06:02:02 +00:00
Case 430
ResetLine("Installing ShiftOS...")
2022-11-08 06:02:02 +00:00
Case 550
ResetLine("ShiftOS Installed, The computer will restart in a few seconds")
2022-11-08 06:02:02 +00:00
Case 600
StoryOnlyTimer.Stop()
2022-11-02 21:28:19 +00:00
TextBox1.Text = Nothing
TextBox1.ReadOnly = False
Strings.ComputerInfo(0) = "shiftos"
Strings.ComputerInfo(1) = "user"
CheckFeature()
Terminal_PrintPrompt()
Terminal_AssignPrompt()
2022-11-02 21:28:19 +00:00
TextBox1.Select(TextBox1.TextLength, 0)
TextBox1.ScrollToCaret()
End Select
End Select
DisplayStory = DisplayStory + 1
End Sub
Private Sub InfoBarTimer_Tick(sender As Object, e As EventArgs) Handles InfoBarTimer.Tick
InfoBar.Text = "|"
If Strings.AvailableFeature(5) = "1" Then
InfoBar.Text = InfoBar.Text & " " & Math.Floor(Date.Now.Subtract(Date.Today).TotalSeconds) & " |"
ElseIf Strings.AvailableFeature(5) = "3" Then
If Strings.AvailableFeature(6) = "1" Then
InfoBar.Text = InfoBar.Text & " " & Math.Floor(Date.Now.Subtract(Date.Today).TotalMinutes) & " |"
ElseIf Strings.AvailableFeature(6) = "3" Then
If Strings.AvailableFeature(7) = "1" Then
InfoBar.Text = InfoBar.Text & " " & Math.Floor(Date.Now.Subtract(Date.Today).TotalHours) & " |"
ElseIf Strings.AvailableFeature(7) = "3" Then
If Strings.AvailableFeature(12) = "1" Then
If Date.Now.Hour < 12 Then
InfoBar.Text = InfoBar.Text & Environment.NewLine & " " & TimeOfDay.Hour & " AM |"
Else
InfoBar.Text = InfoBar.Text & Environment.NewLine & " " & TimeOfDay.Hour - 12 & " PM |"
End If
ElseIf Strings.AvailableFeature(12) = "3" Then
If Strings.AvailableFeature(23) = "1" Then
InfoBar.Text = InfoBar.Text & Environment.NewLine & " " & TimeOfDay.Hour & ":" & TimeOfDay.Minute & " |"
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 |"
End If
InfoBar.Text = InfoBar.Text & " " & CurrentInterpreter & " |"
InfoBar.Text = InfoBar.Text & " " & Strings.ComputerInfo(2) & " CP |"
2022-11-07 07:16:34 +00:00
InfoBar.Text = InfoBar.Text & " " & TrackPos & " |"
End Sub
Private Sub TextBox1_Click(sender As Object, e As MouseEventArgs) Handles TextBox1.MouseDoubleClick, TextBox1.Click
End Sub
2022-11-01 22:57:27 +00:00
End Class