public OnDirectoryFailure ( string directory, |
||
directory | string | The directory causing the failure. |
e | The exception for this event. | |
리턴 | bool |
private void ExtractEntry(ZipEntry entry) { bool flag = entry.IsCompressionMethodSupported(); string text = entry.Name; if (flag) { if (entry.IsFile) { text = extractNameTransform_.TransformFile(text); } else if (entry.IsDirectory) { text = extractNameTransform_.TransformDirectory(text); } flag = text != null && text.get_Length() != 0; } string text2 = null; if (flag) { text2 = ((!entry.IsDirectory) ? Path.GetDirectoryName(Path.GetFullPath(text)) : text); } if (flag && !Directory.Exists(text2) && (!entry.IsDirectory || CreateEmptyDirectories)) { try { Directory.CreateDirectory(text2); } catch (global::System.Exception e) { flag = false; if (events_ == null) { continueRunning_ = false; throw; } if (entry.IsDirectory) { continueRunning_ = events_.OnDirectoryFailure(text, e); } else { continueRunning_ = events_.OnFileFailure(text, e); } } } if (flag && entry.IsFile) { ExtractFileEntry(entry, text); } }
void ExtractEntry(ZipEntry entry) { bool doExtraction = entry.IsCompressionMethodSupported(); string targetName = entry.Name; if (doExtraction) { if (entry.IsFile) { targetName = extractNameTransform_.TransformFile(targetName); } else if (entry.IsDirectory) { targetName = extractNameTransform_.TransformDirectory(targetName); } doExtraction = !((targetName == null) || (targetName.Length == 0)); } // TODO: Fire delegate/throw exception were compression method not supported, or name is invalid? string dirName = null; if (doExtraction) { if (entry.IsDirectory) { dirName = targetName; } else { dirName = Path.GetDirectoryName(Path.GetFullPath(targetName)); } } if (doExtraction && !Directory.Exists(dirName)) { if (!entry.IsDirectory || CreateEmptyDirectories) { try { Directory.CreateDirectory(dirName); } catch (Exception ex) { doExtraction = false; if (events_ != null) { if (entry.IsDirectory) { continueRunning_ = events_.OnDirectoryFailure(targetName, ex); } else { continueRunning_ = events_.OnFileFailure(targetName, ex); } } else { continueRunning_ = false; throw; } } } } if (doExtraction && entry.IsFile) { ExtractFileEntry(entry, targetName); } }