Guest User

Untitled

a guest
Dec 12th, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. public void Zip(string path, string outputPath)
  2. {
  3. using (ZipFile zip = new ZipFile())
  4. {
  5. zip.AddDirectory(path);
  6. zip.Password = "password";
  7. zip.Save(outputPath);
  8. }
  9. }
  10.  
  11. using (ZipFile zip = new ZipFile())
  12. {
  13. zip.Password = "password";
  14. zip.AddDirectory(path);
  15. zip.Save(outputPath);
  16. }
  17.  
  18. using (ZipFile zip = new ZipFile())
  19. {
  20. //this won't be password protected
  21. zip.AddDirectory(unprotectedPath);
  22. zip.Password = "password";
  23. //...but this will be password protected
  24. zip.AddDirectory(path);
  25. zip.Save(outputPath);
  26. }
Add Comment
Please, Sign In to add comment