diff options
| author | EverythingWindows <[email protected]> | 2022-11-02 05:57:27 +0700 |
|---|---|---|
| committer | EverythingWindows <[email protected]> | 2022-11-02 05:57:27 +0700 |
| commit | cbc32f3aba8114e1bf2bc2d1db75a7056e5e575a (patch) | |
| tree | 9633115212854a9d2a7b3c7648ff9d53e3cdec4d /ShiftOS-TheRevival | |
| parent | 38b51f3f1dc8dc046b6c3bf80d5fe2885ff38a3c (diff) | |
| download | shiftos-therevival-old-0.1.tar.gz shiftos-therevival-old-0.1.tar.bz2 shiftos-therevival-old-0.1.zip | |
Diffstat (limited to 'ShiftOS-TheRevival')
| -rw-r--r-- | ShiftOS-TheRevival/MainForms/ShiftOSMenu.vb | 5 | ||||
| -rw-r--r-- | ShiftOS-TheRevival/MainForms/Strings.vb | 8 | ||||
| -rw-r--r-- | ShiftOS-TheRevival/MainForms/Terminal.Designer.vb (renamed from ShiftOS-TheRevival/MainForms/TerminalPrompt.Designer.vb) | 4 | ||||
| -rw-r--r-- | ShiftOS-TheRevival/MainForms/Terminal.resx (renamed from ShiftOS-TheRevival/MainForms/TerminalPrompt.resx) | 0 | ||||
| -rw-r--r-- | ShiftOS-TheRevival/MainForms/Terminal.vb | 124 | ||||
| -rw-r--r-- | ShiftOS-TheRevival/MainForms/TerminalPrompt.vb | 27 | ||||
| -rw-r--r-- | ShiftOS-TheRevival/ShiftOS-TheRevival.vbproj | 10 |
7 files changed, 137 insertions, 41 deletions
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 index f73536b..21c4b62 100644 --- a/ShiftOS-TheRevival/MainForms/TerminalPrompt.Designer.vb +++ b/ShiftOS-TheRevival/MainForms/Terminal.Designer.vb @@ -1,5 +1,5 @@ <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _ -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 index 1af7de1..1af7de1 100644 --- a/ShiftOS-TheRevival/MainForms/TerminalPrompt.resx +++ b/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 @@ <SubType>Form</SubType> </Compile> <Compile Include="MainForms\Strings.vb" /> - <Compile Include="MainForms\TerminalPrompt.Designer.vb"> - <DependentUpon>TerminalPrompt.vb</DependentUpon> + <Compile Include="MainForms\Terminal.Designer.vb"> + <DependentUpon>Terminal.vb</DependentUpon> </Compile> - <Compile Include="MainForms\TerminalPrompt.vb"> + <Compile Include="MainForms\Terminal.vb"> <SubType>Form</SubType> </Compile> <Compile Include="My Project\AssemblyInfo.vb" /> @@ -113,8 +113,8 @@ <EmbeddedResource Include="MainForms\BugSlap.resx"> <DependentUpon>BugSlap.vb</DependentUpon> </EmbeddedResource> - <EmbeddedResource Include="MainForms\TerminalPrompt.resx"> - <DependentUpon>TerminalPrompt.vb</DependentUpon> + <EmbeddedResource Include="MainForms\Terminal.resx"> + <DependentUpon>Terminal.vb</DependentUpon> </EmbeddedResource> <EmbeddedResource Include="My Project\Resources.resx"> <Generator>VbMyResourcesResXFileCodeGenerator</Generator> |
