From cbc32f3aba8114e1bf2bc2d1db75a7056e5e575a Mon Sep 17 00:00:00 2001 From: EverythingWindows Date: Wed, 2 Nov 2022 05:57:27 +0700 Subject: 0.1 final code --- ShiftOS-TheRevival/MainForms/ShiftOSMenu.vb | 5 +- ShiftOS-TheRevival/MainForms/Strings.vb | 8 +- ShiftOS-TheRevival/MainForms/Terminal.Designer.vb | 54 +++++++++ ShiftOS-TheRevival/MainForms/Terminal.resx | 120 ++++++++++++++++++++ ShiftOS-TheRevival/MainForms/Terminal.vb | 124 +++++++++++++++++++++ .../MainForms/TerminalPrompt.Designer.vb | 54 --------- ShiftOS-TheRevival/MainForms/TerminalPrompt.resx | 120 -------------------- ShiftOS-TheRevival/MainForms/TerminalPrompt.vb | 27 ----- ShiftOS-TheRevival/ShiftOS-TheRevival.vbproj | 10 +- 9 files changed, 309 insertions(+), 213 deletions(-) create mode 100644 ShiftOS-TheRevival/MainForms/Terminal.Designer.vb create mode 100644 ShiftOS-TheRevival/MainForms/Terminal.resx create mode 100644 ShiftOS-TheRevival/MainForms/Terminal.vb delete mode 100644 ShiftOS-TheRevival/MainForms/TerminalPrompt.Designer.vb delete mode 100644 ShiftOS-TheRevival/MainForms/TerminalPrompt.resx delete mode 100644 ShiftOS-TheRevival/MainForms/TerminalPrompt.vb diff --git a/ShiftOS-TheRevival/MainForms/ShiftOSMenu.vb b/ShiftOS-TheRevival/MainForms/ShiftOSMenu.vb index d669242..eba98ed 100644 --- a/ShiftOS-TheRevival/MainForms/ShiftOSMenu.vb +++ b/ShiftOS-TheRevival/MainForms/ShiftOSMenu.vb @@ -18,6 +18,7 @@ Public Class Form1 lbl_BuildString.Text = ActualBuildLab Catch ex As Exception MsgBox("Why? Because of " & ex.Message) + lbl_BuildString.Text = ActualBuildLab End Try End Sub @@ -27,8 +28,8 @@ Public Class Form1 Private Sub btn_FreeRoam_Click(sender As Object, e As EventArgs) Handles btn_FreeRoam.Click Try - Strings.GameState(0) = "Free" - TerminalPrompt.Show() + Strings.IsFree = True + Terminal.Show() Close() Catch ex As Exception Dim NewBugSlap As New BugSlap diff --git a/ShiftOS-TheRevival/MainForms/Strings.vb b/ShiftOS-TheRevival/MainForms/Strings.vb index 15303d2..96285a5 100644 --- a/ShiftOS-TheRevival/MainForms/Strings.vb +++ b/ShiftOS-TheRevival/MainForms/Strings.vb @@ -1,8 +1,8 @@ Public Class Strings Public Shared OSInfo() As String - Public Shared ComputerInfo() As String - Public Shared GameState() As String - Public Shared OnceInfo() As String + Public Shared ComputerInfo(1) As String + Public Shared IsFree As Boolean + Public Shared OnceInfo(0) As String 'STRING CATEGORIZATION WRITING RULES! 'THIS IS IN ORDER TO REMAIN COMPATIBLE WITH OLDER VERSIONS! @@ -30,6 +30,4 @@ '0 = Computer Name (default : shiftos) '1 = Username (default : user) ' - 'GameState Strings: - '0 = Playing Mode (default : Story) End Class diff --git a/ShiftOS-TheRevival/MainForms/Terminal.Designer.vb b/ShiftOS-TheRevival/MainForms/Terminal.Designer.vb new file mode 100644 index 0000000..21c4b62 --- /dev/null +++ b/ShiftOS-TheRevival/MainForms/Terminal.Designer.vb @@ -0,0 +1,54 @@ + _ +Partial Class Terminal + Inherits System.Windows.Forms.Form + + 'Form overrides dispose to clean up the component list. + _ + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. + _ + Private Sub InitializeComponent() + Me.TextBox1 = New System.Windows.Forms.TextBox() + Me.SuspendLayout() + ' + 'TextBox1 + ' + Me.TextBox1.BackColor = System.Drawing.Color.Black + 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.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.TabIndex = 0 + ' + 'Terminal + ' + Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) + Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.ClientSize = New System.Drawing.Size(800, 450) + Me.Controls.Add(Me.TextBox1) + Me.Name = "Terminal" + Me.Text = "Terminal" + Me.ResumeLayout(False) + Me.PerformLayout() + + End Sub + + Friend WithEvents TextBox1 As TextBox +End Class diff --git a/ShiftOS-TheRevival/MainForms/Terminal.resx b/ShiftOS-TheRevival/MainForms/Terminal.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/ShiftOS-TheRevival/MainForms/Terminal.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/ShiftOS-TheRevival/MainForms/Terminal.vb b/ShiftOS-TheRevival/MainForms/Terminal.vb new file mode 100644 index 0000000..aa88625 --- /dev/null +++ b/ShiftOS-TheRevival/MainForms/Terminal.vb @@ -0,0 +1,124 @@ +Public Class Terminal + Public command As String + Public DefaultPrompt As String + Public TrackPos As Integer + + Private Sub Terminal_Load(sender As Object, e As EventArgs) Handles MyBase.Load + FormBorderStyle = FormBorderStyle.None + WindowState = FormWindowState.Maximized + If Strings.IsFree = True Then + Strings.ComputerInfo(0) = "shiftos" + Strings.ComputerInfo(1) = "user" + PrintPrompt() + AssignPrompt() + End If + End Sub + + Public Sub PrintPrompt() + If TextBox1.Text = Nothing Then + If Strings.OnceInfo(0) = "No" Then + TextBox1.Text = "root@" & Strings.ComputerInfo(0) & " #> " + Else + TextBox1.Text = Strings.ComputerInfo(1) & "@" & Strings.ComputerInfo(0) & " $> " + End If + Else + If Strings.OnceInfo(0) = "No" Then + TextBox1.Text = TextBox1.Text & Environment.NewLine & "root@" & Strings.ComputerInfo(0) & " #> " + Else + TextBox1.Text = TextBox1.Text & Environment.NewLine & Strings.ComputerInfo(1) & "@" & Strings.ComputerInfo(0) & " $> " + End If + End If + End Sub + + Public Sub AssignPrompt() + If Strings.OnceInfo(0) = "No" Then + DefaultPrompt = "root@" & Strings.ComputerInfo(0) & " #> " + Else + DefaultPrompt = Strings.ComputerInfo(1) & "@" & Strings.ComputerInfo(0) & " $> " + End If + End Sub + + Private Sub ReadCommand() + command = TextBox1.Lines(TextBox1.Lines.Length - 1) + command = command.Replace(DefaultPrompt, "") + command = command.ToLower() + End Sub + + Private Sub txtterm_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown + If e.KeyCode = Keys.T AndAlso e.Control Then + Me.Hide() + e.SuppressKeyPress = True + End If + + Select Case e.KeyCode + Case Keys.ShiftKey + TrackPos = TrackPos - 1 + Case Keys.Alt + TrackPos = TrackPos - 1 + Case Keys.CapsLock + TrackPos = TrackPos - 1 + Case Keys.ControlKey + TrackPos = TrackPos - 1 + Case Keys.LWin + TrackPos = TrackPos - 1 + Case Keys.RWin + TrackPos = TrackPos - 1 + Case Keys.Right + If TextBox1.SelectionStart = TextBox1.TextLength Then + TrackPos = TrackPos - 1 + End If + Case Keys.Left + If TrackPos < 1 Then + e.SuppressKeyPress = True + TrackPos = TrackPos - 1 + Else + TrackPos = TrackPos - 2 + End If + Case Keys.Up + e.SuppressKeyPress = True + TrackPos = TrackPos - 1 + Case Keys.Down + e.SuppressKeyPress = True + TrackPos = TrackPos - 1 + End Select + + If e.KeyCode = Keys.Enter Then + e.SuppressKeyPress = True + ReadCommand() + 'DoCommand() + + If command = "clear" Then + PrintPrompt() + TextBox1.Select(TextBox1.Text.Length, 0) + + Else + PrintPrompt() + TextBox1.Select(TextBox1.Text.Length, 0) + End If + + TrackPos = 0 + 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 + End Sub + + Private Sub TextBox1_Click(sender As Object, e As EventArgs) Handles TextBox1.Click, TextBox1.MouseDoubleClick + TextBox1.Select(TextBox1.TextLength, 0) + TextBox1.ScrollToCaret() + End Sub +End Class \ No newline at end of file diff --git a/ShiftOS-TheRevival/MainForms/TerminalPrompt.Designer.vb b/ShiftOS-TheRevival/MainForms/TerminalPrompt.Designer.vb deleted file mode 100644 index f73536b..0000000 --- a/ShiftOS-TheRevival/MainForms/TerminalPrompt.Designer.vb +++ /dev/null @@ -1,54 +0,0 @@ - _ -Partial Class TerminalPrompt - Inherits System.Windows.Forms.Form - - 'Form overrides dispose to clean up the component list. - _ - Protected Overrides Sub Dispose(ByVal disposing As Boolean) - Try - If disposing AndAlso components IsNot Nothing Then - components.Dispose() - End If - Finally - MyBase.Dispose(disposing) - End Try - End Sub - - 'Required by the Windows Form Designer - Private components As System.ComponentModel.IContainer - - 'NOTE: The following procedure is required by the Windows Form Designer - 'It can be modified using the Windows Form Designer. - 'Do not modify it using the code editor. - _ - Private Sub InitializeComponent() - Me.TextBox1 = New System.Windows.Forms.TextBox() - Me.SuspendLayout() - ' - 'TextBox1 - ' - Me.TextBox1.BackColor = System.Drawing.Color.Black - Me.TextBox1.Dock = System.Windows.Forms.DockStyle.Fill - Me.TextBox1.ForeColor = System.Drawing.Color.Silver - 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.TabIndex = 0 - ' - 'Terminal - ' - Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) - Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.BackColor = System.Drawing.Color.Black - Me.ClientSize = New System.Drawing.Size(800, 450) - Me.Controls.Add(Me.TextBox1) - Me.Name = "Terminal" - Me.Text = "Terminal" - Me.ResumeLayout(False) - Me.PerformLayout() - - End Sub - - Friend WithEvents TextBox1 As TextBox -End Class diff --git a/ShiftOS-TheRevival/MainForms/TerminalPrompt.resx b/ShiftOS-TheRevival/MainForms/TerminalPrompt.resx deleted file mode 100644 index 1af7de1..0000000 --- a/ShiftOS-TheRevival/MainForms/TerminalPrompt.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/ShiftOS-TheRevival/MainForms/TerminalPrompt.vb b/ShiftOS-TheRevival/MainForms/TerminalPrompt.vb deleted file mode 100644 index b86e071..0000000 --- a/ShiftOS-TheRevival/MainForms/TerminalPrompt.vb +++ /dev/null @@ -1,27 +0,0 @@ -Public Class TerminalPrompt - Private Sub Terminal_Load(sender As Object, e As EventArgs) Handles MyBase.Load - FormBorderStyle = FormBorderStyle.None - WindowState = FormWindowState.Maximized - If Strings.GameState(0) = "Free" Then - Strings.ComputerInfo(0) = "shiftos" - Strings.ComputerInfo(1) = "user" - PrintPrompt() - End If - End Sub - - Public Sub PrintPrompt() - If TextBox1.Text = Nothing Then - If Strings.OnceInfo(0) = "No" Then - TextBox1.Text = "root@" & Strings.ComputerInfo(0) & " #> " - Else - TextBox1.Text = Strings.ComputerInfo(1) & "@" & Strings.ComputerInfo(0) & " $> " - End If - Else - If Strings.OnceInfo(0) = "No" Then - TextBox1.Text = TextBox1.Text & Environment.NewLine & "root@" & Strings.ComputerInfo(0) & " #> " - Else - TextBox1.Text = TextBox1.Text & Environment.NewLine & Strings.ComputerInfo(1) & "@" & Strings.ComputerInfo(0) & " $> " - End If - End If - End Sub -End Class \ No newline at end of file diff --git a/ShiftOS-TheRevival/ShiftOS-TheRevival.vbproj b/ShiftOS-TheRevival/ShiftOS-TheRevival.vbproj index 43de5df..2c7264c 100644 --- a/ShiftOS-TheRevival/ShiftOS-TheRevival.vbproj +++ b/ShiftOS-TheRevival/ShiftOS-TheRevival.vbproj @@ -86,10 +86,10 @@ Form - - TerminalPrompt.vb + + Terminal.vb - + Form @@ -113,8 +113,8 @@ BugSlap.vb - - TerminalPrompt.vb + + Terminal.vb VbMyResourcesResXFileCodeGenerator -- cgit v1.2.3