2024-03-01 13:14:46 +02:00
|
|
|
#required Path.sbsl
|
2024-03-04 22:27:09 +02:00
|
|
|
#required Path.sbsl
|
2024-02-19 22:13:42 +02:00
|
|
|
|
2024-02-17 22:19:54 +02:00
|
|
|
@Global
|
2024-03-04 22:27:09 +02:00
|
|
|
method CreateFromDirectory(StartPath: String, ZipPath: String)
|
|
|
|
val Folder = new File(StartPath)
|
|
|
|
val Archive = new File(ZipPath)
|
2024-02-19 22:13:42 +02:00
|
|
|
var Writer = new ZipWriter(Archive.OpenWritableStream())
|
2024-02-17 22:19:54 +02:00
|
|
|
|
2024-03-04 22:27:09 +02:00
|
|
|
Folder.Children.ForEach(Child -> AddToZipArchive(Child, Writer))
|
2024-02-17 22:19:54 +02:00
|
|
|
|
|
|
|
Writer.Write()
|
|
|
|
;
|
|
|
|
|
2024-03-04 22:27:09 +02:00
|
|
|
@Global
|
|
|
|
method ExtractToDirectory(ZipPath: String, ExtractPath: String)
|
|
|
|
val Archive = new ZipFile(ZipPath)
|
|
|
|
|
|
|
|
if not Path.Exists(ExtractPath)
|
|
|
|
Files.CreateDirectory(ExtractPath)
|
|
|
|
;
|
|
|
|
|
|
|
|
Archive.ExtractAll(ExtractPath)
|
|
|
|
;
|
|
|
|
|
2024-03-01 13:14:46 +02:00
|
|
|
method AddToZipArchive(FileToZipping: File, Writer: ZipWriter, RelativePath: String = "")
|
2024-02-19 22:13:42 +02:00
|
|
|
if FileToZipping.IsFile()
|
2024-03-01 13:14:46 +02:00
|
|
|
Writer.Add(FileToZipping.OpenReadableStream(), Path.Join(RelativePath, FileToZipping.Name))
|
2024-02-19 22:13:42 +02:00
|
|
|
else
|
2024-03-01 13:14:46 +02:00
|
|
|
FileToZipping.Children.ForEach(Child -> AddToZipArchive(Child, Writer, Path.Join(RelativePath, FileToZipping.Name)))
|
2024-02-17 22:19:54 +02:00
|
|
|
;
|
|
|
|
;
|