You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
1.0 KiB
30 lines
1.0 KiB
using System;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.IO.Compression;
|
|
using System.Linq;
|
|
using System.Web;
|
|
|
|
namespace BWPMWebForm.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);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
} |