ZipUtility 1.1.5

There is a newer version of this package available.
See the version list below for details.
dotnet add package ZipUtility --version 1.1.5
NuGet\Install-Package ZipUtility -Version 1.1.5
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="ZipUtility" Version="1.1.5" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add ZipUtility --version 1.1.5
#r "nuget: ZipUtility, 1.1.5"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install ZipUtility as a Cake Addin
#addin nuget:?package=ZipUtility&version=1.1.5

// Install ZipUtility as a Cake Tool
#tool nuget:?package=ZipUtility&version=1.1.5
internal partial class ZipUtilityTest : Form
{
    public ZipUtilityTest()
    {
        ZipViewer zipViewer = null;
        string unzipDst = Application.StartupPath;

        var statusStrip = new StatusStrip() { Parent = this, };
        var statusLabel = new ToolStripStatusLabel() { Text = "Ready", Spring = true, TextAlign = ContentAlignment.MiddleLeft, };
        statusStrip.Items.Add(statusLabel);
        Action<string> progress = (l) => { statusLabel.Text = l; };
        ListBox listBoxZipFiles = new ListBox() { Parent = this, Dock = DockStyle.Top, };
        listBoxZipFiles.ContextMenuStrip = new ContextMenuStrip();
        ToolStripMenuItem tsmiUnzip = new ToolStripMenuItem() { Text = "Unzip selected", };
        tsmiUnzip.Click += async (sender, e) =>
        {
            await zipViewer.Extract(unzipDst, listBoxZipFiles.SelectedItems.Cast<string>().ToList());
        };

        ToolStripMenuItem tsmiGlimpse = new ToolStripMenuItem() { Text = "Glimpse selected", };
        tsmiGlimpse.Click += (sender, e) => 
        {
            foreach(var item in listBoxZipFiles.SelectedItems.Cast<string>())
            {
                var d = zipViewer.GetData(item);
                var text = Encoding.UTF8.GetString(d);
                int len = Math.Min(200, text.Length);
                MessageBox.Show(text.Substring(0,len));
            }
        };

        listBoxZipFiles.ContextMenuStrip.Items.Add(tsmiUnzip);
        listBoxZipFiles.ContextMenuStrip.Items.Add(tsmiGlimpse);

        Button buttonDisp = new Button() { Text = "Display", Parent = this, Dock = DockStyle.Top, };
        buttonDisp.Click += async (sender, e) =>
        {
            OpenFileDialog ofd = new OpenFileDialog() { InitialDirectory = Application.StartupPath, };
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                zipViewer = await ZipViewer.Open(ofd.FileName, progress);
                if (zipViewer != null)
                {
                    listBoxZipFiles.Items.Clear();
                    listBoxZipFiles.Items.AddRange(zipViewer.FileList.Select(x => x.FileName).ToArray());
                }
            }
        };

        Button buttonExtract = new Button() { Text = "UnzipAll", Parent = this, Dock = DockStyle.Top, };
        buttonExtract.Click += async (sender, e) =>
        {
            OpenFileDialog ofd = new OpenFileDialog() { InitialDirectory = Application.StartupPath, };
            if (ofd.ShowDialog() == DialogResult.OK)
            {
                var tempdst = System.IO.Path.GetDirectoryName(ofd.FileName);
                var z = await ZipViewer.Open(ofd.FileName, progress);
                if (z != null)
                {
                    await z.ExtractAll(tempdst);
                }
            }
        };

        Button buttonZip = new Button() { Text = "CreateZip", Parent = this, Dock = DockStyle.Top, };
        buttonZip.Click += async (sender, e) =>
        {
            using (var streamzipper = new StreamZipper("streamzip.zip"))
            {
                OpenFileDialog ofd = new OpenFileDialog() { InitialDirectory = Application.StartupPath, Multiselect = true, };
                if (ofd.ShowDialog() == DialogResult.OK)
                {
                    foreach (var f in ofd.FileNames)
                    {
                        streamzipper.Add(f, System.IO.Path.GetFileName(f));
                        progress(f);
                        await Task.Delay(1);
                    }
                }

                FolderBrowserDialog fbd = new FolderBrowserDialog() { SelectedPath = Application.StartupPath, };
                if (fbd.ShowDialog() == DialogResult.OK)
                {
                    var startpos = System.IO.Path.GetDirectoryName(fbd.SelectedPath).Length;
                    foreach (var f in System.IO.Directory.GetFiles(fbd.SelectedPath, "*", System.IO.SearchOption.AllDirectories))
                    {
                        streamzipper.Add(f, f.Substring(startpos));
                        progress(f);
                        await Task.Delay(1);
                    }
                }

                streamzipper.Close();
                streamzipper.Dispose();
                progress("Ready");

            }
        };

        SizeChanged += (sende, e) =>
        {
            listBoxZipFiles.Height = ClientSize.Height - buttonDisp.Height - buttonExtract.Height - buttonZip.Height - statusStrip.Height;
        };
        StartPosition = FormStartPosition.CenterScreen;
        ClientSize = new Size(400, 600);
    }
}
Product Compatible and additional computed target framework versions.
.NET Framework net452 is compatible.  net46 was computed.  net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.2.4 149 11/26/2023
1.2.2 152 6/29/2023
1.2.1 129 6/12/2023
1.2.0 160 4/8/2023
1.1.8 207 3/19/2023
1.1.6.1 325 11/5/2022
1.1.5 419 3/19/2022
1.1.4 411 2/9/2022
1.1.3 400 1/10/2022
1.1.2 237 12/26/2021
1.1.1 248 12/18/2021
1.0.9 269 11/23/2021
1.0.8 276 10/25/2021
1.0.7 274 10/22/2021
1.0.6 294 10/16/2021