PAUSE function

This commit is contained in:
EverythingWindows 2022-11-05 06:27:35 +07:00
parent 60b6ce686d
commit 06623f4cb1
7 changed files with 140 additions and 78 deletions

View file

@ -10,11 +10,11 @@ Public Class Terminal
Public StoryToTell As String
Public ChangeInterpreter As Boolean = False
Public CurrentInterpreter As String = "terminal"
Public CommandCache(4) As String
Private Sub Terminal_Load(sender As Object, e As EventArgs) Handles MyBase.Load
FormBorderStyle = FormBorderStyle.None
WindowState = FormWindowState.Maximized
Cursor.Hide()
InitializeTerminal()
End Sub
@ -148,6 +148,10 @@ Public Class Terminal
If Strings.AvailableFeature(2) = 1 Then
TextBox1.Text = TextBox1.Text & Environment.NewLine & "PRINT Prints a corresponding text entered in the command"
End If
TextBox1.Text = TextBox1.Text & Environment.NewLine & "REBOOT Terminate and re-run ShiftOS session"
If Strings.AvailableFeature(8) = 1 Then
TextBox1.Text = TextBox1.Text & Environment.NewLine & "SHIFTFETCH Shows informations about your computer"
End If
TextBox1.Text = TextBox1.Text & Environment.NewLine & "SHIFTORIUM A software center for upgrading features on ShiftOS"
TextBox1.Text = TextBox1.Text & Environment.NewLine & "SHUTDOWN Terminate ShiftOS session"
TextBox1.Text = TextBox1.Text & Environment.NewLine & "SU Runs terminal as super user"
@ -166,6 +170,11 @@ Public Class Terminal
TextBox1.Text = TextBox1.Text & Environment.NewLine
AdvancedCommand = False
BadCommand = False
Case "pause"
ChangeInterpreter = True
AppHost("pause")
AdvancedCommand = False
BadCommand = False
Case "reboot"
TextBox1.Text = Nothing
AdvancedCommand = False
@ -218,6 +227,7 @@ Public Class Terminal
BadCommand = False
Undeveloped()
Case "shutdown", "shut down"
Cursor.Show()
ShiftOSMenu.Show()
Close()
Case "time"
@ -287,6 +297,16 @@ Public Class Terminal
TextBox1.Text = TextBox1.Text & TempUsage & Environment.NewLine & Environment.NewLine & My.Resources.man_print & Environment.NewLine
BadCommand = False
End If
Case "reboot"
TempUsage = TempUsage & "reboot"
TextBox1.Text = TextBox1.Text & TempUsage & Environment.NewLine & Environment.NewLine & My.Resources.man_reboot & Environment.NewLine
BadCommand = False
Case "shiftfetch"
If Strings.AvailableFeature(8) = "1" Then
TempUsage = TempUsage & "shiftfetch"
TextBox1.Text = TextBox1.Text & TempUsage & Environment.NewLine & Environment.NewLine & My.Resources.man_shiftfetch & Environment.NewLine
BadCommand = False
End If
Case "shiftorium"
TempUsage = TempUsage & "shiftorium [option] [featureName]"
TextBox1.Text = TextBox1.Text & TempUsage & Environment.NewLine & Environment.NewLine & My.Resources.man_shiftorium & Environment.NewLine
@ -338,85 +358,89 @@ Public Class Terminal
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
If CurrentInterpreter = "pause" Then
TerminateApp()
Else
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
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
If TextBox1.ReadOnly = True Then
Else
ReadCommand()
If ChangeInterpreter = True Then
DoChildCommand()
PrintPrompt()
TextBox1.Select(TextBox1.Text.Length, 0)
Else
DoCommand()
PrintPrompt()
TextBox1.Select(TextBox1.Text.Length, 0)
End If
End If
Case Keys.Left
'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
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
If TextBox1.ReadOnly = True Then
Else
ReadCommand()
If ChangeInterpreter = True Then
DoChildCommand()
PrintPrompt()
TextBox1.Select(TextBox1.Text.Length, 0)
Else
DoCommand()
PrintPrompt()
TextBox1.Select(TextBox1.Text.Length, 0)
End If
End If
'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
If TextBox1.SelectedText.Length < 1 Then
TrackPos = TrackPos - 1
Else
e.SuppressKeyPress = True
End If
End If
End If
End If

View file

@ -21,7 +21,12 @@
Terminal.CurrentInterpreter = "guess"
GTN_GenerateNumber()
ShouldChange = True
Case "shiftoriumfx"
Case "pause" 'Pause function
Terminal.DefaultPrompt = "Press any key to continue..."
Terminal.CurrentInterpreter = "pause"
Terminal.TextBox1.ReadOnly = True
ShouldChange = True
Case "shiftoriumfx" 'ShiftoriumFX : Advanced Shiftorium
Terminal.DefaultPrompt = "Navigate> "
Terminal.CurrentInterpreter = "shiftoriumfx"
ShiftoriumFX_DisplayPackages()
@ -39,6 +44,7 @@
Terminal.CurrentInterpreter = "terminal"
Terminal.PrintPrompt()
Terminal.AssignPrompt()
Terminal.TextBox1.ReadOnly = False
End Sub
Public Sub DoChildCommand()
@ -54,9 +60,11 @@
Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "Invalid value!"
End Try
End Select
Case "pause"
TerminateApp()
Case "shiftoriumfx"
Select Case Terminal.command
Case ""
'Case ""
Case "exit"
TerminateApp()

View file

@ -70,7 +70,7 @@ Namespace My.Resources
End Property
'''<summary>
''' Looks up a localized string similar to 0.2.1.
''' Looks up a localized string similar to 0.2.2.
'''</summary>
Friend ReadOnly Property CurrentVersion() As String
Get
@ -128,7 +128,7 @@ Namespace My.Resources
End Property
'''<summary>
''' Looks up a localized string similar to .
''' Looks up a localized string similar to Prints a corresponding text entered in the command.
'''</summary>
Friend ReadOnly Property man_print() As String
Get
@ -136,6 +136,25 @@ Namespace My.Resources
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Terminate ShiftOS session and re-running the session.
'''</summary>
Friend ReadOnly Property man_reboot() As String
Get
Return ResourceManager.GetString("man_reboot", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to Command-line system information tool for ShiftOS
'''Ported from Neofetch.
'''</summary>
Friend ReadOnly Property man_shiftfetch() As String
Get
Return ResourceManager.GetString("man_shiftfetch", resourceCulture)
End Get
End Property
'''<summary>
''' Looks up a localized string similar to A software center for upgrading features in ShiftOS
'''

View file

@ -142,6 +142,12 @@
<data name="man_print" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\man manuals\print.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="man_reboot" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\man manuals\reboot.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="man_shiftfetch" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\man manuals\shiftfetch.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>
<data name="man_shiftorium" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\resources\man manuals\shiftorium.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data>

View file

@ -0,0 +1 @@
Terminate ShiftOS session and re-running the session

View file

@ -0,0 +1,2 @@
Command-line system information tool for ShiftOS
Ported from Neofetch

View file

@ -202,6 +202,8 @@
<Content Include="Resources\man Manuals\help.txt" />
<Content Include="Resources\man Manuals\man.txt" />
<Content Include="Resources\man Manuals\print.txt" />
<Content Include="Resources\man Manuals\reboot.txt" />
<Content Include="Resources\man Manuals\shiftfetch.txt" />
<Content Include="Resources\man Manuals\shiftorium.txt" />
<Content Include="Resources\man Manuals\shutdown.txt" />
<Content Include="Resources\man Manuals\ver.txt" />