From 37df7b5fd4830b6f508acf7bac13a4fa8d5bb5f4 Mon Sep 17 00:00:00 2001 From: EverythingWindows Date: Thu, 3 Nov 2022 22:27:40 +0700 Subject: [PATCH] v0.2.2 stuff working on --- .../MainForms/ShiftOSUpdater.vb | 7 +- ShiftOS-TheRevival/MainForms/Strings.vb | 1 + ShiftOS-TheRevival/MainForms/Terminal.vb | 66 ++++++++++++----- ShiftOS-TheRevival/MainForms/TerminalApps.vb | 73 ++++++++++++++++++- .../My Project/Resources.Designer.vb | 20 ++++- ShiftOS-TheRevival/My Project/Resources.resx | 6 ++ .../Resources/man Manuals/clear.txt | 1 + .../Resources/man Manuals/codepoint.txt | 1 + ShiftOS-TheRevival/ShiftOS-TheRevival.vbproj | 2 + 9 files changed, 152 insertions(+), 25 deletions(-) create mode 100644 ShiftOS-TheRevival/Resources/man Manuals/clear.txt create mode 100644 ShiftOS-TheRevival/Resources/man Manuals/codepoint.txt diff --git a/ShiftOS-TheRevival/MainForms/ShiftOSUpdater.vb b/ShiftOS-TheRevival/MainForms/ShiftOSUpdater.vb index 5878577..0bc5374 100644 --- a/ShiftOS-TheRevival/MainForms/ShiftOSUpdater.vb +++ b/ShiftOS-TheRevival/MainForms/ShiftOSUpdater.vb @@ -39,7 +39,8 @@ Public Class ShiftOSUpdater End Sub - Private Sub Download_DownloadProgressChanged(ByVal sender As Object, ByVal e As DownloadProgressChangedEventArgs) Handles Download.DownloadProgressChanged - ProgressBar1.Value = e.ProgressPercentage - End Sub + 'Will revisit this later + 'Private Sub Download_DownloadProgressChanged(ByVal sender As Object, ByVal e As DownloadProgressChangedEventArgs) Handles Download.DownloadProgressChanged + ' ProgressBar1.Value = e.ProgressPercentage + 'End Sub End Class \ No newline at end of file diff --git a/ShiftOS-TheRevival/MainForms/Strings.vb b/ShiftOS-TheRevival/MainForms/Strings.vb index 593a40b..a75546e 100644 --- a/ShiftOS-TheRevival/MainForms/Strings.vb +++ b/ShiftOS-TheRevival/MainForms/Strings.vb @@ -4,6 +4,7 @@ Public Shared IsFree As Boolean Public Shared OnceInfo(0) As String Public Shared AvailableFeature(1) As String + Public Shared CLIInterpreter As String 'STRING CATEGORIZATION WRITING RULES! 'THIS IS IN ORDER TO REMAIN COMPATIBLE WITH OLDER VERSIONS! diff --git a/ShiftOS-TheRevival/MainForms/Terminal.vb b/ShiftOS-TheRevival/MainForms/Terminal.vb index 0df3815..ab7535a 100644 --- a/ShiftOS-TheRevival/MainForms/Terminal.vb +++ b/ShiftOS-TheRevival/MainForms/Terminal.vb @@ -8,6 +8,8 @@ Public Class Terminal Public BadCommand As Boolean Public DisplayStory As Integer Public StoryToTell As String + Public ChangeInterpreter As Boolean = False + Public CurrentInterpreter As String = "Terminal" Private Sub Terminal_Load(sender As Object, e As EventArgs) Handles MyBase.Load FormBorderStyle = FormBorderStyle.None @@ -36,25 +38,35 @@ Public Class Terminal Public Sub PrintPrompt() If TextBox1.Text = Nothing Then - If Strings.OnceInfo(0) = "Yes" Then - TextBox1.Text = "root@" & Strings.ComputerInfo(0) & " #> " + If ChangeInterpreter = True Then + TextBox1.Text = TextBox1.Text & Environment.NewLine & DefaultPrompt Else - TextBox1.Text = Strings.ComputerInfo(1) & "@" & Strings.ComputerInfo(0) & " $> " + If Strings.OnceInfo(0) = "Yes" Then + TextBox1.Text = "root@" & Strings.ComputerInfo(0) & " #> " + Else + TextBox1.Text = Strings.ComputerInfo(1) & "@" & Strings.ComputerInfo(0) & " $> " + End If End If Else - If Strings.OnceInfo(0) = "Yes" Then - TextBox1.Text = TextBox1.Text & Environment.NewLine & "root@" & Strings.ComputerInfo(0) & " #> " + If ChangeInterpreter = True Then + TextBox1.Text = TextBox1.Text & Environment.NewLine & DefaultPrompt Else - TextBox1.Text = TextBox1.Text & Environment.NewLine & Strings.ComputerInfo(1) & "@" & Strings.ComputerInfo(0) & " $> " + If Strings.OnceInfo(0) = "Yes" 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 If End Sub Public Sub AssignPrompt() - If Strings.OnceInfo(0) = "Yes" Then - DefaultPrompt = "root@" & Strings.ComputerInfo(0) & " #> " - Else - DefaultPrompt = Strings.ComputerInfo(1) & "@" & Strings.ComputerInfo(0) & " $> " + If ChangeInterpreter = False Then + If Strings.OnceInfo(0) = "Yes" Then + DefaultPrompt = "root@" & Strings.ComputerInfo(0) & " #> " + Else + DefaultPrompt = Strings.ComputerInfo(1) & "@" & Strings.ComputerInfo(0) & " $> " + End If End If End Sub @@ -86,8 +98,11 @@ Public Class Terminal AdvancedCommand = False BadCommand = False Case "guess" - 'AppHost("gtn") - Undeveloped() + ChangeInterpreter = True + AppHost("guess") + AdvancedCommand = False + BadCommand = False + 'Undeveloped() Case "gimme" Dim TempCP As Integer = Convert.ToInt32(Strings.ComputerInfo(2)) TempCP = TempCP + 50 @@ -149,13 +164,16 @@ Public Class Terminal Dim mancommand As String = command.Replace("man ", "") Dim TempUsage As String = "'" & mancommand & "' Usage: " Select Case mancommand + 'In process to convert every command from printing from code to printing from text file Case "clear" - TempUsage = TempUsage & "clear" - TextBox1.Text = TextBox1.Text & TempUsage & Environment.NewLine & Environment.NewLine & "Clears all contents of the terminal" & Environment.NewLine - BadCommand = False + If Strings.AvailableFeature(1) = "1" Then + TempUsage = TempUsage & "clear" + TextBox1.Text = TextBox1.Text & TempUsage & Environment.NewLine & Environment.NewLine & My.Resources.man_clear & Environment.NewLine + BadCommand = False + End If Case "codepoint" TempUsage = TempUsage & "codepoint" - TextBox1.Text = TextBox1.Text & TempUsage & Environment.NewLine & Environment.NewLine & "Shows the value of codepoint in your wallet" & Environment.NewLine + TextBox1.Text = TextBox1.Text & TempUsage & Environment.NewLine & Environment.NewLine & My.Resources.man_codepoint & Environment.NewLine BadCommand = False Case "help" TempUsage = TempUsage & "help" @@ -284,17 +302,25 @@ Public Class Terminal If e.KeyCode = Keys.Enter Then e.SuppressKeyPress = True ReadCommand() - DoCommand() - - If command = "clear" Then + If ChangeInterpreter = True Then + DoChildCommand() PrintPrompt() TextBox1.Select(TextBox1.Text.Length, 0) - Else + DoCommand() PrintPrompt() TextBox1.Select(TextBox1.Text.Length, 0) 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 diff --git a/ShiftOS-TheRevival/MainForms/TerminalApps.vb b/ShiftOS-TheRevival/MainForms/TerminalApps.vb index d89be15..0b627c9 100644 --- a/ShiftOS-TheRevival/MainForms/TerminalApps.vb +++ b/ShiftOS-TheRevival/MainForms/TerminalApps.vb @@ -1,5 +1,76 @@ Module TerminalApps - Public Sub AppHost(App As Object) + Public ShouldChange As Boolean = False + 'This is for GTN's RAM + Public TheNumber As Integer = 0 + Public Sub ChangeCP(Addition As Boolean, NeededCP As Integer) + Dim TempCP As Integer = Convert.ToInt32(Strings.ComputerInfo(2)) + If Addition = True Then + TempCP = TempCP + NeededCP + Else + TempCP = TempCP - NeededCP + End If + Strings.ComputerInfo(2) = Convert.ToString(TempCP) + End Sub + + Public Sub AppHost(App As Object) + Select Case App + Case "guess" 'Guess the Number + Terminal.DefaultPrompt = "Your answer: " + Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "Guess the Number" & Environment.NewLine & "Guess the correct number between 1 and 50 and you'll get anything between 1 to 5 Codepoints" & Environment.NewLine & "Type 'exit' to terminate this game" + Terminal.CurrentInterpreter = "guess" + GTN_GenerateNumber() + ShouldChange = True + End Select + If ShouldChange = True Then + Terminal.ChangeInterpreter = True + ShouldChange = False + End If + End Sub + + Public Sub TerminateApp() + Terminal.ChangeInterpreter = False + Terminal.PrintPrompt() + Terminal.AssignPrompt() + End Sub + + Public Sub DoChildCommand() + Select Case Terminal.CurrentInterpreter + Case "guess" + Select Case Terminal.command + Case "exit" + TerminateApp() + Case Else + Try + GTN_CheckNumber() + Catch ex As Exception + Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "Invalid value!" + End Try + End Select + End Select + End Sub + + Public Sub GTN_GenerateNumber() + Dim RandNum As New Random + TheNumber = RandNum.Next(1, 51) + End Sub + + Public Sub GTN_CheckNumber() + Dim TheirNumber As Integer = Convert.ToInt32(Terminal.command) + If TheirNumber > 0 And TheirNumber < 51 Then + If TheirNumber = TheNumber Then + Dim GetCP As New Random + Dim GotCP As Integer = GetCP.Next(1, 6) + ChangeCP(True, GotCP) + Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "You are correct!, you got " & GotCP & " Codepoint(s)" & Environment.NewLine & "Guess the new number between 1 and 50." + GTN_GenerateNumber() + Else + If TheirNumber < TheNumber Then + Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "Higher!" + ElseIf TheirNumber > TheNumber Then + Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "Lower!" + End If + End If + End If End Sub End Module diff --git a/ShiftOS-TheRevival/My Project/Resources.Designer.vb b/ShiftOS-TheRevival/My Project/Resources.Designer.vb index 62a3fe0..b1c515d 100644 --- a/ShiftOS-TheRevival/My Project/Resources.Designer.vb +++ b/ShiftOS-TheRevival/My Project/Resources.Designer.vb @@ -70,12 +70,30 @@ Namespace My.Resources End Property ''' - ''' Looks up a localized string similar to 0.2.0. + ''' Looks up a localized string similar to 0.2.1. ''' Friend ReadOnly Property CurrentVersion() As String Get Return ResourceManager.GetString("CurrentVersion", resourceCulture) End Get End Property + + ''' + ''' Looks up a localized string similar to Clears all contents of the terminal. + ''' + Friend ReadOnly Property man_clear() As String + Get + Return ResourceManager.GetString("man_clear", resourceCulture) + End Get + End Property + + ''' + ''' Looks up a localized string similar to Shows the value of codepoint in your wallet. + ''' + Friend ReadOnly Property man_codepoint() As String + Get + Return ResourceManager.GetString("man_codepoint", resourceCulture) + End Get + End Property End Module End Namespace diff --git a/ShiftOS-TheRevival/My Project/Resources.resx b/ShiftOS-TheRevival/My Project/Resources.resx index c74daae..66c67b0 100644 --- a/ShiftOS-TheRevival/My Project/Resources.resx +++ b/ShiftOS-TheRevival/My Project/Resources.resx @@ -124,4 +124,10 @@ ..\Resources\CurrentVersion.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;Windows-1252 + + ..\resources\man manuals\clear.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 + + + ..\resources\man manuals\codepoint.txt;System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089;utf-8 + \ No newline at end of file diff --git a/ShiftOS-TheRevival/Resources/man Manuals/clear.txt b/ShiftOS-TheRevival/Resources/man Manuals/clear.txt new file mode 100644 index 0000000..e53593e --- /dev/null +++ b/ShiftOS-TheRevival/Resources/man Manuals/clear.txt @@ -0,0 +1 @@ +Clears all contents of the terminal \ No newline at end of file diff --git a/ShiftOS-TheRevival/Resources/man Manuals/codepoint.txt b/ShiftOS-TheRevival/Resources/man Manuals/codepoint.txt new file mode 100644 index 0000000..d1e8721 --- /dev/null +++ b/ShiftOS-TheRevival/Resources/man Manuals/codepoint.txt @@ -0,0 +1 @@ +Shows the value of codepoint in your wallet \ No newline at end of file diff --git a/ShiftOS-TheRevival/ShiftOS-TheRevival.vbproj b/ShiftOS-TheRevival/ShiftOS-TheRevival.vbproj index d03e8c9..f847f01 100644 --- a/ShiftOS-TheRevival/ShiftOS-TheRevival.vbproj +++ b/ShiftOS-TheRevival/ShiftOS-TheRevival.vbproj @@ -195,6 +195,8 @@ + +