예제 #1
0
        public static void Decompress(this Stream stream, string outputDir, string format)
        {
            switch (format)
            {
            case "gzip":
            {
                using (var gzipStream = new GZipInputStream(stream))
                    gzipStream.Decompress(outputDir);
                break;
            }

            case "zip":
            {
                using (var zipStream = new ZipInputStream(stream))
                    zipStream.Decompress(outputDir);
                break;
            }

            default:
                throw new NotSupportedException($"{format} is not supported.");
            }
        }