From 552304f614c30c8be8d2e5f042b39cadf3477bcf Mon Sep 17 00:00:00 2001 From: EverythingWindows Date: Fri, 4 Nov 2022 13:12:41 +0700 Subject: [PATCH] v0.2.2 stuffy (infobar, time, more efficient code) --- .../MainForms/SaveLoadSystem.vb | 12 +++ ShiftOS-TheRevival/MainForms/Shiftoriums.vb | 78 ++++++++++++++++++- ShiftOS-TheRevival/MainForms/Strings.vb | 12 ++- .../MainForms/Terminal.Designer.vb | 27 ++++++- ShiftOS-TheRevival/MainForms/Terminal.resx | 3 + ShiftOS-TheRevival/MainForms/Terminal.vb | 74 +++++++++++++++++- ShiftOS-TheRevival/MainForms/TerminalApps.vb | 1 + 7 files changed, 201 insertions(+), 6 deletions(-) diff --git a/ShiftOS-TheRevival/MainForms/SaveLoadSystem.vb b/ShiftOS-TheRevival/MainForms/SaveLoadSystem.vb index 0499d5b..b6e5816 100644 --- a/ShiftOS-TheRevival/MainForms/SaveLoadSystem.vb +++ b/ShiftOS-TheRevival/MainForms/SaveLoadSystem.vb @@ -5,6 +5,10 @@ Strings.AvailableFeature(1) = "0" Strings.AvailableFeature(2) = "2" Strings.AvailableFeature(3) = "2" + Strings.AvailableFeature(4) = "2" + Strings.AvailableFeature(5) = "2" + Strings.AvailableFeature(6) = "2" + Strings.AvailableFeature(7) = "2" End Sub Public Sub FreeRoamMode() @@ -12,6 +16,10 @@ Strings.AvailableFeature(1) = "1" Strings.AvailableFeature(2) = "1" Strings.AvailableFeature(3) = "1" + Strings.AvailableFeature(4) = "1" + Strings.AvailableFeature(5) = "3" + Strings.AvailableFeature(6) = "3" + Strings.AvailableFeature(7) = "1" End Sub Public Sub GodMode() @@ -20,5 +28,9 @@ Strings.AvailableFeature(1) = "0" Strings.AvailableFeature(2) = "2" Strings.AvailableFeature(3) = "2" + Strings.AvailableFeature(4) = "2" + Strings.AvailableFeature(5) = "2" + Strings.AvailableFeature(6) = "2" + Strings.AvailableFeature(7) = "2" End Sub End Module diff --git a/ShiftOS-TheRevival/MainForms/Shiftoriums.vb b/ShiftOS-TheRevival/MainForms/Shiftoriums.vb index 595c1ac..20b1d86 100644 --- a/ShiftOS-TheRevival/MainForms/Shiftoriums.vb +++ b/ShiftOS-TheRevival/MainForms/Shiftoriums.vb @@ -14,6 +14,21 @@ Else If Strings.AvailableFeature(3) = "0" Then Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "Terminal Display Driver (termdspdrv | 50 CP)" + Else + If Strings.AvailableFeature(4) = "0" Then + Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "Terminal InfoBar (infobar | 55 CP)" + End If + End If + End If + If Strings.AvailableFeature(5) = "0" Then + Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "Time by Seconds (stime | 10 CP)" + Else + If Strings.AvailableFeature(6) = "0" Then + Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "Time by Minutes (mtime | 20 CP)" + Else + If Strings.AvailableFeature(7) = "0" Then + Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "Time by Hours (htime | 40 CP)" + End If End If End If End If @@ -53,6 +68,34 @@ Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & ManHeader(0) & Environment.NewLine & Environment.NewLine & "Display driver for ShiftOS' Terminal to utilize advantages such as Infobar, ASCII-based applications" & Environment.NewLine & Environment.NewLine & ManHeader(1) Terminal.BadCommand = False End If + Case "infobar" + If Strings.AvailableFeature(4) = "0" Then + ManHeader(0) = "Terminal InfoBar" + ManHeader(1) = "55 CP" + Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & ManHeader(0) & Environment.NewLine & Environment.NewLine & "Panel bar at the bottom of the terminal to display basic informations" & Environment.NewLine & Environment.NewLine & ManHeader(1) + Terminal.BadCommand = False + End If + Case "stime" + If Strings.AvailableFeature(5) = "0" Then + ManHeader(0) = "Time by Seconds" + ManHeader(1) = "10 CP" + Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & ManHeader(0) & Environment.NewLine & Environment.NewLine & "Shows time in seconds form since midnight" & Environment.NewLine & Environment.NewLine & ManHeader(1) + Terminal.BadCommand = False + End If + Case "stime" + If Strings.AvailableFeature(6) = "0" Then + ManHeader(0) = "Time by Minutes" + ManHeader(1) = "20 CP" + Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & ManHeader(0) & Environment.NewLine & Environment.NewLine & "Shows time in minutes form since midnight" & Environment.NewLine & Environment.NewLine & ManHeader(1) + Terminal.BadCommand = False + End If + Case "htime" + If Strings.AvailableFeature(7) = "0" Then + ManHeader(0) = "Time by Hours" + ManHeader(1) = "40 CP" + Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & ManHeader(0) & Environment.NewLine & Environment.NewLine & "Shows time in hours form since midnight" & Environment.NewLine & Environment.NewLine & ManHeader(1) + Terminal.BadCommand = False + End If Case Else Terminal.BadCommand = False Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "Shiftorium: Bad command or not available" @@ -74,6 +117,18 @@ Case "termdspdrv" Shiftorium_InstallFeatures(True, "termdspdrv", 3, 50) Terminal.BadCommand = False + Case "infobar" + Shiftorium_InstallFeatures(True, "infobar", 4, 50) + Terminal.BadCommand = False + Case "stime" + Shiftorium_InstallFeatures(True, "stime", 5, 10) + Terminal.BadCommand = False + Case "mtime" + Shiftorium_InstallFeatures(True, "mtime", 6, 20) + Terminal.BadCommand = False + Case "htime" + Shiftorium_InstallFeatures(True, "htime", 7, 40) + Terminal.BadCommand = False Case Else Terminal.BadCommand = False Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "Shiftorium: Bad command or not available" @@ -93,6 +148,7 @@ Case "clear" Strings.AvailableFeature(1) = "1" Strings.AvailableFeature(2) = "0" + Strings.AvailableFeature(5) = "0" success = True Case "print" Strings.AvailableFeature(2) = "1" @@ -100,7 +156,23 @@ success = True Case "termdspdrv" Strings.AvailableFeature(3) = "1" - 'Strings.AvailableFeature(3) = "0" + Strings.AvailableFeature(4) = "0" + success = True + Case "infobar" + Strings.AvailableFeature(4) = "1" + success = True + Case "stime" + Strings.AvailableFeature(5) = "1" + Strings.AvailableFeature(6) = "0" + success = True + Case "mtime" + Strings.AvailableFeature(5) = "3" + Strings.AvailableFeature(6) = "1" + Strings.AvailableFeature(7) = "0" + success = True + Case "htime" + Strings.AvailableFeature(6) = "3" + Strings.AvailableFeature(7) = "1" success = True End Select If success = False Then @@ -127,6 +199,10 @@ If IsCLI = True Then Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "Shiftorium: Feature is not available" End If + Case "3" + If IsCLI = True Then + Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "Shiftorium: Feature is already upgraded to a newer one" + End If End Select End Sub End Module diff --git a/ShiftOS-TheRevival/MainForms/Strings.vb b/ShiftOS-TheRevival/MainForms/Strings.vb index cead842..cbf28c6 100644 --- a/ShiftOS-TheRevival/MainForms/Strings.vb +++ b/ShiftOS-TheRevival/MainForms/Strings.vb @@ -3,7 +3,7 @@ Public Shared ComputerInfo(3) As String Public Shared IsFree As Boolean Public Shared OnceInfo(0) As String - Public Shared AvailableFeature(3) As String + Public Shared AvailableFeature(7) As String Public Shared CLIInterpreter As String Public Shared SaveFile As String @@ -35,15 +35,23 @@ '2 = Codepoint (0.2) (default : 0) '3 = Story Chapter (0.2) (default : 0 for New Game) ' - 'AvailableFeature (Default is defined on the Story Mode, Free Mode automatically assigns every available feature to 1, Unavailable in the Shiftorium assigned as 2) Strings: + 'AvailableFeature (Default is defined on the Story Mode, Free Mode automatically assigns every available feature to 1, Unavailable in the Shiftorium assigned as 2, Upgraded assigned as 3) Strings: '0 = MAN command [Manual on each command] (0.2) (default : 0) '1 = CLEAR command [Clearing the screen] (0.2) (default : 0) '2 = PRINT command [Printing a string] (0.2.2) (default : 0) '3 = Terminal Display Driver [Dependencies for advanced terminal applications] (0.2.2) (default : 0) + '4 = Terminal InfoBar [A panel bar at the bottom of the terminal to show 'Time', 'User Session', 'Codepoint', 'Program running'] (0.2.2) (default : 0) + '5 = Time by Second [Showing time in seconds form since midnight] (0.2.2) (default : 0) + '6 = Time by Minutes [Showing time in minutes form since midnight] (0.2.2) (default : 0) + '7 = Time by Hours [Showing time in hours form since midnight] (0.2.2) (default : 0) ' 'Features bought hierarchy : 'ShiftOS Help Manual (MAN) (20 CP) 'Terminal Clear (CLEAR) (25 CP) '>Terminal Print (PRINT) (30 CP) '>>Terminal Display Driver (50 CP) + '>>>Terminal InfoBar (55 CP) + '>Time by Seconds (TIME, STIME) (10 CP) + '>>Time by Minutes (TIME, MTIME) (20 CP) + '>>>Time by Hours (Time, HTIME) (40 CP) End Class diff --git a/ShiftOS-TheRevival/MainForms/Terminal.Designer.vb b/ShiftOS-TheRevival/MainForms/Terminal.Designer.vb index a29a92e..fe90c64 100644 --- a/ShiftOS-TheRevival/MainForms/Terminal.Designer.vb +++ b/ShiftOS-TheRevival/MainForms/Terminal.Designer.vb @@ -25,6 +25,8 @@ Partial Class Terminal Me.components = New System.ComponentModel.Container() Me.TextBox1 = New System.Windows.Forms.TextBox() Me.StoryOnlyTimer = New System.Windows.Forms.Timer(Me.components) + Me.InfoBar = New System.Windows.Forms.TextBox() + Me.InfoBarTimer = New System.Windows.Forms.Timer(Me.components) Me.SuspendLayout() ' 'TextBox1 @@ -33,22 +35,41 @@ Partial Class Terminal Me.TextBox1.BorderStyle = System.Windows.Forms.BorderStyle.None Me.TextBox1.Dock = System.Windows.Forms.DockStyle.Fill Me.TextBox1.Font = New System.Drawing.Font("Consolas", 11.0!) - Me.TextBox1.ForeColor = System.Drawing.Color.Silver + Me.TextBox1.ForeColor = System.Drawing.Color.White Me.TextBox1.Location = New System.Drawing.Point(0, 0) Me.TextBox1.Multiline = True Me.TextBox1.Name = "TextBox1" - Me.TextBox1.Size = New System.Drawing.Size(800, 450) + Me.TextBox1.Size = New System.Drawing.Size(800, 432) Me.TextBox1.TabIndex = 0 ' 'StoryOnlyTimer ' ' + 'InfoBar + ' + Me.InfoBar.BorderStyle = System.Windows.Forms.BorderStyle.None + Me.InfoBar.Dock = System.Windows.Forms.DockStyle.Bottom + Me.InfoBar.Font = New System.Drawing.Font("Consolas", 11.0!) + Me.InfoBar.ForeColor = System.Drawing.Color.Black + Me.InfoBar.Location = New System.Drawing.Point(0, 432) + Me.InfoBar.Name = "InfoBar" + Me.InfoBar.ReadOnly = True + Me.InfoBar.Size = New System.Drawing.Size(800, 18) + Me.InfoBar.TabIndex = 0 + Me.InfoBar.Text = "Infobar" + Me.InfoBar.TextAlign = System.Windows.Forms.HorizontalAlignment.Right + ' + 'InfoBarTimer + ' + ' 'Terminal ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.BackColor = System.Drawing.Color.Red Me.ClientSize = New System.Drawing.Size(800, 450) Me.Controls.Add(Me.TextBox1) + Me.Controls.Add(Me.InfoBar) Me.Name = "Terminal" Me.Text = "Terminal" Me.ResumeLayout(False) @@ -58,4 +79,6 @@ Partial Class Terminal Friend WithEvents TextBox1 As TextBox Friend WithEvents StoryOnlyTimer As Timer + Friend WithEvents InfoBar As TextBox + Friend WithEvents InfoBarTimer As Timer End Class diff --git a/ShiftOS-TheRevival/MainForms/Terminal.resx b/ShiftOS-TheRevival/MainForms/Terminal.resx index dd16740..4224eae 100644 --- a/ShiftOS-TheRevival/MainForms/Terminal.resx +++ b/ShiftOS-TheRevival/MainForms/Terminal.resx @@ -120,4 +120,7 @@ 17, 17 + + 153, 17 + \ No newline at end of file diff --git a/ShiftOS-TheRevival/MainForms/Terminal.vb b/ShiftOS-TheRevival/MainForms/Terminal.vb index 1f11e9e..abf395a 100644 --- a/ShiftOS-TheRevival/MainForms/Terminal.vb +++ b/ShiftOS-TheRevival/MainForms/Terminal.vb @@ -9,15 +9,20 @@ Public Class Terminal Public DisplayStory As Integer Public StoryToTell As String Public ChangeInterpreter As Boolean = False - Public CurrentInterpreter As String = "Terminal" + Public CurrentInterpreter As String = "terminal" Private Sub Terminal_Load(sender As Object, e As EventArgs) Handles MyBase.Load FormBorderStyle = FormBorderStyle.None WindowState = FormWindowState.Maximized + InitializeTerminal() + End Sub + + Public Sub InitializeTerminal() If Strings.IsFree = True Then Strings.ComputerInfo(0) = "shiftos" Strings.ComputerInfo(1) = "user" 'Strings.ComputerInfo(2) = 0 + CheckFeature() PrintPrompt() AssignPrompt() Else @@ -28,6 +33,7 @@ Public Class Terminal Strings.ComputerInfo(0) = "shiftos" Strings.ComputerInfo(1) = "user" Strings.ComputerInfo(2) = 0 + CheckFeature() PrintPrompt() AssignPrompt() End If @@ -36,6 +42,20 @@ Public Class Terminal TextBox1.ScrollToCaret() End Sub + Public Sub CheckFeature() + If Strings.AvailableFeature(4) = "1" Then + InfoBarTimer.Start() + TextBox1.Dock = DockStyle.None + InfoBar.Visible = True + InfoBar.SendToBack() + TextBox1.Dock = DockStyle.Fill + Else + TextBox1.Dock = DockStyle.None + InfoBar.Visible = False + TextBox1.Dock = DockStyle.Fill + End If + End Sub + Public Sub PrintPrompt() If TextBox1.Text = Nothing Then If ChangeInterpreter = True Then @@ -130,10 +150,26 @@ Public Class Terminal TextBox1.Text = TextBox1.Text & Environment.NewLine & "SHIFTORIUM A software center for upgrading features on ShiftOS" TextBox1.Text = TextBox1.Text & Environment.NewLine & "SHUTDOWN Terminate ShiftOS session" TextBox1.Text = TextBox1.Text & Environment.NewLine & "SU Runs terminal as super user" + If Strings.AvailableFeature(5) = 1 Then + TextBox1.Text = TextBox1.Text & Environment.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 + TextBox1.Text = TextBox1.Text & Environment.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 + TextBox1.Text = TextBox1.Text & Environment.NewLine & "TIME Display the current time in the form of hours since midnight" + End If + End If + End If TextBox1.Text = TextBox1.Text & Environment.NewLine & "VER Printing current version of ShiftOS TheRevival" TextBox1.Text = TextBox1.Text & Environment.NewLine AdvancedCommand = False BadCommand = False + Case "reboot" + TextBox1.Text = Nothing + AdvancedCommand = False + BadCommand = False + InitializeTerminal() Case "su" If Strings.OnceInfo(0) = "Yes" Then TextBox1.Text = TextBox1.Text & Environment.NewLine & "You already in root mode!" @@ -146,6 +182,20 @@ Public Class Terminal Case "shutdown", "shut down" ShiftOSMenu.Show() Close() + Case "time" + If Strings.AvailableFeature(5) = "1" Then + TextBox1.Text = TextBox1.Text & Environment.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 + TextBox1.Text = TextBox1.Text & Environment.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 + TextBox1.Text = TextBox1.Text & Environment.NewLine & Math.Floor(Date.Now.Subtract(Date.Today).TotalHours) & " hours passed since midnight" + End If + End If + End If + AdvancedCommand = False + BadCommand = False Case "ver" TextBox1.Text = TextBox1.Text & Environment.NewLine & "ShiftOS TheRevival version " & My.Resources.CurrentVersion AdvancedCommand = False @@ -382,4 +432,26 @@ Public Class Terminal 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) & " |" + 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 |" + End Sub End Class \ No newline at end of file diff --git a/ShiftOS-TheRevival/MainForms/TerminalApps.vb b/ShiftOS-TheRevival/MainForms/TerminalApps.vb index 0b627c9..8d1dd25 100644 --- a/ShiftOS-TheRevival/MainForms/TerminalApps.vb +++ b/ShiftOS-TheRevival/MainForms/TerminalApps.vb @@ -30,6 +30,7 @@ Public Sub TerminateApp() Terminal.ChangeInterpreter = False + Terminal.CurrentInterpreter = "terminal" Terminal.PrintPrompt() Terminal.AssignPrompt() End Sub