Skip to content

About

🐳➑️🐟 .NET Standard 2.0 zip file creator with glob support

Resources

Stars

2 stars

Watchers

3 watching

Forks

Latest commit

Β 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

BugSplat Banner Image

BugSplat

Crash and error reporting built for busy developers.

Follow @bugsplatco on Twitter Join BugSplat on Discord

πŸ‘‹ Introduction

ZipCreator is a .NET Standard 2.0 library for creating zip files from glob patterns.

βš™οΈ Installation

The ZipCreator library can be added to your project via NuGet.

Install-Package ZipCreator

πŸ—οΈ Usage

Add a using statement for the ZipCreator namespace

using ZipCreator;

Create an instance of Zip from a text file that contains a list of filters separated by new lines.

input.txt

var zip = Zip.CreateFromFile("input.txt");

You can also create an instances of Zip with the default constructor and set the Settings properties according to your use case.

var zip = new Zip();
zip.Settings.Filters = new List<string>() { "path/to/folder/**/*" };
zip.Settings.Interceptors.Add((fileInfo) => Console.WriteLine(fileInfo.FullName));
zip.Settings.Output = new FileInfo(pathToOutputZip);
zip.Settings.Overwrite = true;

The Filters property accepts a list of path globs. You can also exclude patterns by prefixing the pattern with a !.

zip.Settings.Filters = new List<string>()
{
    "path/to/folder/**/*",
    "!path/to/folder/exclude.txt"
};

The Interceptors property is a List<Action<FileInfo>> containting actions that get invoked with each file before it is added to the zip.

zip.Settings.Interceptors.Add((fileInfo) => SignTool(fileInfo.FullName));

The Overwrite property controls whether the Output file should be overwritten if it exists. If Overwrite is false the call to MakeZips will return ZipResult.OverwriteError if the output file exists.

zip.Settings.Overwrite = true

The collection of files that will be operated on can be accessed via the readonly Files property.

var files = zip.Files;

Finally, call Write to create a .zip file and write it to the location specified in Settings.Output.

var result = zip.Write();

πŸ› About

BugSplat is a software crash and error reporting service with support for Windows C++, .NET Framework, dotnet and many more. BugSplat automatically captures critical diagnostic data such as stack traces, log files, and other runtime information. BugSplat also provides automated incident notifications, a convenient dashboard for monitoring trends and prioritizing engineering efforts, and integrations with popular development tools to maximize productivity and ship more profitable software.

About

🐳➑️🐟 .NET Standard 2.0 zip file creator with glob support

Resources

Stars

2 stars

Watchers

3 watching

Forks

Releases

Sponsor this project

Packages

Used by

Contributors

Languages