Example #1
0
        static int Main(string[] args)
        {
            ArgumentAdapter argumentAdapter = new ArgumentAdapter(args);
            ArgumentPayload ap = argumentAdapter.Parse();

            if (ap == null)
            {
                ApplicationUsage();
                return(1);
            }

            Command command;

            switch (ap.ProcessingCommand)
            {
            case Processing.Negative:
                command = new NegativeCommand(ap.BitmapPath, ap.OutcomeBitmapPath);
                break;

            case Processing.Grayscale:
                command = new GrayscaleCommand(ap.BitmapPath, ap.OutcomeBitmapPath);
                break;

            case Processing.Sepia:
                command = new SepiaCommand(ap.BitmapPath, ap.OutcomeBitmapPath);
                break;

            case Processing.Encode:
                command = new TextCodingCommand(ap.BitmapPath, ap.OutcomeBitmapPath, ap.TextToEncoding);
                break;

            case Processing.Decode:
                command = new TextDecodingCommand(ap.BitmapPath);
                break;

            case Processing.Bluish:
                command = new BluishCommand(ap.BitmapPath, ap.OutcomeBitmapPath);
                break;

            default:
                LoggerFacade.Warn("Niepoprawna akcja!");
                return(2);
            }
            command.Execute();
            LoggerFacade.Success("Gotowe!");
            return(0);
        }