public ZipContainer(SevenZipExtractor zip, ArchiveFileInfo entry, ZipContainer parent)
 {
     _name = entry.FileName;
     _entry = entry;
     Zip = zip;
     _parent = parent;
 }
Example #2
0
            public override void Execute()
            {
                var libraryPath = Path.Combine(Path.GetDirectoryName(GetType().Assembly.Location), Environment.Is64BitProcess ? "7z64.dll" : "7z.dll");
                SevenZipBase.SetLibraryPath(libraryPath);

                var targetPath = new FileInfo(Path.Combine(_cmdlet.SessionState.Path.CurrentFileSystemLocation.Path, _cmdlet.TargetPath)).FullName;
                var archiveFileName = new FileInfo(Path.Combine(_cmdlet.SessionState.Path.CurrentFileSystemLocation.Path, _cmdlet.ArchiveFileName)).FullName;

                var activity = String.Format("Extracting {0} to {1}", System.IO.Path.GetFileName(archiveFileName), targetPath);
                var statusDescription = "Extracting";

                Write(String.Format("Extracting archive {0}", archiveFileName));
                WriteProgress(new ProgressRecord(0, activity, statusDescription) { PercentComplete = 0 });

                using (var extractor = new SevenZipExtractor(archiveFileName)) {
                    extractor.Extracting += (sender, args) =>
                                            WriteProgress(new ProgressRecord(0, activity, statusDescription) { PercentComplete = args.PercentDone });
                    extractor.FileExtractionStarted += (sender, args) => {
                        statusDescription = String.Format("Extracting file {0}", args.FileInfo.FileName);
                        Write(statusDescription);
                    };
                    extractor.ExtractArchive(targetPath);
                }

                WriteProgress(new ProgressRecord(0, activity, "Finished") { RecordType = ProgressRecordType.Completed });
                Write("Extraction finished");
            }
Example #3
0
        /// <summary>
        /// Get content of compressed archive
        /// </summary>
        /// <returns></returns>
        protected override List <ArchiveFileInfo> GetDecompressedContent()
        {
            var retVal = new List <ArchiveFileInfo>();

            using (var orMs = new MemoryStream(this.OriginalContent))
            {
                orMs.Seek(0, SeekOrigin.Begin);

                using (var archiveFile = new SevenZibSharp.SevenZipExtractor(orMs))
                {
                    if (archiveFile.ArchiveFileData.Count == 1 || ContentPaths == null || ContentPaths.Count() == 0)
                    {
                        retVal.Add(GetArchiveFileInfo(archiveFile.ArchiveFileData[0], archiveFile));
                    }
                    else if (archiveFile.ArchiveFileData.Count > 1 && ContentPaths?.Count() > 0)
                    {
                        foreach (var path in this.ContentPaths)
                        {
                            var fent = archiveFile.ArchiveFileData.SingleOrDefault(e => e.FileName.ToLower() == path.ToLower());
                            if (fent != null)
                            {
                                retVal.Add(GetArchiveFileInfo(fent, archiveFile));
                            }
                        }
                    }
                }
                orMs.Close();
                return(retVal);
            }
        }
Example #4
0
        /// <summary>
        /// Decompresses an archive.
        /// </summary>
        /// <param name="archive">Path for the archive</param>
        /// <param name="destination">Archive content destination folder.</param>
        /// <returns>True if no errors</returns>
        public static bool Decompress(string archive, string destination)
        {
            try {
                string archive_name = Path.GetFileNameWithoutExtension(archive);
                if(main.full_path_output)
                    console.Write("Extracting " + archive + " to " + destination + " ->  0%", console.msgType.standard, false);
                else
                    console.Write("Extracting " + archive_name + " to " + destination + " ->  0%", console.msgType.standard, false);

                SevenZipExtractor zip = new SevenZipExtractor(archive);
                zip.Extracting += Zip_Extracting;
                if (!main.overwrite)
                    zip.FileExists += Zip_FileExists;
                if (main.create_dir)
                {
                    zip.ExtractArchive(destination + @"\" + archive_name);
                }
                else
                    zip.ExtractArchive(destination);
                Console.WriteLine("");
                return true;
            }
            catch (Exception e)
            {
                Console.WriteLine("");
                console.Write(e.Message +"("+archive+")", console.msgType.error);
                Log(e.ToString());
                return false;
            }
        }
        public FileReader(IFileStreamWrap stream)
        {
            if (stream == null) throw new ArgumentNullException(nameof(stream));

            //Asses file ext
            var ext = Path.GetExtension(stream.Name);
            if (ext == ".gz")
            {
                Compression = CompressionScheme.GZip;
            }

            //Assign stream
            Stream = stream;

            //If not testing assign actual stream
            if (stream.FileStreamInstance != null)
            {
                if (Compression == CompressionScheme.None)
                {
                    _reader = new StreamReaderWrap(stream.FileStreamInstance);
                }
                else if (Compression == CompressionScheme.GZip)
                {
                    // Toggle between the x86 and x64 bit dll
                   // var path = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location),Environment.Is64BitProcess ? "x64" : "x86", "7z.dll");
                    SevenZipExtractor.SetLibraryPath("C:\\Program Files (x86)\\7-Zip\\7z.dll");

                    _gzipStream = new SevenZipExtractor(stream.FileStreamInstance);
                    //_memoryStream = new MemoryStream();
                    //_gzipStream.ExtractFile(0, _memoryStream);
                    _gzipStream.ExtractArchive("D:\\test.txt");
                    _reader = new StreamReaderWrap(_memoryStream);              
                }
            }
        }
Example #6
0
 public override void Execute(DirectoryInfo targetDirectory, PortableEnvironment portableEnvironment)
 {
     // Decompress the file.
     SevenZipBase.SetLibraryPath(SevenZipLibPath);
     using (var extractor = new SevenZipExtractor(Path.Combine(targetDirectory.FullName, FileName)))
         extractor.ExtractArchive(targetDirectory.FullName);
 }
        internal RarImporterHelper(SevenZipExtractor Sex)
        {
            string FileName = Sex.FileName;
            _DP = Path.GetFileName(FileName);

            StringAlbumParser sa = null;
            _RootDir = Sex.GetRootDir();

            if (_RootDir != null)
            {
                sa = StringAlbumParser.FromDirectoryHelper(_RootDir);
                _RootLength = _RootDir.Path.Length;
            }

            if ((sa == null) || (sa.FounSomething == false))
                sa = StringAlbumParser.FromRarZipName(FileName);

            _Album = sa.AlbumName;
            _Artist = sa.AlbumAuthor;
            _Year = sa.AlbumYear;

            _MaxLengthWithoutRoot = (from path in Sex.SafeArchiveFileNames() let npath = ConvertFileName(path) let len = (npath == null) ? 0 : npath.Length select len).Max();
            _MaxLengthFlat = (from path in Sex.ArchiveFileData let npath = Path.GetFileName(path.SafePath()) where (!path.IsDirectory) select npath.Length).Max();
            _MaxLengthBasic = (from path in Sex.SafeArchiveFileNames() select path.Length).Max();

            if (_MaxLengthFlat > _MaxLengthWithoutRoot)
                throw new Exception("Algo Error");

            if (_MaxLengthWithoutRoot > _MaxLengthBasic)
                throw new Exception("Algo Error");
        }
Example #8
0
        public static byte[] ExtractBytes(byte[] data)
        {
            Inits.EnsureBinaries();

            using (var inStream = new MemoryStream(data))
            {
                using (var outStream = new MemoryStream())
                {
                    try
                    {
                        using (var extract = new SevenZipExtractor(inStream))
                        {
                            extract.ExtractFile(0, outStream);
                            return outStream.ToArray();
                        }
                    }
                    catch
                    {
                        try
                        {
                            return SevenZipExtractor.ExtractBytes(inStream.ToArray());
                        }
                        catch { return null; }
                    }
                }
            }
        }
        public TickReader(FileInfo file)
        {
            Serializer = new PbTickSerializer();
            Codec = new QuantBox.Data.Serializer.V2.PbTickCodec();
            _stream = new MemoryStream();
            _originalLength = (int)file.Length;

            // 加载文件,支持7z解压
            var fileStream = file.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
            {
                try
                {
                    using (var zip = new SevenZipExtractor(fileStream))
                    {
                        zip.ExtractFile(0, _stream);
                        _stream.Seek(0, SeekOrigin.Begin);
                    }
                }
                catch
                {
                    _stream = fileStream;
                    _stream.Seek(0, SeekOrigin.Begin);
                }
            }
        }
Example #10
0
        /// <summary>
        /// Extracts all files from the archive in one go.
        /// </summary>
        private void ExtractComplete(SevenZip.SevenZipExtractor extractor)
        {
            _unitsByte            = false;
            UnitsTotal            = 100;
            extractor.Extracting += (sender, e) => { UnitsProcessed = e.PercentDone; };

            CancellationToken.ThrowIfCancellationRequested();
            if (string.IsNullOrEmpty(SubDir))
            {
                extractor.ExtractArchive(EffectiveTargetDir);
            }
            else
            {
                // Use an intermediate temp directory (on the same filesystem)
                string tempDir = Path.Combine(TargetDir, Path.GetRandomFileName());
                extractor.ExtractArchive(tempDir);

                // Get only a specific subdir even though we extracted everything
                string subDir     = FileUtils.UnifySlashes(SubDir);
                string tempSubDir = Path.Combine(tempDir, subDir);
                if (!FileUtils.IsBreakoutPath(subDir) && Directory.Exists(tempSubDir))
                {
                    new MoveDirectory(tempSubDir, EffectiveTargetDir, overwrite: true).Run(CancellationToken);
                }
                Directory.Delete(tempDir, recursive: true);
            }
            CancellationToken.ThrowIfCancellationRequested();
        }
        private void Decompress(string[] args)
        {
            //If no file name is specified, write usage text.

            if (args.Length == 0)
            {
                Console.WriteLine("error");
            }
            else
            {
                for (int i = 0; i < args.Length; i++)
                {
                    if (File.Exists(args[i]))
                    {
                        SevenZipExtractor.SetLibraryPath(@"C:\Users\thlacroi\AppData\Local\Apps\COMOS\COMOS Walkinside 6.2 (64 bit)\7z.dll");
                        using (var tmp = new SevenZipExtractor(args[i]))
                        {
                            for (int n = 0; n < tmp.ArchiveFileData.Count; n++)
                            {
                                if (tmp.ArchiveFileData[n].FileName.Contains(".xml"))
                                {
                                    tmp.ExtractFiles(Path.Combine(Resource.DirectoryTmp, i.ToString()), tmp.ArchiveFileData[n].Index);
                                }
                            }
                        }
                    }
                }
            }
        }
        public static String docxParser(String filename)
        {
            //path to the systems temporary folder
            String tempFolderPath = Path.GetTempPath();

            //set the path of the 7z.dll (it needs to be in the debug folder)
            SevenZipExtractor.SetLibraryPath("7z.dll");

            SevenZipExtractor extractor = new SevenZipExtractor(filename);

            //create a filestream for the file we are going to extract
            FileStream f = new FileStream(tempFolderPath + "document.xml", FileMode.Create);

            //extract the document.xml
            extractor.ExtractFile("word\\document.xml", f);

            //get rid of the object because it is unmanaged
            extractor.Dispose();

            //close the filestream
            f.Close();

            //send document.xml that we extracted from the .docx to the xml parser
            String result = XMLParser.Parser.ParseXMLtoString(tempFolderPath + "document.xml");

            //delete the extracted file from the temp folder
            File.Delete(tempFolderPath + "document.xml");

            return result;
        }
Example #13
0
 public static void Extract(string file, string to)
 {
     using (var extractor = new SevenZipExtractor(file))
     {
         extractor.ExtractArchive(to);
     }
 }
Example #14
0
        public DirectoryInfo extractToTemp(bool force)
        {
            string modRoot;

            DirectoryInfo temp = new DirectoryInfo(TempPath);
            modRoot = Path.Combine(
                temp.FullName,
                Path.GetFileNameWithoutExtension(
                Path.GetFileNameWithoutExtension(
                FilePath)));
            DirectoryInfo modRootInfo = new DirectoryInfo(modRoot);
            if (Directory.Exists(modRoot) && !force)
            {

                m_extractedRoot = modRootInfo;
                return modRootInfo;
            }
            else
            {
                SevenZipExtractor extractor = new SevenZipExtractor(FilePath);
                modRootInfo.Create();
                extractor.ExtractArchive(modRoot);
                m_extractedRoot = modRootInfo;
                return modRootInfo;
            }
        }
Example #15
0
        public void Update()
        {
            if (!IsUpdateAvailable())
            {
                throw new LauncherException("no update is available");
            }

            using (var mutex = new WurmAssistantMutex())
            {
                mutex.Enter(1000, "You must close Wurm Assistant before running update");
                var newFileZipped = WebApiClientSpellbook.GetFileFromWebApi(
                    AppContext.WebApiBasePath,
                    string.Format("{0}/{1}", AppContext.ProjectName, buildType),
                    TimeSpan.FromSeconds(15),
                    BasePath);

                using (var extractor = new SevenZipExtractor(newFileZipped.FullName))
                {
                    extractor.ExtractArchive(BasePath);
                }

                Thread.Sleep(1000);

                var cleaner = new DirCleaner(BasePath);
                cleaner.Cleanup();
            }
        }
Example #16
0
        /// <summary>
        /// Extracts files from the archive one-by-one.
        /// </summary>
        private void ExtractIndividual(SevenZip.SevenZipExtractor extractor)
        {
            _unitsByte = true;
            UnitsTotal = extractor.UnpackedSize;

            foreach (var entry in extractor.ArchiveFileData)
            {
                string relativePath = GetRelativePath(entry.FileName.Replace('\\', '/'));
                if (relativePath == null)
                {
                    continue;
                }

                if (entry.IsDirectory)
                {
                    CreateDirectory(relativePath, entry.LastWriteTime);
                }
                else
                {
                    using (var stream = OpenFileWriteStream(relativePath))
                        extractor.ExtractFile(entry.Index, stream);
                    File.SetLastWriteTimeUtc(CombinePath(relativePath), DateTime.SpecifyKind(entry.LastWriteTime, DateTimeKind.Utc));

                    UnitsProcessed += (long)entry.Size;
                }
            }
            SetDirectoryWriteTimes();
        }
 internal DirectoryHandle CreateByUnzippingFile(string zipFilePath)
 {
     var dir = CreateTempDirectory();
     zipFilePath = AbsolutizePath(zipFilePath);
     var extractor =
         new SevenZipExtractor(File.OpenRead(zipFilePath));
     extractor.ExtractArchive(dir.FullName);
     return new DirectoryHandle(this, dir);
 }
Example #18
0
 public static void extract(string fileName, string directory)
 {
     SevenZipExtractor.SetLibraryPath("7z.dll");
     SevenZipExtractor extractor = new SevenZipExtractor(fileName);
     extractor.Extracting += new EventHandler<ProgressEventArgs>(extr_Extracting);
     extractor.FileExtractionStarted += new EventHandler<FileInfoEventArgs>(extr_FileExtractionStarted);
     extractor.ExtractionFinished += new EventHandler<EventArgs>(extr_ExtractionFinished);
     extractor.ExtractArchive(directory);
 }
Example #19
0
        /// <inheritdoc/>
        protected override void Execute()
        {
            State = TaskState.Header;

            try
            {
                // NOTE: Must do initialization here since the constructor may be called on a different thread and SevenZipSharp is thread-affine
                SevenZipBase.SetLibraryPath(Locations.GetInstalledFilePath(WindowsUtils.Is64BitProcess ? "7zxa-x64.dll" : "7zxa.dll"));

                using (var extractor = new SevenZip.SevenZipExtractor(_stream))
                {
                    State = TaskState.Data;
                    if (!Directory.Exists(EffectiveTargetDir))
                    {
                        Directory.CreateDirectory(EffectiveTargetDir);
                    }
                    if (extractor.IsSolid || string.IsNullOrEmpty(SubDir))
                    {
                        ExtractComplete(extractor);
                    }
                    else
                    {
                        ExtractIndividual(extractor);
                    }
                }
            }
            #region Error handling
            catch (ObjectDisposedException ex)
            {
                // Async cancellation may cause underlying file stream to be closed
                Log.Warn(ex);
                throw new OperationCanceledException();
            }
            catch (SevenZipException ex)
            {
                // Wrap exception since only certain exception types are allowed
                throw new IOException(Resources.ArchiveInvalid, ex);
            }
            catch (KeyNotFoundException ex)
            {
                // Wrap exception since only certain exception types are allowed
                throw new IOException(Resources.ArchiveInvalid, ex);
            }
            catch (ArgumentException ex)
            {
                // Wrap exception since only certain exception types are allowed
                throw new IOException(Resources.ArchiveInvalid, ex);
            }
            catch (NullReferenceException ex)
            {
                // Wrap exception since only certain exception types are allowed
                throw new IOException(Resources.ArchiveInvalid, ex);
            }
            #endregion

            State = TaskState.Complete;
        }
Example #20
0
 public void Unpack(string outputPath)
 {
     SevenZipExtractor tmp = new SevenZipExtractor(_targetPath);
     tmp.FileExtractionStarted += new EventHandler<IndexEventArgs>((s, e) =>
     {
         Console.WriteLine(String.Format("[{0}%] {1}", 
             e.PercentDone, tmp.ArchiveFileData[e.FileIndex].FileName));
     });
     tmp.ExtractionFinished += new EventHandler((s, e) => {Console.WriteLine("Finished!");});
     tmp.ExtractArchive(outputPath);
 }
Example #21
0
 static void UnpackArchive(IAbsoluteFilePath sourceFile, IAbsoluteDirectoryPath outputFolder, bool overwrite,
     bool checkFileIntegrity,
     SevenZipExtractor extracter) {
     if (checkFileIntegrity && !extracter.Check())
         throw new Exception(String.Format("Appears to be an invalid archive: {0}", sourceFile));
     outputFolder.MakeSurePathExists();
     extracter.ExtractFiles(outputFolder.ToString(), overwrite
         ? extracter.ArchiveFileNames.ToArray()
         : extracter.ArchiveFileNames.Where(x => !outputFolder.GetChildFileWithName(x).Exists)
             .ToArray());
 }
Example #22
0
        public int Decompress(PointCloudTile tile, byte[] compressedBuffer, int count, byte[] uncompressedBuffer)
        {
            MemoryStream uncompressedStream = new MemoryStream(uncompressedBuffer);
            MemoryStream compressedStream = new MemoryStream(compressedBuffer, 0, count, false);

            using (SevenZipExtractor extractor = new SevenZipExtractor(compressedStream))
            {
                extractor.ExtractFile(0, uncompressedStream);
            }

            return (int)uncompressedStream.Position;
        }
Example #23
0
        public LoadedFilesData LoadComicBook(string[] files)
        {
            LoadedFilesData returnValue = new LoadedFilesData { ComicBook = new ComicBook() };
            Array.Sort(files);
            if (files.Any(file => !System.IO.File.Exists(file)))
            {
                returnValue.Error = "One or more archives were not found";
                return returnValue;
            }

            var comicFile = new ComicFile {Location = files[0]};
            returnValue.ComicBook.Add(comicFile);

            int initialFilesToRead;
            using (SevenZipExtractor extractor = new SevenZipExtractor(files[0]))
            {
                // "bye bye love letter" comic has a folder whose name ends in .PNG, and the extractor thinks it is an image
                List<string> tempFileNames = new List<string>();
                foreach (var archiveFileInfo in extractor.ArchiveFileData)
                {
                    if (!archiveFileInfo.IsDirectory)
                        tempFileNames.Add(archiveFileInfo.FileName);
                }
                _fileNames = tempFileNames.ToArray();
                if (_fileNames.Length < 1) // Nothing to show!
                    return returnValue;

                ArchiveLoader.NumericalSort(_fileNames);

                // The file count may be out-of-sync between the extractor and _filenames, due to skipped folders above
                // Load the first 5 files (if possible) before returning to GUI
                initialFilesToRead = Math.Min(5, _fileNames.Count()); // extractor.FilesCount);
                for (int j = 0; j < initialFilesToRead; j++)
                {
                    ExtractFile(extractor, j, comicFile);
                }
            }

            // Load remaining files in the background
            _t1 = new Thread(() =>
            {
                using (SevenZipExtractor extractor2 = new SevenZipExtractor(files[0])) // need 2d extractor for thread: see comment at top of file
                {
                    for (int i = initialFilesToRead; i < _fileNames.Length; i++)
                    {
                        ExtractFile(extractor2, i, comicFile);
                    }
                }
            });
            _t1.Start();

            return returnValue;
        }
Example #24
0
 static public void extract(string fileName, string directory) {
     SevenZipExtractor.SetLibraryPath("7z.dll");
     try {
         SevenZipExtractor extractor = new SevenZipExtractor(fileName);
         extractor.Extracting += new EventHandler<ProgressEventArgs>(extr_Extracting);
         extractor.FileExtractionStarted += new EventHandler<FileInfoEventArgs>(extr_FileExtractionStarted);
         extractor.ExtractionFinished += new EventHandler<EventArgs>(extr_ExtractionFinished);
         extractor.ExtractArchive(directory);
     } 
     catch (System.IO.FileNotFoundException e) {
         MessageBox.Show(e.Message);
     }
 }
        public void ShowArchiveContent(object sender, EventArgs args)
        {
            archiveTree.Nodes.Clear();
            var defrag = new SevenZipExtractor(_pathArchive);
            defrag.PreserveDirectoryStructure = true;

            var parentNode = new TreeNode(defrag.FileName);

            ReadDirectory(defrag.ArchiveFileData, parentNode, 0);
            //archiveTree.Nodes.Add(parentNode);
            //archiveTree.Update();

        }
Example #26
0
 private void b_Extract_Click(object sender, RoutedEventArgs e)
 {
     //SevenZipExtractor.SetLibraryPath(@"C:\Program Files\7-Zip\7z.dll");
     tb_Messages.Text = "Started" + Environment.NewLine;
     string fileName = tb_ExtractArchive.Text;
     string directory = tb_ExtractFolder.Text;
     var extractor = new SevenZipExtractor(fileName);
     extractor.Extracting += new EventHandler<ProgressEventArgs>(extr_Extracting);
     extractor.FileExtractionStarted += new EventHandler<FileInfoEventArgs>(extr_FileExtractionStarted);
     extractor.FileExists += new EventHandler<FileOverwriteEventArgs>(extr_FileExists);
     extractor.ExtractionFinished += new EventHandler<EventArgs>(extr_ExtractionFinished);
     extractor.BeginExtractArchive(directory);
 }
 public void TestRead()
 {
     var file = new FileInfo("TickDataV1_1");
     using (var stream = new MemoryStream())
     using (var fileStream = file.Open(FileMode.Open, FileAccess.Read, FileShare.ReadWrite))
     using (var zip = new SevenZipExtractor(fileStream)) {
         zip.ExtractFile(0, stream);
         stream.Seek(0, SeekOrigin.Begin);
         var serializer = new PbTickSerializer();
         var codec = new PbTickCodec();
         foreach (var tick in serializer.Read(stream)) {
         }
     }
 }
Example #28
0
        public void Extract(string archivePath, string filePath, string destFilePath)
        {
            using (var destFileStream = new FileStream(destFilePath, FileMode.Create, FileAccess.Write))
            {
                this.SetLibraryPath();

                var extractor = new SevenZipExtractor(archivePath);
                extractor.ExtractionFinished += this.ExtractionFinished;

                extractor.ExtractFile(filePath, destFileStream);

                destFileStream.Flush();
                destFileStream.Close();
            }
        }
Example #29
0
        /// <summary>
        /// 解壓
        /// </summary>
        /// <param name="archiveName"></param>
        /// <param name="exportFolder"></param>
        public static void ExtractFiles(string archiveName, string exportFolder)
        {
            string sFile = System.IO.Path.Combine(Environment.CurrentDirectory, "7z.dll");

            SevenZip.SevenZipCompressor.SetLibraryPath(sFile);

            string fileExt = System.IO.Path.GetExtension(archiveName).ToLower();

            if (fileExt == ".7z" || fileExt == ".zip" || fileExt == ".rar")
            {
                //Can not load 7-zip library or internal COM error! Message: DLL file does not exist.
                var extractor = new SevenZip.SevenZipExtractor(archiveName);
                extractor.ExtractArchive(exportFolder);
            }
        }
Example #30
0
        void wc_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                MessageBox.Show(e.Error.Message, "Error");
                Application.Exit();
            }
            lblStatus.Text = "Decompressing...";
            probar.Style = ProgressBarStyle.Blocks;
            SevenZipExtractor extractor = new SevenZip.SevenZipExtractor(Application.StartupPath + "\\Update.zip");
            extractor.Extracting += new EventHandler<ProgressEventArgs>(extractor_Extracting);
            extractor.ExtractionFinished += new EventHandler<EventArgs>(extractor_ExtractionFinished);

            extractor.BeginExtractArchive(Application.StartupPath);
        }
Example #31
0
        private void ReadChunk()
        {
            long size;

            byte[] properties;
            try
            {
                properties = SevenZipExtractor.GetLzmaProperties(_input, out size);
            }
            catch (Exception)
            {
                _error = true;
                return;
            }
            if (!_firstChunkRead)
            {
                _commonProperties = properties;
            }
            if (_commonProperties[0] != properties[0] ||
                _commonProperties[1] != properties[1] ||
                _commonProperties[2] != properties[2] ||
                _commonProperties[3] != properties[3] ||
                _commonProperties[4] != properties[4])
            {
                _error = true;
                return;
            }

#if ORIG
            if (_buffer.Capacity < (int)size)
            {
                _buffer.Capacity = (int)size;
            }
            _buffer.SetLength(size);
#else
            // I MODIFIED THESE LINES FROM THE ORIGINAL. IT NOW USES A 32KB BUFFER FOR ALL CHUNK READS.
            // RATHER THAN THE 'outSize' FOR ME WAS ALWAYS RETURNING -1 AND HENCE SETLENGTH WOULD THROW
            // AN EXCEPTION. PAIR THIS STREAM WITH A SIMPLE COPYTO() OPERATION AND YOU HAVE A WORKING
            // STREAMED EXTRACTOR.
            _buffer.Capacity = 1024 * 32;
            _buffer.SetLength(_buffer.Capacity);
#endif

            _decoder.SetDecoderProperties(properties);
            _buffer.Position = 0;
            _decoder.Code(_input, _buffer, 0, size, null);
            _buffer.Position = 0;
        }
        /// <inheritdoc/>
        protected override void Execute()
        {
            State = TaskState.Header;

            try
            {
                // NOTE: Must do initialization here since the constructor may be called on a different thread and SevenZipSharp is thread-affine
                SevenZipBase.SetLibraryPath(Locations.GetInstalledFilePath(WindowsUtils.Is64BitProcess ? "7zxa-x64.dll" : "7zxa.dll"));

                using (var extractor = new SevenZip.SevenZipExtractor(_stream))
                {
                    State = TaskState.Data;
                    if (!Directory.Exists(EffectiveTargetDir)) Directory.CreateDirectory(EffectiveTargetDir);
                    if (extractor.IsSolid || string.IsNullOrEmpty(SubDir)) ExtractComplete(extractor);
                    else ExtractIndividual(extractor);
                }
            }
                #region Error handling
            catch (ObjectDisposedException ex)
            {
                // Async cancellation may cause underlying file stream to be closed
                Log.Warn(ex);
                throw new OperationCanceledException();
            }
            catch (SevenZipException ex)
            {
                // Wrap exception since only certain exception types are allowed
                throw new IOException(Resources.ArchiveInvalid, ex);
            }
            catch (KeyNotFoundException ex)
            {
                // Wrap exception since only certain exception types are allowed
                throw new IOException(Resources.ArchiveInvalid, ex);
            }
            catch (ArgumentException ex)
            {
                // Wrap exception since only certain exception types are allowed
                throw new IOException(Resources.ArchiveInvalid, ex);
            }
            catch (NullReferenceException ex)
            {
                // Wrap exception since only certain exception types are allowed
                throw new IOException(Resources.ArchiveInvalid, ex);
            }
            #endregion

            State = TaskState.Complete;
        }
Example #33
0
		public static byte[] DecompressBytes(byte[] data)
		{
			byte[] uncompressedbuffer = null;
	        using (MemoryStream compressedbuffer = new MemoryStream(data))
	        {
	            using (SevenZipExtractor extractor = new SevenZipExtractor(compressedbuffer))
	            {
	                using (MemoryStream msout = new MemoryStream())
	                {
	                    extractor.ExtractFile(0, msout);
	                    uncompressedbuffer = msout.ToArray();
	                }
	            }
	        }
	        return uncompressedbuffer;
		}
Example #34
0
        private void ExtractFile( SevenZipExtractor extractor, ManifestFile file)
        {
            using (var destFileStream = new FileStream(file.InstallPath, FileMode.Create, FileAccess.Write))
            {
                try
                {
                    extractor.ExtractFile(file.File, destFileStream);
                }
                catch (Exception exception)
                {
                }

                destFileStream.Flush();
                destFileStream.Close();
            }
        }
Example #35
0
        void wc_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
        {
            if (e.Error != null)
            {
                MessageBox.Show(e.Error.Message, "Error");
                Application.Exit();
            }
            lblStatus.Text = "Decompressing...";
            probar.Style   = ProgressBarStyle.Blocks;
            SevenZipExtractor extractor = new SevenZip.SevenZipExtractor(Application.StartupPath + "\\Update.zip");

            extractor.Extracting         += new EventHandler <ProgressEventArgs>(extractor_Extracting);
            extractor.ExtractionFinished += new EventHandler <EventArgs>(extractor_ExtractionFinished);

            extractor.BeginExtractArchive(Application.StartupPath);
        }
Example #36
0
        protected SevenZipBaseEx(PscxCmdlet command, FileInfo file, InArchiveFormat format)
        {
            //Debug.Assert(format != ArchiveFormat.Unknown, "format != ArchiveFormat.Unknown");

            _command         = command;
            _file            = file;
            _format          = format;
            _archivePscxPath = PscxPathInfo.GetPscxPathInfo(_command.SessionState, file.FullName);

            string sevenZDll  = PscxContext.Instance.Is64BitProcess ? "7z64.dll" : "7z.dll";
            string sevenZPath = Path.Combine(PscxContext.Instance.Home, sevenZDll);

            Trace.Assert(File.Exists(sevenZPath), sevenZPath + " not found or inaccessible.");

            SevenZipBase.SetLibraryPath(sevenZPath);
            _extractor = new SevenZipExtractor(file.FullName);
        }
Example #37
0
            public virtual void Unpack(IAbsoluteFilePath sourceFile, IAbsoluteDirectoryPath outputFolder,
                bool overwrite = false, bool fullPath = true, bool force7z = false, bool checkFileIntegrity = true,
                ITProgress progress = null) {
                Contract.Requires<ArgumentNullException>(sourceFile != null);
                Contract.Requires<ArgumentNullException>(outputFolder != null);

                var ext = sourceFile.FileExtension;
                if (force7z ||
                    SevenzipArchiveFormats.Any(x => ext.Equals(x, StringComparison.OrdinalIgnoreCase))) {
                    using (var extracter = new SevenZipExtractor(sourceFile.ToString()))
                        UnpackArchive(sourceFile, outputFolder, overwrite, checkFileIntegrity, extracter);
                } else {
                    var options = fullPath ? ExtractOptions.ExtractFullPath : ExtractOptions.None;
                    using (var archive = GetArchiveWithGzWorkaround(sourceFile, ext))
                        UnpackArchive(outputFolder, overwrite, archive, options);
                }
            }
Example #38
0
 /// <summary>
 /// Extracts and archive to the given directory
 /// </summary>
 /// <param name="inFile">Path to the archive to extract</param>
 /// <param name="outDir">The path to the target directory for extraction</param>
 public static void ExtractArchive(string inFile, string outDir)
 {
     SevenZipBase.SetLibraryPath(PathHelper.SevenZipLibrary);
     try
     {
         _extractor = new SevenZipExtractor(inFile);
         if (!Directory.Exists(outDir))
             Directory.CreateDirectory(outDir);
         _extractor.ExtractionFinished += ExtractorExtractionFinished;
         _extractor.BeginExtractArchive(outDir);
     }
     catch
     {
         MessageBox.Show("Failed to extract ARChive.",
             "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }
        // Returns plain string from compressed and encoded input
        private static String myDecode(string input)
        {
            // Create a memory stream from the input: base64 --> bytes --> memStream
            Byte[]       compBytes    = Convert.FromBase64String(input);
            MemoryStream compStreamIn = new MemoryStream(compBytes);

            SevenZipExtractor.SetLibraryPath(@"C:\Temp\7za64.dll");
            var SevenZipE    = new SevenZip.SevenZipExtractor(compStreamIn, "Optional Password Field");
            var OutputStream = new MemoryStream();

            SevenZipE.ExtractFile(0, OutputStream);
            var OutputBase64 = Convert.ToBase64String(OutputStream.ToArray());

            Byte[] OutputBytes = Convert.FromBase64String(OutputBase64);
            string output      = Encoding.UTF8.GetString(OutputBytes);

            return(output);
        }
        static void Main(string[] args)
        {
            var log = new StreamWriter(ConfigurationManager.AppSettings["output_file"])
            {
                AutoFlush = true
            };
            var re = new System.Text.RegularExpressions.Regex(@"\d{7,8}-[\dkK]");

            Console.Write("Descomprimiendo el archivo {0}.7z... ", ConfigurationManager.AppSettings["path_file_contribuyentes"]);
            var ms = new MemoryStream();

            SevenZip.SevenZipExtractor.SetLibraryPath("7z-x86.dll");
            var sevenZip = new SevenZip.SevenZipExtractor(ConfigurationManager.AppSettings["path_file_contribuyentes"] + ".7z");

            sevenZip.ExtractFile(ConfigurationManager.AppSettings["path_file_contribuyentes"] + ".csv", ms);
            Console.Write("Ok!\n\r");

            Console.Write("Leyendo el archivo {0}.csv... ", ConfigurationManager.AppSettings["path_file_contribuyentes"]);
            var binaryContent = ms.GetBuffer();
            var stringContent = System.Text.Encoding.GetEncoding("UTF-8").GetString(binaryContent);

            Console.Write("Ok!\n\r");

            Console.Write("Procesando registros...\n\r");
            var contribuyentes = stringContent.Split(new string[] { Environment.NewLine }, StringSplitOptions.None);

            foreach (var contribuyente in contribuyentes)
            {
                var arr = contribuyente.Split(';');
                if (re.IsMatch(arr[0]))
                {
                    var rut = arr[0].Split('-')[0];
                    var dv  = arr[0].Split('-')[1];

                    var resultado = GetDocumentosAutorizados(rut, dv);

                    Console.WriteLine(resultado);
                    log.WriteLine(resultado);
                }
            }

            Console.Write("\n\rPresione cualquier teclar para continuar...\n\r");
            Console.ReadKey();
        }
Example #41
0
        private static bool ExtractionBenchmark(string archiveFileName, Stream outStream, ref LibraryFeature?features, LibraryFeature testedFeature)
        {
            var stream = Assembly.GetExecutingAssembly().GetManifestResourceStream(GetResourceString(archiveFileName));

            try
            {
                using (var extractor = new SevenZipExtractor(stream))
                {
                    extractor.ExtractFile(0, outStream);
                }
            }
            catch (Exception)
            {
                return(false);
            }

            features |= testedFeature;
            return(true);
        }
Example #42
0
        private void Init(IInArchive archive, string directory, int filesCount, bool directoryStructure,
            List<uint> actualIndexes, Dictionary<uint, string> altPaths, SevenZipExtractor extractor)
        {
            CommonInit(archive, filesCount, extractor);
            _directory = directory;
            _actualIndexes = actualIndexes;
            _actualIndexesFastCheck = new Dictionary<uint,bool>();
            if(actualIndexes != null)
            {
                foreach(uint index in actualIndexes)
                    _actualIndexesFastCheck.Add(index, true);
            }

            _altPaths = altPaths;
            _directoryStructure = directoryStructure;
            if (!directory.EndsWith("" + Path.DirectorySeparatorChar, StringComparison.CurrentCulture))
            {
                _directory += Path.DirectorySeparatorChar;
            }
        }
        private void ReadChunk()
        {
            long size;

            byte[] properties;
            try
            {
                properties = SevenZipExtractor.GetLzmaProperties(_input, out size);
            }
            catch (LzmaException)
            {
                _error = true;
                return;
            }
            if (!_firstChunkRead)
            {
                _commonProperties = properties;
            }
            if (_commonProperties[0] != properties[0] ||
                _commonProperties[1] != properties[1] ||
                _commonProperties[2] != properties[2] ||
                _commonProperties[3] != properties[3] ||
                _commonProperties[4] != properties[4])
            {
                _error = true;
                return;
            }
            if (_buffer.Capacity < (int)size)
            {
                _buffer.Capacity = (int)size;
            }
            _buffer.SetLength(size);
            _decoder.SetDecoderProperties(properties);
            _buffer.Position = 0;
            _decoder.Code(
                _input, _buffer, 0, size, null);
            _buffer.Position = 0;
        }
 private void Init(IInArchive archive, Stream stream, int filesCount, uint fileIndex, SevenZipExtractor extractor)
 {
     CommonInit(archive, filesCount, extractor);
     _fileStream = new OutStreamWrapper(stream, false);
     _fileStream.BytesWritten += IntEventArgsHandler;
     _fileIndex = fileIndex;
 }
 private void Init(IInArchive archive, string directory, int filesCount, bool directoryStructure, List <uint> actualIndexes, SevenZipExtractor extractor)
 {
     CommonInit(archive, filesCount, extractor);
     _directory          = directory;
     _actualIndexes      = actualIndexes;
     _directoryStructure = directoryStructure;
     if (!directory.EndsWith("" + Path.DirectorySeparatorChar, StringComparison.CurrentCulture))
     {
         _directory += Path.DirectorySeparatorChar;
     }
 }
        const int MEMORY_PRESSURE = 64 * 1024 * 1024; //64mb seems to be the maximum value

        #region Constructors

        /// <summary>
        /// Initializes a new instance of the ArchiveExtractCallback class
        /// </summary>
        /// <param name="archive">IInArchive interface for the archive</param>
        /// <param name="directory">Directory where files are to be unpacked to</param>
        /// <param name="filesCount">The archive files count</param>'
        /// <param name="extractor">The owner of the callback</param>
        /// <param name="actualIndexes">The list of actual indexes (solid archives support)</param>
        /// <param name="directoryStructure">The value indicating whether to preserve directory structure of extracted files.</param>
        public ArchiveExtractCallback(Func <uint, OutStreamWrapper> getStream, IInArchive archive, string directory, int filesCount, bool directoryStructure,
                                      List <uint> actualIndexes, SevenZipExtractor extractor)
        {
            this._getStream = getStream;
            Init(archive, directory, filesCount, directoryStructure, actualIndexes, extractor);
        }
 /// <summary>
 /// Initializes a new instance of the ArchiveExtractCallback class
 /// </summary>
 /// <param name="archive">IInArchive interface for the archive</param>
 /// <param name="stream">The stream where files are to be unpacked to</param>
 /// <param name="filesCount">The archive files count</param>
 /// <param name="fileIndex">The file index for the stream</param>
 /// <param name="extractor">The owner of the callback</param>
 public ArchiveExtractCallback(Func <uint, OutStreamWrapper> getStream, IInArchive archive, Stream stream, int filesCount, uint fileIndex,
                               SevenZipExtractor extractor)
 {
     this._getStream = getStream;
     Init(archive, stream, filesCount, fileIndex, extractor);
 }
 public ArchiveExtractCallback(IInArchive archive, ExtractionHandler callback, int filesCount,
                               List <uint> actualIndexes, string password, SevenZipExtractor extractor)
     : base(password)
 {
     Init(archive, callback, filesCount, actualIndexes, extractor);
 }
 /// <summary>
 /// Initializes a new instance of the ArchiveExtractCallback class
 /// </summary>
 /// <param name="archive">IInArchive interface for the archive</param>
 /// <param name="stream">The stream where files are to be unpacked to</param>
 /// <param name="filesCount">The archive files count</param>
 /// <param name="fileIndex">The file index for the stream</param>
 /// <param name="password">Password for the archive</param>
 /// <param name="extractor">The owner of the callback</param>
 public ArchiveExtractCallback(IInArchive archive, Stream stream, int filesCount, uint fileIndex, string password,
                               SevenZipExtractor extractor)
     : base(password)
 {
     Init(archive, stream, filesCount, fileIndex, extractor);
 }
 /// <summary>
 /// Initializes a new instance of the ArchiveExtractCallback class
 /// </summary>
 /// <param name="archive">IInArchive interface for the archive</param>
 /// <param name="stream">The stream where files are to be unpacked to</param>
 /// <param name="filesCount">The archive files count</param>
 /// <param name="fileIndex">The file index for the stream</param>
 /// <param name="extractor">The owner of the callback</param>
 public ArchiveExtractCallback(IInArchive archive, Stream stream, int filesCount, uint fileIndex,
                               SevenZipExtractor extractor)
 {
     Init(archive, stream, filesCount, fileIndex, extractor);
 }
 /// <summary>
 /// Initializes a new instance of the ArchiveExtractCallback class
 /// </summary>
 /// <param name="archive">IInArchive interface for the archive</param>
 /// <param name="directory">Directory where files are to be unpacked to</param>
 /// <param name="filesCount">The archive files count</param>
 /// <param name="password">Password for the archive</param>
 /// <param name="extractor">The owner of the callback</param>
 /// <param name="actualIndexes">The list of actual indexes (solid archives support)</param>
 /// <param name="directoryStructure">The value indicating whether to preserve directory structure of extracted files.</param>
 public ArchiveExtractCallback(IInArchive archive, string directory, int filesCount, bool directoryStructure,
                               List <uint> actualIndexes, string password, SevenZipExtractor extractor)
     : base(password)
 {
     Init(archive, directory, filesCount, directoryStructure, actualIndexes, extractor);
 }
Example #52
0
        private static DataTable LoadCAMTFile(string sourceFile)
        {
            Hashtable   picfiles = new Hashtable();
            XmlDocument xml      = new XmlDocument();

            using (SevenZip.SevenZipExtractor extractorgz = new SevenZip.SevenZipExtractor(sourceFile))
            {
                byte[]       gz   = null;
                MemoryStream msgz = new MemoryStream();
                extractorgz.ExtractFile(0, msgz);
                msgz.Position = 0;


                using (SevenZip.SevenZipExtractor extractortar = new SevenZipExtractor(msgz))
                {
                    foreach (string fn in extractortar.ArchiveFileNames)
                    {
                        MemoryStream mstar = new MemoryStream();
                        extractortar.ExtractFile(fn, mstar);
                        mstar.Position = 0;

                        if (fn.ToUpper().EndsWith(".XML"))
                        {
                            xml = new XmlDocument();
                            xml.Load(mstar);
                        }
                        else
                        {
                            byte[] tiff = mstar.ToArray();
                            picfiles.Add(fn, tiff);
                        }
                        mstar.Close();
                        Console.WriteLine(fn);
                    }
                }
                msgz.Close();
            }

            // Document class created using XSD.EXE from Microsoft SDKs to generate class from XSD file!
            // https://docs.microsoft.com/en-us/dotnet/standard/serialization/xml-schema-def-tool-gen
            XmlSerializer ser       = new XmlSerializer(typeof(Document));
            XmlReader     xmlReader = new XmlNodeReader(xml);
            Document      myDoc     = ser.Deserialize(xmlReader) as Document;

            DataTable dt = new DataTable();

            dt.Columns.Add(new DataColumn("Name", typeof(string)));
            dt.Columns.Add(new DataColumn("Image", typeof(byte[])));
            dt.Columns.Add(new DataColumn("AcctIdIBAN", typeof(string)));
            dt.Columns.Add(new DataColumn("AcctOwnrNm", typeof(string)));
            dt.Columns.Add(new DataColumn("NtryAmt", typeof(string)));

            foreach (var stmt in myDoc.BkToCstmrStmt.Stmt)
            {
                foreach (var ntry in stmt.Ntry)
                {
                    foreach (var ntrydtls in ntry.NtryDtls)
                    {
                        foreach (var txdtls in ntrydtls.TxDtls)
                        {
                            DataRow dr  = dt.NewRow();
                            string  AMT = txdtls.Amt.Value.ToString();
                            if (txdtls.Refs != null && txdtls.Refs.Prtry != null)
                            {
                                foreach (var prtry in txdtls.Refs.Prtry)
                                {
                                    if (prtry.Ref != null)
                                    {
                                        foreach (string k in picfiles.Keys)
                                        {
                                            if (k.Contains(prtry.Ref))
                                            {
                                                dr["Name"]  = k;
                                                dr["Image"] = picfiles[k];
                                            }
                                        }
                                    }
                                }
                            }
                            dr["AcctIdIBAN"] = (txdtls.RltdPties == null || txdtls.RltdPties.DbtrAcct == null) ? string.Empty : txdtls.RltdPties.DbtrAcct.Id.Item;
                            dr["AcctOwnrNm"] = (txdtls.RltdPties == null || txdtls.RltdPties.Dbtr == null)
                                ? string.Empty
                                : txdtls.RltdPties.Dbtr.Nm;
                            dr["NtryAmt"] = AMT;

                            if (!string.IsNullOrWhiteSpace(dr["Name"] + string.Empty))
                            {
                                dt.Rows.Add(dr);
                            }
                        }
                    }
                }
            }
            return(dt);
        }
Example #53
0
 private ArchiveFileInfo GetArchiveFileInfo(SevenZibSharp.ArchiveFileInfo entry, SevenZibSharp.SevenZipExtractor archiveFile)
 {
     using (var entryStream = new MemoryStream())
     {
         archiveFile.ExtractFile(entry.FileName, entryStream);
         var retVal = new ArchiveFileInfo
         {
             FileName = entry.FileName,
             Content  = entryStream.ToArray()
         };
         entryStream.Close();
         return(retVal);
     }
 }
Example #54
0
        private async void unzip(string path)
        {
            progressBar1.Minimum = 0;
            progressBar1.Maximum = 100;
            progressBar1.Value   = 0;
            progressBar1.Visible = true;

            var progressHandler = new Progress <byte>(
                percentDone => progressBar1.Value = percentDone);
            var progress     = progressHandler as IProgress <byte>;
            var sevenZipPath = Path.Combine(
                Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "7za.dll");

            SevenZipBase.SetLibraryPath(sevenZipPath);


            var file = new SevenZip.SevenZipExtractor(path);


            file.Extracting += (sender, args) =>
            {
                progress.Report(args.PercentDone);
            };
            file.ExtractionFinished += (sender, args) =>
            {
                // Do stuff when done
                loadlbl.Text = "Successfully Fixed!";
                try
                {
                    if (File.Exists(Path.Combine(System.IO.Path.GetTempPath(), @"ddf.bin1")))
                    {
                        File.Delete(Path.Combine(System.IO.Path.GetTempPath(), @"ddf.bin1"));
                    }

                    if (File.Exists(Path.Combine(System.IO.Path.GetTempPath(), @"ddf.bin2")))
                    {
                        File.Delete(Path.Combine(System.IO.Path.GetTempPath(), @"ddf.bin2"));
                    }

                    if (File.Exists(Path.Combine(System.IO.Path.GetTempPath(), @"ddf.7z")))
                    {
                        File.Delete(Path.Combine(System.IO.Path.GetTempPath(), @"ddf.7z"));
                    }
                }
                catch (SystemException)
                {
                }
                KryptonMessageBox.Show("Operation Success! This was easier than we thought.. ROFL");
                this.Close();
            };
            //Extract the stuff
            string xpath = Path.Combine(AoE2GamePath, @"Data");

            try
            {
                file.ExtractArchive(xpath);
                file.Dispose();
            }
            catch (SystemException)
            {
            }
        }
Example #55
0
 /// <summary>
 /// Initializes a new instance of the ArchiveExtractCallback class
 /// </summary>
 /// <param name="archive">IInArchive interface for the archive</param>
 /// <param name="directory">Directory where files are to be unpacked to</param>
 /// <param name="filesCount">The archive files count</param>'
 /// <param name="extractor">The owner of the callback</param>
 /// <param name="actualIndexes">The list of actual indexes (solid archives support)</param>
 /// <param name="directoryStructure">The value indicating whether to preserve directory structure of extracted files.</param>
 /// <param name="altPaths">Alt Paths.</param>
 public ArchiveExtractCallback(IInArchive archive, string directory, int filesCount, bool directoryStructure,
     List<uint> actualIndexes, Dictionary<uint, string> altPaths, SevenZipExtractor extractor)
 {
     Init(archive, directory, filesCount, directoryStructure, actualIndexes, altPaths, extractor);
 }
Example #56
0
 /// <summary>
 /// Initializes a new instance of the ArchiveExtractCallback class
 /// </summary>
 /// <param name="archive">IInArchive interface for the archive</param>
 /// <param name="directory">Directory where files are to be unpacked to</param>
 /// <param name="filesCount">The archive files count</param>
 /// <param name="password">Password for the archive</param>
 /// <param name="extractor">The owner of the callback</param>
 /// <param name="actualIndexes">The list of actual indexes (solid archives support)</param>
 /// <param name="directoryStructure">The value indicating whether to preserve directory structure of extracted files.</param>
 /// <param name="outputmappingcallback">Optional callback that is used to determine the output filepath of the entry being extracted</param>
 public ArchiveExtractCallback(IInArchive archive, string directory, int filesCount, bool directoryStructure,
                               List <uint> actualIndexes, string password, SevenZipExtractor extractor, Func <ArchiveFileInfo, string> outputmappingcallback = null)
     : base(password)
 {
     Init(archive, directory, filesCount, directoryStructure, actualIndexes, extractor, outputmappingcallback);
 }
Example #57
0
 public static SqlString Extract(SqlBinary input)
 {
     return(Encoding.UTF8.GetString(SevenZipExtractor.ExtractBytes(input.Value)));
 }