From e17103c363ce30c2baa6f3795177a4eeae1e535a Mon Sep 17 00:00:00 2001 From: EverythingWindows Date: Sun, 6 Nov 2022 21:19:35 +0700 Subject: [PATCH] dir fixing and stuff --- .../MainForms/DirectoryManagements.vb | 1 + ShiftOS-TheRevival/MainForms/FileManagement.vb | 10 ++++++++++ ShiftOS-TheRevival/MainForms/Terminal.vb | 13 +++++++++++++ ShiftOS-TheRevival/ShiftOS-TheRevival.vbproj | 1 + 4 files changed, 25 insertions(+) create mode 100644 ShiftOS-TheRevival/MainForms/FileManagement.vb diff --git a/ShiftOS-TheRevival/MainForms/DirectoryManagements.vb b/ShiftOS-TheRevival/MainForms/DirectoryManagements.vb index ff8a3b1..4179e6f 100644 --- a/ShiftOS-TheRevival/MainForms/DirectoryManagements.vb +++ b/ShiftOS-TheRevival/MainForms/DirectoryManagements.vb @@ -1,6 +1,7 @@ Module DirectoryManagements Dim spaces As String Public Sub TerminalDirectories(TheDirectory As String) + Terminal.Pseudodir = TheDirectory.Replace(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\ShiftFS", "!") Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "Contents of " & Terminal.Pseudodir & Environment.NewLine Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "[DIR] 0 KB ." Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "[DIR] 0 KB .." diff --git a/ShiftOS-TheRevival/MainForms/FileManagement.vb b/ShiftOS-TheRevival/MainForms/FileManagement.vb new file mode 100644 index 0000000..b943fba --- /dev/null +++ b/ShiftOS-TheRevival/MainForms/FileManagement.vb @@ -0,0 +1,10 @@ +Imports System.IO + +Module FileManagement + Public Sub CatFile(filename As String) + If File.Exists(Terminal.CurrentDirectory & "\" & filename) = True Then + Dim Contents As String = File.ReadAllText(Terminal.CurrentDirectory & "\" & filename) + Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & Contents + End If + End Sub +End Module diff --git a/ShiftOS-TheRevival/MainForms/Terminal.vb b/ShiftOS-TheRevival/MainForms/Terminal.vb index ac7d521..c4a4e7b 100644 --- a/ShiftOS-TheRevival/MainForms/Terminal.vb +++ b/ShiftOS-TheRevival/MainForms/Terminal.vb @@ -180,6 +180,16 @@ Public Class Terminal TerminalDirectories(CurrentDirectory) AdvancedCommand = False BadCommand = False + Case "exit su" + If Strings.OnceInfo(0) = "No" Then + + Else + AdvancedCommand = False + BadCommand = False + TextBox1.Text = TextBox1.Text & Environment.NewLine & "Exitting root mode..." + Strings.OnceInfo(0) = "No" + AssignPrompt() + End If Case "guess" ChangeInterpreter = True AppHost("guess", False) @@ -335,6 +345,9 @@ Public Class Terminal End Select If AdvancedCommand = True Then + If command Like "cat *" Then + CatFile(command.Substring(4)) + End If If command Like "cd *" Then NavigateDir(command.Replace("cd ", "")) AdvancedCommand = False diff --git a/ShiftOS-TheRevival/ShiftOS-TheRevival.vbproj b/ShiftOS-TheRevival/ShiftOS-TheRevival.vbproj index 74d2e24..5a8ad98 100644 --- a/ShiftOS-TheRevival/ShiftOS-TheRevival.vbproj +++ b/ShiftOS-TheRevival/ShiftOS-TheRevival.vbproj @@ -100,6 +100,7 @@ Form + IntroStory.vb