Guest User

Untitled

a guest
Apr 25th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. private string OpenZipFile(string filePath,out bool isSuccess)
  2. {
  3. String ExtractionPath = null;
  4. isSuccess = true;
  5. using (ZipArchive ZipArchiveZArchive = System.IO.Compression.ZipFile.OpenRead(filePath))
  6. {
  7. //Clear temp folders
  8. ClearTempFolder();
  9. try
  10. {
  11. //Loop though each element
  12. foreach (ZipArchiveEntry zaEntry in ZipArchiveZArchive.Entries)
  13. {
  14. //Other code
  15. ////
  16. if (zaEntry.FullName.EndsWith("PlugIns.zip"))
  17. {
  18. try
  19. {
  20. string tempPlugIns = Environment.GetFolderPath(Environment.SpecialFolder.CommonApplicationData) + PgmDataPath + @"PlugIns.zip";
  21. if (!Directory.Exists(Path.GetDirectoryName(tempPlugIns)))
  22. {
  23. Directory.CreateDirectory(Path.GetDirectoryName(tempPlugIns));
  24. }
  25. if (File.Exists(tempPlugIns))
  26. File.Delete(tempPlugIns);
  27. zaEntry.ExtractToFile(tempPlugIns); //This line is throwing exception
  28. }
  29. }
  30.  
  31. //Other logic
  32. }
  33. }
Add Comment
Please, Sign In to add comment