Exemplo n.º 1
0
        private static CreateProcessParms ParseCommandLine(string[] args)
        {
            var parms = new CreateProcessParms();

            if (args.Length != 3)
            {
                throw new Exception("Error in command line");
            }

            switch (args[0])
            {
            case "compress":
                parms.Operation = OperationType.Compress;
                break;

            case "decompress":
                parms.Operation = OperationType.Decompress;
                break;

            default:
                throw new Exception("Incorrect operation type");
            }

            parms.SourceFile      = args[1];
            parms.DestinationFile = args[2];

            return(parms);
        }
Exemplo n.º 2
0
        private static void Run(CreateProcessParms parms)
        {
            const int OneMb = 1048576;

            var processor = new ProcessorFactory(parms, OneMb)
                            .Create();

            processor.StartProcess();
        }
Exemplo n.º 3
0
 public ProcessorFactory(CreateProcessParms parms, int blockSize)
 {
     _parms = parms;
     _blockSize = blockSize;
 }