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 StoryToTell As String
Public ChangeInterpreter As Boolean = False Public ChangeInterpreter As Boolean = False
Public CurrentInterpreter As String = "terminal" Public CurrentInterpreter As String = "terminal"
Public CommandCache(4) As String
Private Sub Terminal_Load(sender As Object, e As EventArgs) Handles MyBase.Load Private Sub Terminal_Load(sender As Object, e As EventArgs) Handles MyBase.Load
FormBorderStyle = FormBorderStyle.None FormBorderStyle = FormBorderStyle.None
WindowState = FormWindowState.Maximized WindowState = FormWindowState.Maximized
Cursor.Hide()
InitializeTerminal() InitializeTerminal()
End Sub End Sub
@ -148,6 +148,10 @@ Public Class Terminal
If Strings.AvailableFeature(2) = 1 Then If Strings.AvailableFeature(2) = 1 Then
TextBox1.Text = TextBox1.Text & Environment.NewLine & "PRINT Prints a corresponding text entered in the command" TextBox1.Text = TextBox1.Text & Environment.NewLine & "PRINT Prints a corresponding text entered in the command"
End If 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 & "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 & "SHUTDOWN Terminate ShiftOS session"
TextBox1.Text = TextBox1.Text & Environment.NewLine & "SU Runs terminal as super user" 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 TextBox1.Text = TextBox1.Text & Environment.NewLine
AdvancedCommand = False AdvancedCommand = False
BadCommand = False BadCommand = False
Case "pause"
ChangeInterpreter = True
AppHost("pause")
AdvancedCommand = False
BadCommand = False
Case "reboot" Case "reboot"
TextBox1.Text = Nothing TextBox1.Text = Nothing
AdvancedCommand = False AdvancedCommand = False
@ -218,6 +227,7 @@ Public Class Terminal
BadCommand = False BadCommand = False
Undeveloped() Undeveloped()
Case "shutdown", "shut down" Case "shutdown", "shut down"
Cursor.Show()
ShiftOSMenu.Show() ShiftOSMenu.Show()
Close() Close()
Case "time" Case "time"
@ -287,6 +297,16 @@ Public Class Terminal
TextBox1.Text = TextBox1.Text & TempUsage & Environment.NewLine & Environment.NewLine & My.Resources.man_print & Environment.NewLine TextBox1.Text = TextBox1.Text & TempUsage & Environment.NewLine & Environment.NewLine & My.Resources.man_print & Environment.NewLine
BadCommand = False BadCommand = False
End If 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" Case "shiftorium"
TempUsage = TempUsage & "shiftorium [option] [featureName]" TempUsage = TempUsage & "shiftorium [option] [featureName]"
TextBox1.Text = TextBox1.Text & TempUsage & Environment.NewLine & Environment.NewLine & My.Resources.man_shiftorium & Environment.NewLine TextBox1.Text = TextBox1.Text & TempUsage & Environment.NewLine & Environment.NewLine & My.Resources.man_shiftorium & Environment.NewLine
@ -338,85 +358,89 @@ Public Class Terminal
End Sub End Sub
Private Sub txtterm_KeyPress(ByVal sender As Object, ByVal e As System.Windows.Forms.KeyEventArgs) Handles TextBox1.KeyDown 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 If CurrentInterpreter = "pause" Then
Me.Hide() TerminateApp()
e.SuppressKeyPress = True Else
End If If e.KeyCode = Keys.T AndAlso e.Control Then
Me.Hide()
e.SuppressKeyPress = True
End If
Select Case e.KeyCode Select Case e.KeyCode
Case Keys.ShiftKey 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 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 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 If TrackPos < 1 Then
e.SuppressKeyPress = True e.SuppressKeyPress = True
TrackPos = TrackPos - 1
Else Else
TrackPos = TrackPos - 2 If TextBox1.SelectedText.Length < 1 Then
End If TrackPos = TrackPos - 1
Case Keys.Up Else
e.SuppressKeyPress = True e.SuppressKeyPress = True
TrackPos = TrackPos - 1 End If
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
End If End If
End If End If
End If End If

View file

@ -21,7 +21,12 @@
Terminal.CurrentInterpreter = "guess" Terminal.CurrentInterpreter = "guess"
GTN_GenerateNumber() GTN_GenerateNumber()
ShouldChange = True 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.DefaultPrompt = "Navigate> "
Terminal.CurrentInterpreter = "shiftoriumfx" Terminal.CurrentInterpreter = "shiftoriumfx"
ShiftoriumFX_DisplayPackages() ShiftoriumFX_DisplayPackages()
@ -39,6 +44,7 @@
Terminal.CurrentInterpreter = "terminal" Terminal.CurrentInterpreter = "terminal"
Terminal.PrintPrompt() Terminal.PrintPrompt()
Terminal.AssignPrompt() Terminal.AssignPrompt()
Terminal.TextBox1.ReadOnly = False
End Sub End Sub
Public Sub DoChildCommand() Public Sub DoChildCommand()
@ -54,9 +60,11 @@
Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "Invalid value!" Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "Invalid value!"
End Try End Try
End Select End Select
Case "pause"
TerminateApp()
Case "shiftoriumfx" Case "shiftoriumfx"
Select Case Terminal.command Select Case Terminal.command
Case "" 'Case ""
Case "exit" Case "exit"
TerminateApp() TerminateApp()

View file

@ -70,7 +70,7 @@ Namespace My.Resources
End Property End Property
'''<summary> '''<summary>
''' Looks up a localized string similar to 0.2.1. ''' Looks up a localized string similar to 0.2.2.
'''</summary> '''</summary>
Friend ReadOnly Property CurrentVersion() As String Friend ReadOnly Property CurrentVersion() As String
Get Get
@ -128,7 +128,7 @@ Namespace My.Resources
End Property End Property
'''<summary> '''<summary>
''' Looks up a localized string similar to . ''' Looks up a localized string similar to Prints a corresponding text entered in the command.
'''</summary> '''</summary>
Friend ReadOnly Property man_print() As String Friend ReadOnly Property man_print() As String
Get Get
@ -136,6 +136,25 @@ Namespace My.Resources
End Get End Get
End Property 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> '''<summary>
''' Looks up a localized string similar to A software center for upgrading features in ShiftOS ''' 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"> <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> <value>..\resources\man manuals\print.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data> </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"> <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> <value>..\resources\man manuals\shiftorium.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8</value>
</data> </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\help.txt" />
<Content Include="Resources\man Manuals\man.txt" /> <Content Include="Resources\man Manuals\man.txt" />
<Content Include="Resources\man Manuals\print.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\shiftorium.txt" />
<Content Include="Resources\man Manuals\shutdown.txt" /> <Content Include="Resources\man Manuals\shutdown.txt" />
<Content Include="Resources\man Manuals\ver.txt" /> <Content Include="Resources\man Manuals\ver.txt" />