Beispiel #1
0
        static int Main(string[] args)
        {
            Console.CancelKeyPress += new ConsoleCancelEventHandler(CancelKeyPress);

            if (!ValidCheck(args))
            {
                Console.ReadLine();
                return(1);
            }

            try
            {
                switch (args[0].ToLower())
                {
                case "compress":
                    //archiver = new Compressor(args[1], args[2], true);
                    archiver = new GZipper(args[1], args[2], WorkMode.Compress, true);
                    break;

                case "decompress":
                    //archiver = new Decompressor(args[1], args[2], true);
                    archiver = new GZipper(args[1], args[2], WorkMode.Decompress, true);
                    break;

                default:
                    return(1);
                }

                if (!SizeCheck(args[1], archiver))
                {
                    Console.ReadLine();
                    return(1);
                }

                archiver.Launch();
                Console.ReadLine();
                return(archiver.CallBackResult());
            }
            catch (Exception ex)
            {
                Console.WriteLine("Error is occured!\n Method: {0}\n Error description {1}", ex.TargetSite, ex.Message);
                return(1);
            }
        }