コード例 #1
0
        public void ExtractTo(string description, Stream stream, string folder)
        {
            Console.WriteLine("Writing contents of zip file {0} to {1}", description, folder);
            if (Directory.Exists(folder))
            {
                Directory.Delete(folder, true);
            }

            Directory.CreateDirectory(folder);

            var system = new FileSystem();
            string fileName = Path.GetTempFileName();
            system.WriteStreamToFile(fileName, stream);

            using (var zipFile = new ZipFile(fileName))
            {
                zipFile.ExtractAll(folder, ExtractExistingFileAction.OverwriteSilently);
            }

            system.DeleteFile(fileName);
        }