Rename function implemented

This commit is contained in:
EverythingWindows 2022-11-19 06:54:01 +07:00
parent e73d05d3b0
commit 1d1722345b
6 changed files with 68 additions and 16 deletions

View file

@ -264,9 +264,15 @@
NormalCommand()
End If
Case "time"
Terminal_Time()
AdvancedCommand = False
NormalCommand()
If Strings.AvailableFeature(5) = 1 Then
Terminal_Time()
AdvancedCommand = False
NormalCommand()
ElseIf Strings.AvailableFeature(5) = 3 Then
Terminal_Time()
AdvancedCommand = False
NormalCommand()
End If
Case "su"
Terminal_Su()
AdvancedCommand = False
@ -340,6 +346,13 @@
AdvancedCommand = False
End If
End If
If command Like "ren '*' '*'" Then
If Strings.AvailableFeature(31) = 1 Then
Rename()
NormalCommand()
AdvancedCommand = False
End If
End If
If command Like "rev *" Then
If Strings.AvailableFeature(21) = 1 Then
Reverse()

View file

@ -5,12 +5,16 @@ Module FileManagement
If File.Exists(Console.CurrentDirectory & "\" & filename) = True Then
Dim ContentsFinal As String = File.ReadAllText(Console.CurrentDirectory & "\" & filename)
NewLine(ContentsFinal)
Else
NewLine("File is not exist")
End If
End Sub
Public Sub DeleteFile(filename As String)
If File.Exists(Console.CurrentDirectory & "\" & filename) = True Then
File.Delete(Console.CurrentDirectory & "\" & filename)
Else
NewLine("File is not exist")
End If
End Sub

View file

@ -79,7 +79,7 @@
'28 = Date by month and year [Shows date in MM/YYYY format] (0.2.5) (default : 0)
'29 = Date by general [Shows date in general DD/MM/YYYY format] (0.2.5) (default : 0)
'30 = Batch-file support for ShiftOS [Gives execution support for ShiftOS Script File (.scr)] (0.2.5) (default : 0)
'31 = Clipboard support for ShiftOS [Gives clipboard support for copy-pasting in ShiftOS] (0.2.6) (default : 0)
'31 = Rename support [Ability to rename files in ShiftOS] (default : 0)
'
'Features bought hierarchy :
'ShiftOS Key (KEY) (5 CP)
@ -100,8 +100,8 @@
'>>>>>>RGB Variant (rgb2) (75 CP)
'>>>>>>>4-bit Color Display (4BITCOLOR) (80 CP)
'>>>>>>>>Terminal Read-Only Memory Driver (ROMDRIVER, DIR, MKDIR, RMDIR, CD, PWD) (90 CP)
'>>>>>>>>>Rename support (RENAME) (95 CP)
'>>>>>>>>>TextPad (100 CP)
'>>>>>>>>>>Clipboard support (CLIPBOARD) (100 CP)
'>>>>>>>>>>ShiftOS Batch Script Support (BATCHSCRIPT) (100 CP)
'>>Basic Calculator (BC) (55 CP)
'>>Time by Seconds (TIME, STIME) (10 CP)

View file

@ -55,9 +55,9 @@
If Strings.AvailableFeature(30) = "0" Then
NewLine("(batchscript | 100 CP) ShiftOS Batch Script Support")
End If
If Strings.AvailableFeature(31) = "0" Then
NewLine("(clipboard | 100 CP) Clipboard support")
End If
End If
If Strings.AvailableFeature(31) = "0" Then
NewLine("(rename | 95 CP) Rename command")
End If
End If
End If
@ -381,13 +381,13 @@
NewLine(ManHeader(1))
NormalCommand()
End If
Case "clipboard"
Case "rename"
If Strings.AvailableFeature(31) = "0" Then
ManHeader(0) = "Clipboard Support"
ManHeader(1) = "100 CP"
ManHeader(0) = "Rename command"
ManHeader(1) = "95 CP"
NewLine(ManHeader(0))
NewLine(Nothing)
NewLine("Adds the supports for clipboard")
NewLine("Gives ability to rename a file")
NewLine(Nothing)
NewLine(ManHeader(1))
NormalCommand()
@ -494,8 +494,8 @@
Case "batchscript"
Shiftorium_InstallFeatures(True, "batchscript", 30, 100)
NormalCommand()
Case "clipboard"
Shiftorium_InstallFeatures(True, "clipboard", 31, 100)
Case "rename"
Shiftorium_InstallFeatures(True, "rename", 31, 95)
NormalCommand()
Case Else
NormalCommand()
@ -587,11 +587,11 @@
Case "romdriver"
Strings.AvailableFeature(16) = "1"
Strings.AvailableFeature(17) = "0"
Strings.AvailableFeature(31) = "0"
success = True
Case "textpad"
Strings.AvailableFeature(17) = "1"
Strings.AvailableFeature(30) = "0"
Strings.AvailableFeature(31) = "0"
success = True
Case "shiftkey"
Strings.AvailableFeature(18) = "1"
@ -645,7 +645,7 @@
Case "batchscript"
Strings.AvailableFeature(30) = "1"
success = True
Case "clipboard"
Case "rename"
Strings.AvailableFeature(31) = "1"
success = True
End Select

View file

@ -178,6 +178,7 @@
<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_Rename.vb" />
<Compile Include="TerminalApplications\Internal\Com_Rev.vb" />
<Compile Include="TerminalApplications\Internal\Com_Rmdir.vb" />
<Compile Include="TerminalApplications\Internal\Com_Shiftfetch.vb" />

View file

@ -0,0 +1,34 @@
Imports System.IO
Module Com_Rename
Public ShouldRename As Boolean
Public Sub Rename()
Dim Names() As String = command.Split("''")
If Names(1) = "" Then
NewLine("No filename has been inputted")
ShouldRename = False
ElseIf Names(1) Like " *" Then
NewLine("Filename cannot be started with spaces")
ShouldRename = False
Else
ShouldRename = True
End If
If Names(3) = "" Then
NewLine("No new filename has been inputted")
ShouldRename = False
ElseIf Names(3) Like " *" Then
NewLine("Filename cannot be started with spaces")
ShouldRename = False
Else
ShouldRename = True
End If
If ShouldRename = True Then
If File.Exists(Console.CurrentDirectory & "\" & Names(1)) = True Then
FileSystem.Rename(Console.CurrentDirectory & "\" & Names(1), Console.CurrentDirectory & "\" & Names(3))
Else
NewLine("File is not exist")
End If
End If
End Sub
End Module