mirror of
https://github.com/EverythingWindows/ShiftOS-TheRevival-Old.git
synced 2025-01-22 18:02:16 +00:00
moving from DirectoryManagement to each modules for DE's other module for said action.
This commit is contained in:
parent
b6ad60f568
commit
f9c724e547
9 changed files with 98 additions and 85 deletions
|
@ -97,7 +97,7 @@
|
||||||
End If
|
End If
|
||||||
Case "clear"
|
Case "clear"
|
||||||
If Strings.AvailableFeature(1) = "1" Then
|
If Strings.AvailableFeature(1) = "1" Then
|
||||||
Console.TextBox1.Text = Nothing
|
Clear()
|
||||||
AdvancedCommand = False
|
AdvancedCommand = False
|
||||||
Console.BadCommand = False
|
Console.BadCommand = False
|
||||||
End If
|
End If
|
||||||
|
|
|
@ -1,83 +1,3 @@
|
||||||
Module DirectoryManagements
|
Module DirectoryManagements
|
||||||
Dim spaces As String
|
|
||||||
Public Sub TerminalDirectories(TheDirectory As String)
|
|
||||||
Console.Pseudodir = TheDirectory.Replace(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\ShiftFS", "!")
|
|
||||||
NewLine("Contents of " & Console.Pseudodir)
|
|
||||||
NewLine(Nothing)
|
|
||||||
NewLine("[DIR] 0 KB .")
|
|
||||||
NewLine("[DIR] 0 KB ..")
|
|
||||||
For Each Dir As String In IO.Directory.GetDirectories(TheDirectory)
|
|
||||||
Dim dirinf As New IO.DirectoryInfo(Dir)
|
|
||||||
NewLine("[DIR] 0 KB " & dirinf.Name)
|
|
||||||
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
|
|
||||||
NewLine(spaces & filsize & " KB " & filinf.Name)
|
|
||||||
Case 2
|
|
||||||
NewLine(spaces & filsize & " MB " & filinf.Name)
|
|
||||||
Case 3
|
|
||||||
NewLine(spaces & filsize & " GB " & filinf.Name)
|
|
||||||
End Select
|
|
||||||
Next
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Public Sub NavigateDir(TheDirectory As String)
|
|
||||||
If TheDirectory = ".." Then
|
|
||||||
If Console.CurrentDirectory = Strings.OnceInfo(1) Then
|
|
||||||
NewLine("!\")
|
|
||||||
Else
|
|
||||||
Console.CurrentDirectory = IO.Directory.GetParent(Console.CurrentDirectory).ToString
|
|
||||||
End If
|
|
||||||
Else
|
|
||||||
If IO.Directory.Exists(Console.CurrentDirectory + "\" + TheDirectory) Then
|
|
||||||
Console.CurrentDirectory = Console.CurrentDirectory & "\" & TheDirectory
|
|
||||||
ElseIf IO.Directory.Exists(TheDirectory) Then
|
|
||||||
Console.CurrentDirectory = TheDirectory
|
|
||||||
Else
|
|
||||||
NewLine("The directory is not exist!")
|
|
||||||
End If
|
|
||||||
End If
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Public Sub CreateDir(TheDirectory As String)
|
|
||||||
If IO.Directory.Exists(Console.CurrentDirectory + "\" + TheDirectory) Then
|
|
||||||
NewLine("Directory is already exists!")
|
|
||||||
Else
|
|
||||||
IO.Directory.CreateDirectory(Console.CurrentDirectory + "\" + TheDirectory)
|
|
||||||
End If
|
|
||||||
End Sub
|
|
||||||
|
|
||||||
Public Sub RemoveDir(TheDirectory As String)
|
|
||||||
If IO.Directory.Exists(Console.CurrentDirectory + "\" + TheDirectory) Then
|
|
||||||
Try
|
|
||||||
IO.Directory.Delete(Console.CurrentDirectory + "\" + TheDirectory)
|
|
||||||
Catch ex As Exception
|
|
||||||
NewLine(ex.Message)
|
|
||||||
End Try
|
|
||||||
Else
|
|
||||||
NewLine("The directory is not exists!")
|
|
||||||
End If
|
|
||||||
End Sub
|
|
||||||
End Module
|
End Module
|
||||||
|
|
|
@ -163,16 +163,20 @@
|
||||||
<Compile Include="TerminalApplications\External\TerminalExternalApps.vb" />
|
<Compile Include="TerminalApplications\External\TerminalExternalApps.vb" />
|
||||||
<Compile Include="Functions\InGame\ColorSystem.vb" />
|
<Compile Include="Functions\InGame\ColorSystem.vb" />
|
||||||
<Compile Include="TerminalApplications\Internal\Com_05tray.vb" />
|
<Compile Include="TerminalApplications\Internal\Com_05tray.vb" />
|
||||||
|
<Compile Include="TerminalApplications\Internal\Com_Cd.vb" />
|
||||||
|
<Compile Include="TerminalApplications\Internal\Com_Clear.vb" />
|
||||||
<Compile Include="TerminalApplications\Internal\Com_Codepoint.vb" />
|
<Compile Include="TerminalApplications\Internal\Com_Codepoint.vb" />
|
||||||
<Compile Include="TerminalApplications\Internal\Com_Color.vb" />
|
|
||||||
<Compile Include="TerminalApplications\Internal\Com_Colors.vb" />
|
<Compile Include="TerminalApplications\Internal\Com_Colors.vb" />
|
||||||
<Compile Include="TerminalApplications\Internal\Com_Cowsay.vb" />
|
<Compile Include="TerminalApplications\Internal\Com_Cowsay.vb" />
|
||||||
|
<Compile Include="TerminalApplications\Internal\Com_Dir.vb" />
|
||||||
<Compile Include="TerminalApplications\Internal\Com_Help.vb" />
|
<Compile Include="TerminalApplications\Internal\Com_Help.vb" />
|
||||||
<Compile Include="TerminalApplications\Internal\Com_Hostname.vb" />
|
<Compile Include="TerminalApplications\Internal\Com_Hostname.vb" />
|
||||||
<Compile Include="TerminalApplications\Internal\Com_Infobar.vb" />
|
<Compile Include="TerminalApplications\Internal\Com_Infobar.vb" />
|
||||||
<Compile Include="TerminalApplications\Internal\Com_Manual.vb" />
|
<Compile Include="TerminalApplications\Internal\Com_Manual.vb" />
|
||||||
|
<Compile Include="TerminalApplications\Internal\Com_Mkdir.vb" />
|
||||||
<Compile Include="TerminalApplications\Internal\Com_Pwd.vb" />
|
<Compile Include="TerminalApplications\Internal\Com_Pwd.vb" />
|
||||||
<Compile Include="TerminalApplications\Internal\Com_Rev.vb" />
|
<Compile Include="TerminalApplications\Internal\Com_Rev.vb" />
|
||||||
|
<Compile Include="TerminalApplications\Internal\Com_Rmdir.vb" />
|
||||||
<Compile Include="TerminalApplications\Internal\Com_Shiftfetch.vb" />
|
<Compile Include="TerminalApplications\Internal\Com_Shiftfetch.vb" />
|
||||||
<Compile Include="TerminalApplications\Internal\Com_Shiftorium.vb" />
|
<Compile Include="TerminalApplications\Internal\Com_Shiftorium.vb" />
|
||||||
<Compile Include="TerminalApplications\Internal\Com_Su.vb" />
|
<Compile Include="TerminalApplications\Internal\Com_Su.vb" />
|
||||||
|
|
19
ShiftOS-TheRevival/TerminalApplications/Internal/Com_Cd.vb
Normal file
19
ShiftOS-TheRevival/TerminalApplications/Internal/Com_Cd.vb
Normal file
|
@ -0,0 +1,19 @@
|
||||||
|
Module Com_Cd
|
||||||
|
Public Sub NavigateDir(TheDirectory As String)
|
||||||
|
If TheDirectory = ".." Then
|
||||||
|
If Console.CurrentDirectory = Strings.OnceInfo(1) Then
|
||||||
|
NewLine("!\")
|
||||||
|
Else
|
||||||
|
Console.CurrentDirectory = IO.Directory.GetParent(Console.CurrentDirectory).ToString
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
If IO.Directory.Exists(Console.CurrentDirectory + "\" + TheDirectory) Then
|
||||||
|
Console.CurrentDirectory = Console.CurrentDirectory & "\" & TheDirectory
|
||||||
|
ElseIf IO.Directory.Exists(TheDirectory) Then
|
||||||
|
Console.CurrentDirectory = TheDirectory
|
||||||
|
Else
|
||||||
|
NewLine("The directory is not exist!")
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
End Module
|
|
@ -0,0 +1,5 @@
|
||||||
|
Module Com_Clear
|
||||||
|
Public Sub Clear()
|
||||||
|
Console.TextBox1.Text = Nothing
|
||||||
|
End Sub
|
||||||
|
End Module
|
|
@ -1,3 +0,0 @@
|
||||||
Module Com_Color
|
|
||||||
|
|
||||||
End Module
|
|
46
ShiftOS-TheRevival/TerminalApplications/Internal/Com_Dir.vb
Normal file
46
ShiftOS-TheRevival/TerminalApplications/Internal/Com_Dir.vb
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
Module Com_Dir
|
||||||
|
Dim spaces As String
|
||||||
|
|
||||||
|
Public Sub TerminalDirectories(TheDirectory As String)
|
||||||
|
Console.Pseudodir = TheDirectory.Replace(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\ShiftFS", "!")
|
||||||
|
NewLine("Contents of " & Console.Pseudodir)
|
||||||
|
NewLine(Nothing)
|
||||||
|
NewLine("[DIR] 0 KB .")
|
||||||
|
NewLine("[DIR] 0 KB ..")
|
||||||
|
For Each Dir As String In IO.Directory.GetDirectories(TheDirectory)
|
||||||
|
Dim dirinf As New IO.DirectoryInfo(Dir)
|
||||||
|
NewLine("[DIR] 0 KB " & dirinf.Name)
|
||||||
|
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
|
||||||
|
NewLine(spaces & filsize & " KB " & filinf.Name)
|
||||||
|
Case 2
|
||||||
|
NewLine(spaces & filsize & " MB " & filinf.Name)
|
||||||
|
Case 3
|
||||||
|
NewLine(spaces & filsize & " GB " & filinf.Name)
|
||||||
|
End Select
|
||||||
|
Next
|
||||||
|
End Sub
|
||||||
|
End Module
|
|
@ -0,0 +1,9 @@
|
||||||
|
Module Com_Mkdir
|
||||||
|
Public Sub CreateDir(TheDirectory As String)
|
||||||
|
If IO.Directory.Exists(Console.CurrentDirectory + "\" + TheDirectory) Then
|
||||||
|
NewLine("Directory is already exists!")
|
||||||
|
Else
|
||||||
|
IO.Directory.CreateDirectory(Console.CurrentDirectory + "\" + TheDirectory)
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
End Module
|
|
@ -0,0 +1,13 @@
|
||||||
|
Module Com_Rmdir
|
||||||
|
Public Sub RemoveDir(TheDirectory As String)
|
||||||
|
If IO.Directory.Exists(Console.CurrentDirectory + "\" + TheDirectory) Then
|
||||||
|
Try
|
||||||
|
IO.Directory.Delete(Console.CurrentDirectory + "\" + TheDirectory)
|
||||||
|
Catch ex As Exception
|
||||||
|
NewLine(ex.Message)
|
||||||
|
End Try
|
||||||
|
Else
|
||||||
|
NewLine("The directory is not exists!")
|
||||||
|
End If
|
||||||
|
End Sub
|
||||||
|
End Module
|
Loading…
Reference in a new issue