ZipCreator is a .NET Standard 2.0 library for creating zip files from glob patterns.
The ZipCreator library can be added to your project via NuGet.
Install-Package ZipCreatorAdd 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.
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 = trueThe 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();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.
