Initial commit
This commit is contained in:
30
Helper/zipHelper.cs
Normal file
30
Helper/zipHelper.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace QW2021C.Helper
|
||||
{
|
||||
public class zipHelper
|
||||
{
|
||||
public void Decompress(FileInfo fileToDecompress)
|
||||
{
|
||||
using (FileStream originalFileStream = fileToDecompress.OpenRead())
|
||||
{
|
||||
string currentFileName = fileToDecompress.FullName;
|
||||
string newFileName = currentFileName.Remove(currentFileName.Length - fileToDecompress.Extension.Length);
|
||||
|
||||
using (FileStream decompressedFileStream = File.Create(newFileName))
|
||||
{
|
||||
using (GZipStream decompressionStream = new GZipStream(originalFileStream, CompressionMode.Decompress))
|
||||
{
|
||||
decompressionStream.CopyTo(decompressedFileStream);
|
||||
Console.WriteLine("Decompressed: {0}", fileToDecompress.Name);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user