public void HandleRequest(string[] args, IDivLogger divLogger)
        {
            _logger = divLogger;

            try
            {
                //Chain of responsibility pattern
                RemoveHandler removeHandler = new RemoveHandler(new GeneralFileRemover());
                CopyHandler copyHandler = new CopyHandler();
                HelpHandler helpHandler = new HelpHandler();

                removeHandler.Successor = copyHandler;
                copyHandler.Successor = helpHandler;

                removeHandler.HandleRequest(args, _logger);

            }
            catch (CommandLineEntryException exception)
            {
                _logger.Log(exception.Message, LogSeverity.High);
                _logger.Log(CommandLineUsage.Usage, LogSeverity.Low);

            }
            catch (Exception exception)
            {
                _logger.Log(exception.Message, LogSeverity.Highest);
            }
        }
Ejemplo n.º 2
0
        public void HandleRequest(string[] args, IDivLogger logger)
        {
            _logger = logger;

            if(IsCopy(args))
            {
                _logger.Log("Not yet implemented better luck next time", LogSeverity.Medium);
            }
            else
            {
                InvokeSuccessor(args, logger);
            }
        }
        public void Handle(string[] args, IDivLogger divLogger)
        {
            _logger = divLogger;

            try
            {
                PrepareHandler(args);
                _handler.Invoke();
            }
            catch (Exception exception)
            {
                _logger.Log(exception.Message, LogSeverity.Highest);
            }
        }
Ejemplo n.º 4
0
 public void HandleRequest(string[] args, IDivLogger logger)
 {
     _logger = logger;
     _logger.Log(CommandLineUsage.Usage, LogSeverity.Lowest);
 }