Example #1
0
        public void Extract(ZipEntry entry, string path, bool overwrite)
        {
            if (entry.Name.EndsWith("/"))
            {
                Directory.CreateDirectory(path);
                return;
            }
            if (Directory.Exists(path) && !overwrite)
            {
                throw new IOException(string.Format("File {0} already exists", path));
            }
            string directoryName = Path.GetDirectoryName(path);

            if (directoryName != null)
            {
                Directory.CreateDirectory(directoryName);
            }
            using (FileStream stream = File.Create(path))
            {
                entry.Extract(stream);
            }
            File.SetCreationTime(path, entry.LastModified);
            File.SetLastWriteTime(path, entry.LastModified);
        }
 public void Extract(ZipEntry entry, string path, bool overwrite)
 {
     if (entry.Name.EndsWith("/"))
     {
         Directory.CreateDirectory(path);
         return;
     }
     if (Directory.Exists(path) && !overwrite)
         throw new IOException(string.Format("File {0} already exists", path));
     string directoryName = Path.GetDirectoryName(path);
     if (directoryName != null) Directory.CreateDirectory(directoryName);
     using (FileStream stream = File.Create(path))
     {
         entry.Extract(stream);
     }
     File.SetCreationTime(path, entry.LastModified);
     File.SetLastWriteTime(path, entry.LastModified);
 }