mirror of
https://github.com/EverythingWindows/ShiftOS-TheRevival-Old.git
synced 2025-01-22 18:02:16 +00:00
0.1 final code
This commit is contained in:
parent
38b51f3f1d
commit
cbc32f3aba
7 changed files with 137 additions and 41 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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"
|
124
ShiftOS-TheRevival/MainForms/Terminal.vb
Normal file
124
ShiftOS-TheRevival/MainForms/Terminal.vb
Normal file
|
@ -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
|
|
@ -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
|
|
@ -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>
|
||||
|
|
Loading…
Reference in a new issue