mirror of
https://github.com/EverythingWindows/ShiftOS-TheRevival-Old.git
synced 2025-01-23 02:12:14 +00:00
directory majority finished
This commit is contained in:
parent
8b5d4344f7
commit
2a3e5ec4d5
3 changed files with 92 additions and 5 deletions
|
@ -1,4 +1,5 @@
|
||||||
Module DirectoryManagements
|
Module DirectoryManagements
|
||||||
|
Dim spaces As String
|
||||||
Public Sub TerminalDirectories(TheDirectory As String)
|
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 & "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 ."
|
||||||
|
@ -7,5 +8,74 @@
|
||||||
Dim dirinf As New IO.DirectoryInfo(Dir)
|
Dim dirinf As New IO.DirectoryInfo(Dir)
|
||||||
Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "[DIR] 0 KB " & dirinf.Name
|
Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "[DIR] 0 KB " & dirinf.Name
|
||||||
Next
|
Next
|
||||||
|
For Each file As String In IO.Directory.GetFiles(TheDirectory)
|
||||||
|
Dim filinf As New IO.FileInfo(file)
|
||||||
|
Dim filsize As Long = filinf.Length / 1024
|
||||||
|
Dim thesize As Integer = 1
|
||||||
|
Do
|
||||||
|
If filsize >= 1024 Then
|
||||||
|
filsize = filsize / 1024
|
||||||
|
thesize = thesize + 1
|
||||||
|
Else
|
||||||
|
Exit Do
|
||||||
|
End If
|
||||||
|
Loop
|
||||||
|
Select Case filsize
|
||||||
|
Case 0 To 9
|
||||||
|
spaces = " "
|
||||||
|
Case 10 To 99
|
||||||
|
spaces = " "
|
||||||
|
Case 100 To 999
|
||||||
|
spaces = " "
|
||||||
|
Case 1000 To 1023
|
||||||
|
spaces = " "
|
||||||
|
End Select
|
||||||
|
Select Case thesize
|
||||||
|
Case 1
|
||||||
|
Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & spaces & filsize & " KB " & filinf.Name
|
||||||
|
Case 2
|
||||||
|
Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & spaces & filsize & " MB " & filinf.Name
|
||||||
|
Case 3
|
||||||
|
Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & spaces & filsize & " GB " & filinf.Name
|
||||||
|
End Select
|
||||||
|
Next
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Sub NavigateDir(TheDirectory As String)
|
||||||
|
If TheDirectory = ".." Then
|
||||||
|
If Terminal.CurrentDirectory = Strings.OnceInfo(1) Then
|
||||||
|
Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "!\"
|
||||||
|
Else
|
||||||
|
Terminal.CurrentDirectory = IO.Directory.GetParent(Terminal.CurrentDirectory).ToString
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
If IO.Directory.Exists(Terminal.CurrentDirectory + "\" + TheDirectory) Then
|
||||||
|
Terminal.CurrentDirectory = Terminal.CurrentDirectory & "\" & TheDirectory
|
||||||
|
ElseIf IO.Directory.Exists(TheDirectory) Then
|
||||||
|
Terminal.CurrentDirectory = TheDirectory
|
||||||
|
Else
|
||||||
|
Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "The directory is not exist!"
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Sub CreateDir(TheDirectory As String)
|
||||||
|
If IO.Directory.Exists(Terminal.CurrentDirectory + "\" + TheDirectory) Then
|
||||||
|
Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "Directory is already exists!"
|
||||||
|
Else
|
||||||
|
IO.Directory.CreateDirectory(Terminal.CurrentDirectory + "\" + TheDirectory)
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Public Sub RemoveDir(TheDirectory As String)
|
||||||
|
If IO.Directory.Exists(Terminal.CurrentDirectory + "\" + TheDirectory) Then
|
||||||
|
Try
|
||||||
|
IO.Directory.Delete(Terminal.CurrentDirectory + "\" + TheDirectory)
|
||||||
|
Catch ex As Exception
|
||||||
|
Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & ex.Message
|
||||||
|
End Try
|
||||||
|
Else
|
||||||
|
Terminal.TextBox1.Text = Terminal.TextBox1.Text & Environment.NewLine & "The directory is not exists!"
|
||||||
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
End Module
|
End Module
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
'
|
'
|
||||||
'OnceInfo Strings:
|
'OnceInfo Strings:
|
||||||
'0 = IsRoot? (0.1) (default : No)
|
'0 = IsRoot? (0.1) (default : No)
|
||||||
'1 = RootDirectory (0.2.3) (default : My.Computer.FileSystem.SpecialDirectories.Temp & "\ShiftOS\ShiftFS\")
|
'1 = RootDirectory (0.2.3) (default : Environment.SpecialDirectories.ApplicationData & "\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 : !)
|
'4 = RootDirectoryString (0.2.3) (default : !)
|
||||||
|
|
|
@ -22,7 +22,7 @@ Public Class Terminal
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Public Sub InitializeTerminal()
|
Public Sub InitializeTerminal()
|
||||||
Strings.OnceInfo(1) = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\ShiftFS\"
|
Strings.OnceInfo(1) = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\ShiftFS"
|
||||||
Strings.OnceInfo(4) = "!"
|
Strings.OnceInfo(4) = "!"
|
||||||
If Strings.IsFree = True Then
|
If Strings.IsFree = True Then
|
||||||
Strings.ComputerInfo(0) = "shiftos"
|
Strings.ComputerInfo(0) = "shiftos"
|
||||||
|
@ -214,6 +214,8 @@ Public Class Terminal
|
||||||
TextBox1.Text = TextBox1.Text & Environment.NewLine
|
TextBox1.Text = TextBox1.Text & Environment.NewLine
|
||||||
AdvancedCommand = False
|
AdvancedCommand = False
|
||||||
BadCommand = False
|
BadCommand = False
|
||||||
|
Case "textpad"
|
||||||
|
|
||||||
Case "reboot"
|
Case "reboot"
|
||||||
TextBox1.Text = Nothing
|
TextBox1.Text = Nothing
|
||||||
AdvancedCommand = False
|
AdvancedCommand = False
|
||||||
|
@ -300,6 +302,11 @@ Public Class Terminal
|
||||||
End Select
|
End Select
|
||||||
|
|
||||||
If AdvancedCommand = True Then
|
If AdvancedCommand = True Then
|
||||||
|
If command Like "cd *" Then
|
||||||
|
NavigateDir(command.Replace("cd ", ""))
|
||||||
|
AdvancedCommand = False
|
||||||
|
BadCommand = False
|
||||||
|
End If
|
||||||
If command Like "color *" Then
|
If command Like "color *" Then
|
||||||
GetColor("terminal", command.Substring(6, 1), command.Substring(7, 1))
|
GetColor("terminal", command.Substring(6, 1), command.Substring(7, 1))
|
||||||
BadCommand = False
|
BadCommand = False
|
||||||
|
@ -408,6 +415,16 @@ Public Class Terminal
|
||||||
End Select
|
End Select
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
If command Like "mkdir *" Then
|
||||||
|
CreateDir(command.Replace("mkdir ", ""))
|
||||||
|
AdvancedCommand = False
|
||||||
|
BadCommand = False
|
||||||
|
End If
|
||||||
|
If command Like "rmdir *" Then
|
||||||
|
RemoveDir(command.Replace("rmdir ", ""))
|
||||||
|
AdvancedCommand = False
|
||||||
|
BadCommand = False
|
||||||
|
End If
|
||||||
If command Like "shiftorium *" Then
|
If command Like "shiftorium *" Then
|
||||||
Dim prompt As String = command.Replace("shiftorium ", "")
|
Dim prompt As String = command.Replace("shiftorium ", "")
|
||||||
TextBox1.Text = TextBox1.Text & Environment.NewLine & "Shiftorium ShiftOS Center"
|
TextBox1.Text = TextBox1.Text & Environment.NewLine & "Shiftorium ShiftOS Center"
|
||||||
|
|
Loading…
Reference in a new issue