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.
<PackageVersion Include="ZipUtility" Version="1.1.5" />
                    
Directory.Packages.props
<PackageReference Include="ZipUtility" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version 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.
#:package ZipUtility@1.1.5
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=ZipUtility&version=1.1.5
                    
Install as a Cake Addin
#tool nuget:?package=ZipUtility&version=1.1.5
                    
Install as a Cake Tool
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.6 145 10/31/2024
1.2.4 213 11/26/2023
1.2.2 216 6/29/2023
1.2.1 196 6/12/2023
1.2.0 221 4/8/2023
1.1.8 268 3/19/2023
1.1.6.1 393 11/5/2022
1.1.5 503 3/19/2022
1.1.4 497 2/9/2022
1.1.3 490 1/10/2022
1.1.2 326 12/26/2021
1.1.1 336 12/18/2021
1.0.9 362 11/23/2021
1.0.8 366 10/25/2021
1.0.7 351 10/22/2021
1.0.6 377 10/16/2021