dir command done

This commit is contained in:
EverythingWindows 2022-11-06 15:20:38 +07:00
parent 8e4b29c5a5
commit 8b5d4344f7
7 changed files with 58 additions and 23 deletions

View file

@ -0,0 +1,11 @@
Module DirectoryManagements
Public Sub TerminalDirectories(TheDirectory As String)
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 .."
For Each Dir As String In IO.Directory.GetDirectories(TheDirectory)
Dim dirinf As New IO.DirectoryInfo(Dir)
Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "[DIR] 0 KB " & dirinf.Name
Next
End Sub
End Module

View file

@ -106,8 +106,8 @@ Public Class ShiftOSMenu
End Sub End Sub
Private Sub CheckInstall() Private Sub CheckInstall()
If Directory.Exists(My.Computer.FileSystem.SpecialDirectories.Temp & "\ShiftOS\ShiftFS") = True Then If Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\ShiftFS") = True Then
Dim WhatVersion As String = File.ReadAllText(My.Computer.FileSystem.SpecialDirectories.Temp & "\ShiftOS\version.txt") Dim WhatVersion As String = File.ReadAllText(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\version.txt")
If WhatVersion = My.Resources.CurrentVersion Then If WhatVersion = My.Resources.CurrentVersion Then
Else Else
@ -119,8 +119,8 @@ Public Class ShiftOSMenu
ShiftOSUpdater.Show() ShiftOSUpdater.Show()
End If End If
Else Else
If Directory.Exists(My.Computer.FileSystem.SpecialDirectories.Temp & "\ShiftOS") = True Then If Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS") = True Then
If Directory.Exists(My.Computer.FileSystem.SpecialDirectories.Temp & "\ShiftOS\ShiftFS") = True Then If Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\ShiftFS") = True Then
Directory.CreateDirectory(My.Computer.FileSystem.GetTempFileName & "\ShiftOS\ShiftFS") Directory.CreateDirectory(My.Computer.FileSystem.GetTempFileName & "\ShiftOS\ShiftFS")
End If End If
Else Else

View file

@ -2,7 +2,7 @@
Public Shared OSInfo() As String Public Shared OSInfo() As String
Public Shared ComputerInfo(4) As String Public Shared ComputerInfo(4) As String
Public Shared IsFree As Boolean Public Shared IsFree As Boolean
Public Shared OnceInfo(2) As String Public Shared OnceInfo(4) As String
Public Shared AvailableFeature(15) As String Public Shared AvailableFeature(15) As String
Public Shared CLIInterpreter As String Public Shared CLIInterpreter As String
Public Shared SaveFile As String Public Shared SaveFile As String
@ -31,6 +31,7 @@
'1 = RootDirectory (0.2.3) (default : My.Computer.FileSystem.SpecialDirectories.Temp & "\ShiftOS\ShiftFS\") '1 = RootDirectory (0.2.3) (default : My.Computer.FileSystem.SpecialDirectories.Temp & "\ShiftOS\ShiftFS\")
'2 = Infobar Boolean (0.2.3) (default : True) '2 = Infobar Boolean (0.2.3) (default : True)
'3 = Color for Terminal (0.2.3) (default : 0F) '3 = Color for Terminal (0.2.3) (default : 0F)
'4 = RootDirectoryString (0.2.3) (default : !)
' '
'ComputerInfo Strings: 'ComputerInfo Strings:
'0 = Computer Name (0.1) (default : shiftos) '0 = Computer Name (0.1) (default : shiftos)

View file

@ -11,6 +11,7 @@ Public Class Terminal
Public ChangeInterpreter As Boolean = False Public ChangeInterpreter As Boolean = False
Public CurrentInterpreter As String = "terminal" Public CurrentInterpreter As String = "terminal"
Public CurrentDirectory As String Public CurrentDirectory As String
Public Pseudodir As String
Public StayAtChapter As Boolean = False Public StayAtChapter As Boolean = False
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
@ -21,7 +22,8 @@ Public Class Terminal
End Sub End Sub
Public Sub InitializeTerminal() Public Sub InitializeTerminal()
Strings.OnceInfo(1) = My.Computer.FileSystem.SpecialDirectories.Temp & "\ShiftOS\ShiftFS\" Strings.OnceInfo(1) = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\ShiftFS\"
Strings.OnceInfo(4) = "!"
If Strings.IsFree = True Then If Strings.IsFree = True Then
Strings.ComputerInfo(0) = "shiftos" Strings.ComputerInfo(0) = "shiftos"
Strings.ComputerInfo(1) = "user" Strings.ComputerInfo(1) = "user"
@ -49,6 +51,8 @@ Public Class Terminal
End If End If
End If End If
End If End If
CurrentDirectory = Strings.OnceInfo(1)
Pseudodir = CurrentDirectory.Replace(Strings.OnceInfo(1), "!\")
TextBox1.Select(TextBox1.TextLength, 0) TextBox1.Select(TextBox1.TextLength, 0)
TextBox1.ScrollToCaret() TextBox1.ScrollToCaret()
End Sub End Sub
@ -145,6 +149,10 @@ Public Class Terminal
DisplayColors() DisplayColors()
AdvancedCommand = False AdvancedCommand = False
BadCommand = False BadCommand = False
Case "dir"
TerminalDirectories(CurrentDirectory)
AdvancedCommand = False
BadCommand = False
Case "guess" Case "guess"
ChangeInterpreter = True ChangeInterpreter = True
AppHost("guess") AppHost("guess")
@ -211,15 +219,6 @@ Public Class Terminal
AdvancedCommand = False AdvancedCommand = False
BadCommand = False BadCommand = False
InitializeTerminal() InitializeTerminal()
Case "su"
If Strings.OnceInfo(0) = "Yes" Then
TextBox1.Text = TextBox1.Text & Environment.NewLine & "You already in root mode!"
Else
Strings.OnceInfo(0) = "Yes"
AssignPrompt()
End If
AdvancedCommand = False
BadCommand = False
Case "shiftfetch" Case "shiftfetch"
If Strings.AvailableFeature(8) = "1" Then If Strings.AvailableFeature(8) = "1" Then
If Strings.OnceInfo(0) = "Yes" Then If Strings.OnceInfo(0) = "Yes" Then
@ -254,9 +253,9 @@ Public Class Terminal
BadCommand = False BadCommand = False
End If End If
Case "shiftoriumfx" Case "shiftoriumfx"
'ChangeInterpreter = True 'ChangeInterpreter = True
'AppHost("shiftoriumfx") 'AppHost("shiftoriumfx")
AdvancedCommand = False AdvancedCommand = False
BadCommand = False BadCommand = False
Undeveloped() Undeveloped()
Case "shutdown", "shut down" Case "shutdown", "shut down"
@ -285,6 +284,15 @@ Public Class Terminal
End If End If
AdvancedCommand = False AdvancedCommand = False
BadCommand = False BadCommand = False
Case "su"
If Strings.OnceInfo(0) = "Yes" Then
TextBox1.Text = TextBox1.Text & Environment.NewLine & "You already in root mode!"
Else
Strings.OnceInfo(0) = "Yes"
AssignPrompt()
End If
AdvancedCommand = False
BadCommand = False
Case "ver" Case "ver"
TextBox1.Text = TextBox1.Text & Environment.NewLine & "ShiftOS TheRevival version " & My.Resources.CurrentVersion TextBox1.Text = TextBox1.Text & Environment.NewLine & "ShiftOS TheRevival version " & My.Resources.CurrentVersion
AdvancedCommand = False AdvancedCommand = False
@ -434,11 +442,23 @@ 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 Select Case e.KeyData
Me.Hide() Case (Keys.Control + Keys.Q)
e.SuppressKeyPress = True If CurrentInterpreter = "terminal" Then
End If Else
TerminateApp()
PrintPrompt()
End If
End Select
'Select Case e.KeyCode
' Case e.KeyCode = Keys.T AndAlso e.Control
' e.SuppressKeyPress = True
' Case e.KeyCode = Keys.Q AndAlso e.Control
' If CurrentInterpreter = "terminal" Then
' Else
' TerminateApp()
' End If
'End Select
Select Case e.KeyCode Select Case e.KeyCode
Case Keys.ShiftKey Case Keys.ShiftKey
TrackPos = TrackPos - 1 TrackPos = TrackPos - 1

View file

@ -3,6 +3,7 @@
'This is for GTN's RAM 'This is for GTN's RAM
Public TheNumber As Integer = 0 Public TheNumber As Integer = 0
Public FreezeText As String Public FreezeText As String
'Basic Calculator's RAM
Public BC_ReadNumbers As Integer Public BC_ReadNumbers As Integer
Public BC_Numbers1 As String Public BC_Numbers1 As String
Public BC_Numbers2 As String Public BC_Numbers2 As String

View file

@ -204,6 +204,7 @@
Case "terminal" Case "terminal"
Terminal.TextBox1.BackColor = BgColor Terminal.TextBox1.BackColor = BgColor
Terminal.TextBox1.ForeColor = FgColor Terminal.TextBox1.ForeColor = FgColor
Strings.OnceInfo(3) = Bg & Fg
End Select End Select
End Sub End Sub
End Module End Module

View file

@ -99,6 +99,7 @@
<Compile Include="MainForms\BugSlap.vb"> <Compile Include="MainForms\BugSlap.vb">
<SubType>Form</SubType> <SubType>Form</SubType>
</Compile> </Compile>
<Compile Include="MainForms\DirectoryManagements.vb" />
<Compile Include="MainForms\IntroStory.Designer.vb"> <Compile Include="MainForms\IntroStory.Designer.vb">
<DependentUpon>IntroStory.vb</DependentUpon> <DependentUpon>IntroStory.vb</DependentUpon>
</Compile> </Compile>