2014-07-22 03:32:15 +08:00
|
|
|
//! \file deflate.cs
|
|
|
|
//! \date Tue Jul 08 15:01:34 2014
|
|
|
|
//! \brief deflate file into zlib stream.
|
|
|
|
//
|
|
|
|
|
|
|
|
using System;
|
|
|
|
using System.IO;
|
|
|
|
using ZLibNet;
|
|
|
|
|
|
|
|
class Inflate
|
|
|
|
{
|
|
|
|
public static void Main (string[] args)
|
|
|
|
{
|
|
|
|
if (args.Length != 2)
|
2015-04-19 19:23:15 +08:00
|
|
|
{
|
|
|
|
Console.WriteLine ("Usage: deflate INPUT-FILE OUTPUT-FILE");
|
2014-07-22 03:32:15 +08:00
|
|
|
return;
|
2015-04-19 19:23:15 +08:00
|
|
|
}
|
2014-07-22 03:32:15 +08:00
|
|
|
try
|
|
|
|
{
|
|
|
|
using (var input = File.Open (args[0], FileMode.Open, FileAccess.Read))
|
2015-04-19 19:23:15 +08:00
|
|
|
using (var output = File.Create (args[1]))
|
|
|
|
using (var stream = new ZLibStream (output, CompressionMode.Compress, CompressionLevel.Level9))
|
|
|
|
input.CopyTo (stream);
|
2014-07-22 03:32:15 +08:00
|
|
|
Console.WriteLine ("{0} => {1}", args[0], args[1]);
|
|
|
|
}
|
|
|
|
catch (Exception X)
|
|
|
|
{
|
|
|
|
Console.Error.WriteLine (X.Message);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|