Esempio n. 1
0
        protected void DoExtract(ILocalFsResourceAccessor accessor, string selectedItem)
        {
            string resourcePath   = accessor.CanonicalLocalResourcePath.LastPathSegment.Path;
            string extractionPath = GetExtractionPath(resourcePath, selectedItem);

            Logger.Debug("GoodMergeExtractor: Extracting '{0}' from '{1}' to '{2}'", selectedItem, resourcePath, extractionPath);
            bool result;

            using (IExtractor extractor = ExtractorFactory.Create(accessor.LocalFileSystemPath))
            {
                extractor.ExtractionProgress += OnExtractionProgress;
                result = extractor.ExtractArchiveFile(selectedItem, extractionPath);
            }
            if (!result)
            {
                //Sometimes an empty file has been created when extraction fails
                DeleteExtractedFile(extractionPath);
            }
            _extractionThread = null;
            OnExtractionCompleted(new ExtractionCompletedEventArgs(selectedItem, extractionPath, result));
        }