summaryrefslogtreecommitdiff
path: root/ShiftOS-TheRevival/MainForms
diff options
context:
space:
mode:
authorEverythingWindows <[email protected]>2022-11-02 05:57:27 +0700
committerEverythingWindows <[email protected]>2022-11-02 05:57:27 +0700
commitcbc32f3aba8114e1bf2bc2d1db75a7056e5e575a (patch)
tree9633115212854a9d2a7b3c7648ff9d53e3cdec4d /ShiftOS-TheRevival/MainForms
parent38b51f3f1dc8dc046b6c3bf80d5fe2885ff38a3c (diff)
downloadshiftos-therevival-old-0.1.tar.gz
shiftos-therevival-old-0.1.tar.bz2
shiftos-therevival-old-0.1.zip
0.1 final code0.1.10.1
Diffstat (limited to 'ShiftOS-TheRevival/MainForms')
-rw-r--r--ShiftOS-TheRevival/MainForms/ShiftOSMenu.vb5
-rw-r--r--ShiftOS-TheRevival/MainForms/Strings.vb8
-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.vb124
-rw-r--r--ShiftOS-TheRevival/MainForms/TerminalPrompt.vb27
6 files changed, 132 insertions, 36 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