コード例 #1
0
        public void DecompressFile(string sourceFileName, string destinationFileName)
        {
            Checker.CheckString(sourceFileName);
            Checker.CheckString(destinationFileName);
            var temporaryPath = environmentHelper.GetTempPath();

            try {
                using (var zipFile = new ZipFile(sourceFileName, Encoding.Default)) {
                    zipFile.ExtractAll(temporaryPath);
                }
                var wrapper         = new DirectoryInfoWrapper(temporaryPath);
                var directoryEntity = new DirectoryEntity(wrapper);
                var file            = directoryEntity.GetFiles()[0];
                environmentHelper.CopyFile(file.FullName, destinationFileName);
            } catch (Exception e) {
                throw new CompressionException(e);
            } finally {
                environmentHelper.DeleteDirectory(temporaryPath);
            }
        }