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

View file

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

View file

@ -11,6 +11,7 @@ Public Class Terminal
Public ChangeInterpreter As Boolean = False
Public CurrentInterpreter As String = "terminal"
Public CurrentDirectory As String
Public Pseudodir As String
Public StayAtChapter As Boolean = False
Private Sub Terminal_Load(sender As Object, e As EventArgs) Handles MyBase.Load
@ -21,7 +22,8 @@ Public Class Terminal
End Sub
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
Strings.ComputerInfo(0) = "shiftos"
Strings.ComputerInfo(1) = "user"
@ -49,6 +51,8 @@ Public Class Terminal
End If
End If
End If
CurrentDirectory = Strings.OnceInfo(1)
Pseudodir = CurrentDirectory.Replace(Strings.OnceInfo(1), "!\")
TextBox1.Select(TextBox1.TextLength, 0)
TextBox1.ScrollToCaret()
End Sub
@ -145,6 +149,10 @@ Public Class Terminal
DisplayColors()
AdvancedCommand = False
BadCommand = False
Case "dir"
TerminalDirectories(CurrentDirectory)
AdvancedCommand = False
BadCommand = False
Case "guess"
ChangeInterpreter = True
AppHost("guess")
@ -211,15 +219,6 @@ Public Class Terminal
AdvancedCommand = False
BadCommand = False
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"
If Strings.AvailableFeature(8) = "1" Then
If Strings.OnceInfo(0) = "Yes" Then
@ -254,9 +253,9 @@ Public Class Terminal
BadCommand = False
End If
Case "shiftoriumfx"
'ChangeInterpreter = True
'AppHost("shiftoriumfx")
AdvancedCommand = False
'ChangeInterpreter = True
'AppHost("shiftoriumfx")
AdvancedCommand = False
BadCommand = False
Undeveloped()
Case "shutdown", "shut down"
@ -285,6 +284,15 @@ Public Class Terminal
End If
AdvancedCommand = 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"
TextBox1.Text = TextBox1.Text & Environment.NewLine & "ShiftOS TheRevival version " & My.Resources.CurrentVersion
AdvancedCommand = False
@ -434,11 +442,23 @@ 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
Select Case e.KeyData
Case (Keys.Control + Keys.Q)
If CurrentInterpreter = "terminal" Then
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
Case Keys.ShiftKey
TrackPos = TrackPos - 1

View file

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

View file

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

View file

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