private void ExtractFileEntry(ZipEntry entry, string targetName) { bool flag = true; if (overwrite_ != Overwrite.Always && File.Exists(targetName)) { flag = (overwrite_ == Overwrite.Prompt && confirmDelegate_ != null && confirmDelegate_(targetName)); } if (flag) { if (events_ != null) { continueRunning_ = events_.OnProcessFile(entry.Name); } if (continueRunning_) { try { using (FileStream destination = File.Create(targetName)) { if (buffer_ == null) { buffer_ = new byte[4096]; } if (events_ != null && events_.Progress != null) { StreamUtils.Copy(zipFile_.GetInputStream(entry), destination, buffer_, events_.Progress, events_.ProgressInterval, this, entry.Name, entry.Size); } else { StreamUtils.Copy(zipFile_.GetInputStream(entry), destination, buffer_); } if (events_ != null) { continueRunning_ = events_.OnCompletedFile(entry.Name); } } if (restoreDateTimeOnExtract_) { File.SetLastWriteTime(targetName, entry.DateTime); } if (RestoreAttributesOnExtract && entry.IsDOSEntry && entry.ExternalFileAttributes != -1) { FileAttributes externalFileAttributes = (FileAttributes)entry.ExternalFileAttributes; externalFileAttributes &= (FileAttributes.ReadOnly | FileAttributes.Hidden | FileAttributes.Archive | FileAttributes.Normal); File.SetAttributes(targetName, externalFileAttributes); } } catch (Exception e) { if (events_ == null) { continueRunning_ = false; throw; } continueRunning_ = events_.OnFileFailure(targetName, e); } } } }
private void ExtractFileEntry(ZipEntry entry, string targetName) { //IL_00bc: Unknown result type (might be due to invalid IL or missing references) bool flag = true; if (overwrite_ != Overwrite.Always && File.Exists(targetName)) { flag = overwrite_ == Overwrite.Prompt && confirmDelegate_ != null && confirmDelegate_(targetName); } if (!flag) { return; } if (events_ != null) { continueRunning_ = events_.OnProcessFile(entry.Name); } if (!continueRunning_) { return; } try { FileStream val = File.Create(targetName); try { if (buffer_ == null) { buffer_ = new byte[4096]; } if (events_ != null && events_.Progress != null) { StreamUtils.Copy(zipFile_.GetInputStream(entry), (Stream)(object)val, buffer_, events_.Progress, events_.ProgressInterval, this, entry.Name, entry.Size); } else { StreamUtils.Copy(zipFile_.GetInputStream(entry), (Stream)(object)val, buffer_); } if (events_ != null) { continueRunning_ = events_.OnCompletedFile(entry.Name); } } finally { ((global::System.IDisposable)val)?.Dispose(); } } catch (global::System.Exception e) { if (events_ != null) { continueRunning_ = events_.OnFileFailure(targetName, e); return; } continueRunning_ = false; throw; } }
void ExtractFileEntry(ZipEntry entry, string targetName) { bool proceed = true; if (overwrite_ != Overwrite.Always) { if (File.Exists(targetName)) { if ((overwrite_ == Overwrite.Prompt) && (confirmDelegate_ != null)) { proceed = confirmDelegate_(targetName); } else { proceed = false; } } } if (proceed) { if (events_ != null) { continueRunning_ = events_.OnProcessFile(entry.Name); } if (continueRunning_) { try { using (FileStream outputStream = File.Create(targetName)) { if (buffer_ == null) { buffer_ = new byte[4096]; } if ((events_ != null) && (events_.Progress != null)) { StreamUtils.Copy(zipFile_.GetInputStream(entry), outputStream, buffer_, events_.Progress, events_.ProgressInterval, this, entry.Name, entry.Size); } else { StreamUtils.Copy(zipFile_.GetInputStream(entry), outputStream, buffer_); } if (events_ != null) { continueRunning_ = events_.OnCompletedFile(entry.Name); } } } catch (Exception ex) { if (events_ != null) { continueRunning_ = events_.OnFileFailure(targetName, ex); } else { continueRunning_ = false; throw; } } } } }