Created
July 26, 2012 01:06
-
-
Save pparadis/3179677 to your computer and use it in GitHub Desktop.
Compression
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace Compression | |
{ | |
public class Compression | |
{ | |
public static void Compress(FileInfo fi) | |
{ | |
using (FileStream inFile = fi.OpenRead()) | |
{ | |
if ((File.GetAttributes(fi.FullName) & FileAttributes.Hidden) != FileAttributes.Hidden & fi.Extension != ".gz") | |
{ | |
using (FileStream outFile = File.Create(fi.FullName + ".gz")) | |
{ | |
using (GZipStream Compress = new GZipStream(outFile, CompressionMode.Compress)) | |
{ | |
inFile.CopyTo(Compress); | |
} | |
} | |
} | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment