private void OnCreateUnzippedName(CreateUnzippedNameEventArgs ea) { if (CreateUnzippedNameEvent != null) { CreateUnzippedNameEvent(this, ea); } }
private string CreateUnzippedName(ZipEntry entry) { string name = null; if (NoDirectoryNames) { if (entry.IsDirectory) { throw new Exception("NoDirectoryNames but got dir"); } name = Path.GetFileName(entry.Name); } else { name = entry.Name.TrimStartDirSep(); //trim not requred since we dont use Path.Combine, but do it anyways } //PS: don't use Path.Combine here! if name is absolute, it will override destination! //use Path.GetFullPath to normalize path. also it will give error if invalid chars in path //FIXME: figure out if other ziputils allow storing relative path's in zip (\..\..\test) and how they handle extraction //of such items. string unzippedName = Path.GetFullPath(Destination + Path.DirectorySeparatorChar + name); CreateUnzippedNameEventArgs ea = new CreateUnzippedNameEventArgs(unzippedName, entry.IsDirectory); OnCreateUnzippedName(ea); return(ea.UnzippedName); }