Пример #1
0
        private static void ExtractEntry(ZipEntry entry, Stream stream, string directory)
        {
            var directoryName = Path.GetDirectoryName(entry.Name);
            if (directoryName == null) return;
            if (!entry.IsFile) return;

            var fileName = Path.GetFileName(entry.Name);
            if (fileName == null) return;

            directoryName = Path.Combine(directory, directoryName);
            Directory.CreateDirectory(directoryName);

            var entryFileName = Path.Combine(directoryName, fileName);
            stream.Save(entryFileName);
        }
Пример #2
0
        public override void Save(Stream inputStream, string path, bool unzip)
        {
            var fullPath = MapPath(path);

            if (unzip && IsZipFile(fullPath))
            {
                inputStream.Extract(fullPath);
            }
            else
            {
                inputStream.Save(fullPath);
            }
        }