' Collection of code snippets by Arne Vajhøj 
' (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
﻿Imports System
Imports System.IO
Imports System.IO.Compression

Namespace E
    Public Class Program
        Private Const REP As Integer = 100
        Public Shared Sub Main(args As String())
            Dim text As String = "This is a little test !!!!"
            Dim buf As Byte() = {0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }
            Using fs As New FileStream("C:\work\sysiocmp.zip", FileMode.Create, FileAccess.Write)
                Using za As New ZipArchive(fs, ZipArchiveMode.Create)
                    Dim tzae As ZipArchiveEntry = za.CreateEntry("xxx/test.txt")
                    Using sw As New StreamWriter(tzae.Open())
                        For i As Integer = 0 To REP - 1
                            sw.WriteLine(text)
                        Next
                    End Using
                    Dim bzae As ZipArchiveEntry = za.CreateEntry("xxx/test.bin")
                    Using s As Stream = bzae.Open()
                        For i As Integer = 0 To REP - 1
                            s.Write(buf, 0, buf.Length)
                        Next
                    End Using
                End Using
            End Using
        End Sub
    End Class
End Namespace
