protected void OnUnZipping(object sender, UnZippingEventArgs e) { if (UnZipping != null) { UnZipping(sender, e); } }
public void Extract(string pathTo) { pathTo = Path.GetFullPath(pathTo); if (_zipInputStream == null) { _zipInputStream = new ZipInputStream(File.Open(path, FileMode.Open, FileAccess.Read)); } ZipEntry theEntry; using (_zipInputStream) while ((theEntry = _zipInputStream.GetNextEntry()) != null) { string directoryName = Path.GetDirectoryName(theEntry.Name); string fileName = Path.GetFileName(theEntry.Name); string fullPath = Path.Combine(pathTo, Path.Combine(directoryName, fileName)); var e = new UnZippingEventArgs(fullPath); OnUnZipping(this, e); if (!e.Cancel) { directoryName = Path.GetDirectoryName(fullPath); if (!Directory.Exists(directoryName)) { Directory.CreateDirectory(directoryName); } if (!String.IsNullOrEmpty(fileName)) { using (FileStream fileStream = File.Create(fullPath)) Pump(_zipInputStream, fileStream); } OnUnZipped(this, new UnZippedEventArgs(fullPath)); } } }
public void Extract(string pathTo) { pathTo = Path.GetFullPath(pathTo); if (_zipInputStream == null) _zipInputStream = new ZipInputStream(File.Open(path, FileMode.Open, FileAccess.Read)); ZipEntry theEntry; using (_zipInputStream) while ((theEntry = _zipInputStream.GetNextEntry()) != null) { string directoryName = Path.GetDirectoryName(theEntry.Name); string fileName = Path.GetFileName(theEntry.Name); string fullPath = Path.Combine(pathTo, Path.Combine(directoryName, fileName)); var e = new UnZippingEventArgs(fullPath); OnUnZipping(this, e); if (!e.Cancel) { directoryName = Path.GetDirectoryName(fullPath); if (!Directory.Exists(directoryName)) Directory.CreateDirectory(directoryName); if (!String.IsNullOrEmpty(fileName)) using (FileStream fileStream = File.Create(fullPath)) Pump(_zipInputStream, fileStream); OnUnZipped(this, new UnZippedEventArgs(fullPath)); } } }
protected void OnUnZipping(object sender, UnZippingEventArgs e) { if (UnZipping != null) UnZipping(sender, e); }