Beispiel #1
0
 private void OnCreateUnzippedName(CreateUnzippedNameEventArgs ea)
 {
     if (CreateUnzippedNameEvent != null)
     {
         CreateUnzippedNameEvent(this, ea);
     }
 }
Beispiel #2
0
        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);
        }