' 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 ICSharpCode.SharpZipLib.Zip

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\shrpzplb.zip", FileMode.Create, FileAccess.Write)
                Using zos As New ZipOutputStream(fs)
                    Dim tze As New ZipEntry("xxx/test.txt")
                    zos.PutNextEntry(tze)
                    Dim sw As New StreamWriter(zos)
                    For i As Integer = 0 To REP - 1
                        sw.WriteLine(text)
                    Next
                    sw.Flush() ' do not attempt to close
                    Dim bze As New ZipEntry("xxx/test.bin")
                    zos.PutNextEntry(bze)
                    For i As Integer = 0 To REP - 1
                        zos.Write(buf, 0, buf.Length)
                    Next
                End Using
            End Using
        End Sub
    End Class
End Namespace
