blob: 27d55de9d5c7770463b77c268059feac4ea5b440 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
|
Imports System.IO
Imports System.IO.Compression
Module Com_Zip
Public ZipString As String
Public NothingIn As Boolean = True
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)
NothingIn = False
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))
NothingIn = False
Else
End If
End If
End Sub
End Module
|