diff --git a/src/ICSharpCode.SharpZipLib/Zip/FastZip.cs b/src/ICSharpCode.SharpZipLib/Zip/FastZip.cs index cd3bfad4d..348527e4f 100644 --- a/src/ICSharpCode.SharpZipLib/Zip/FastZip.cs +++ b/src/ICSharpCode.SharpZipLib/Zip/FastZip.cs @@ -783,7 +783,7 @@ private void ExtractEntry(ZipEntry entry) // TODO: Fire delegate/throw exception were compression method not supported, or name is invalid? - string dirName = null; + string dirName = string.Empty; if (doExtraction) { @@ -803,11 +803,18 @@ private void ExtractEntry(ZipEntry entry) { try { - Directory.CreateDirectory(dirName); - - if (entry.IsDirectory && restoreDateTimeOnExtract_) + continueRunning_ = events_?.OnProcessDirectory(dirName, true) ?? true; + if (continueRunning_) + { + Directory.CreateDirectory(dirName); + if (entry.IsDirectory && restoreDateTimeOnExtract_) + { + Directory.SetLastWriteTime(dirName, entry.DateTime); + } + } + else { - Directory.SetLastWriteTime(dirName, entry.DateTime); + doExtraction = false; } } catch (Exception ex)