aboutsummaryrefslogtreecommitdiff
path: root/ShiftOS-TheRevival/TerminalApplications/Internal/Com_Zip.vb
diff options
context:
space:
mode:
authorEverythingWindows <[email protected]>2022-11-20 02:25:18 +0700
committerEverythingWindows <[email protected]>2022-11-20 02:25:18 +0700
commitad70e4162d8c55c0a882997a0c47c168b286e5d1 (patch)
treeec04d1d349c14a70b9ecaf03fa1e0a7bfddfea99 /ShiftOS-TheRevival/TerminalApplications/Internal/Com_Zip.vb
parenteb41e07992fa2cb51194a0d4327a494f66b87b9b (diff)
downloadshiftos-therevival-old-ad70e4162d8c55c0a882997a0c47c168b286e5d1.tar.gz
shiftos-therevival-old-ad70e4162d8c55c0a882997a0c47c168b286e5d1.tar.bz2
shiftos-therevival-old-ad70e4162d8c55c0a882997a0c47c168b286e5d1.zip
Zip, and Unzip is now working
Diffstat (limited to 'ShiftOS-TheRevival/TerminalApplications/Internal/Com_Zip.vb')
-rw-r--r--ShiftOS-TheRevival/TerminalApplications/Internal/Com_Zip.vb37
1 files changed, 37 insertions, 0 deletions
diff --git a/ShiftOS-TheRevival/TerminalApplications/Internal/Com_Zip.vb b/ShiftOS-TheRevival/TerminalApplications/Internal/Com_Zip.vb
new file mode 100644
index 0000000..b48d2ae
--- /dev/null
+++ b/ShiftOS-TheRevival/TerminalApplications/Internal/Com_Zip.vb
@@ -0,0 +1,37 @@
+Imports System.IO
+Imports System.IO.Compression
+
+Module Com_Zip
+ Public ZipString As String
+
+ Public Sub Zip()
+ ZipString = RawCommand.Substring(4)
+ If ZipString Like "-f '*.zip' '*'" Then
+ Dim ZipEXE() As String = ZipString.Split("''")
+ If File.Exists(Console.CurrentDirectory & "\" & ZipEXE(3)) = True Then
+ Dim ZipRandomInt As Integer
+ Dim ZipRandom As New Random
+ ZipRandomInt = ZipRandom.Next(1, 1000000)
+ NewLine("Creating temporary place for selected file...")
+ Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SysShiftFS\ZIP" & ZipRandomInt)
+ NewLine("Assigning place for the selected file...")
+ File.Copy(Console.CurrentDirectory & "\" & ZipEXE(3), Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SysShiftFS\ZIP" & ZipRandomInt & "\" & ZipEXE(3))
+ NewLine("Compressing the file into a zip file...")
+ ZipFile.CreateFromDirectory(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SysShiftFS\ZIP" & ZipRandomInt, Console.CurrentDirectory & "\" & ZipEXE(1))
+ NewLine("Removing temporary place of the file...")
+ Directory.Delete(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\ShiftOS\SysShiftFS\ZIP" & ZipRandomInt, True)
+ Else
+
+ End If
+ End If
+ If ZipString Like "-d '*.zip' '*'" Then
+ Dim ZipEXE() As String = ZipString.Split("''")
+ If Directory.Exists(Console.CurrentDirectory & "\" & ZipEXE(3)) = True Then
+ NewLine("Compressing the directory into a zip file...")
+ ZipFile.CreateFromDirectory(Console.CurrentDirectory & "\" & ZipEXE(3), Console.CurrentDirectory & "\" & ZipEXE(1))
+ Else
+
+ End If
+ End If
+ End Sub
+End Module