Пример #1
0
        private void UnpackArchiveEntry(IArchiveEntry archiveEntry, string zipArchiveName)
        {
            var outputPath = Path.Combine(importFolderConfiguration.InitialFolder, archiveEntry.Name);

            Console.WriteLine(outputPath);
            try
            {
                using (var outputStream = fileSystem.OpenWrite(outputPath))
                {
                    var archiveStream = archiveEntry.GetStream();

                    StreamUtil.CopyAndClose(archiveStream, outputStream);
                }

                CreateDoneFileForUnpackedFile(Path.ChangeExtension(outputPath, doneFileExtension));
            }
            catch (Exception exception)
            {
                Console.WriteLine(string.Format("Error during archive entry unpack. Archive {0}, entry{1}", zipArchiveName,
                                                archiveEntry.Name), exception);
            }
        }