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/TerminalPrompt.Designer.vb b/ShiftOS-TheRevival/MainForms/Terminal.Designer.vb similarity index 95% rename from ShiftOS-TheRevival/MainForms/TerminalPrompt.Designer.vb rename to ShiftOS-TheRevival/MainForms/Terminal.Designer.vb index f73536b..21c4b62 100644 --- a/ShiftOS-TheRevival/MainForms/TerminalPrompt.Designer.vb +++ b/ShiftOS-TheRevival/MainForms/Terminal.Designer.vb @@ -1,5 +1,5 @@  _ -Partial Class TerminalPrompt +Partial Class Terminal Inherits System.Windows.Forms.Form 'Form overrides dispose to clean up the component list. @@ -29,6 +29,7 @@ Partial Class TerminalPrompt ' 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 @@ -40,7 +41,6 @@ Partial Class TerminalPrompt ' 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" diff --git a/ShiftOS-TheRevival/MainForms/TerminalPrompt.resx b/ShiftOS-TheRevival/MainForms/Terminal.resx similarity index 100% rename from ShiftOS-TheRevival/MainForms/TerminalPrompt.resx rename to ShiftOS-TheRevival/MainForms/Terminal.resx 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.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