From e7e873a1b2f8fd4a431039651022c29e6b64d01e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rodrigo=20Lotr=C3=A1rio?= <45852660+rodesfl@users.noreply.github.com> Date: Fri, 9 Jun 2023 19:38:42 -0300 Subject: [PATCH] Added simple example Had some difficult figuring this one out, as this is so straight forward and is the simplest use case, maybe should be included at the top of the docs ? --- USAGE.md | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/USAGE.md b/USAGE.md index a7a7f0d6..c96f9c1b 100644 --- a/USAGE.md +++ b/USAGE.md @@ -33,6 +33,18 @@ If using Compression Stream classes directly and you don't want the wrapped stre Also, look over the tests for more thorough [examples](https://github.com/adamhathcock/sharpcompress/tree/master/tests/SharpCompress.Test) +### Create Zip Archive from multiple files +```C# +using(var archive = ZipArchive.Create()) +{ + archive.AddEntry("file01.txt", "C:\\file01.txt"); + archive.AddEntry("file02.txt", "C:\\file02.txt"); + ... + + archive.SaveTo("C:\\temp.zip", CompressionType.Deflate); +} +``` + ### Create Zip Archive from all files in a directory to a file ```C# @@ -143,4 +155,4 @@ foreach(var entry in tr.Entries) { Console.WriteLine($"{entry.Key}"); } -``` \ No newline at end of file +```