Exemple #1
0
        private void SetTitleCommandExecutor(string commandParams)
        {
            var argumentsParser = new ArgumentsParser(commandParams);

            if (argumentsParser.NextArgumentsCount < 1)
            {
                throw new MenuException();
            }

            ICommand command = new SetTitleCommand(argumentsParser.GetNextsAsString(' '), _document);

            command.Execute();
        }
Exemple #2
0
        private void InsertParagraphCommandExecutor(string commandParams)
        {
            var argumentsParser = new ArgumentsParser(commandParams);

            if (argumentsParser.NextArgumentsCount < 2)
            {
                throw new MenuException();
            }

            int?   position = GetPosition(argumentsParser.GetNextAsString());
            string text     = argumentsParser.GetNextsAsString(' ');

            ICommand command = new InsertParagraphCommand(text, _document, position);

            command.Execute();
        }
Exemple #3
0
        private void ReplaceTextCommandExecutor(string commandParams)
        {
            var argumentsParser = new ArgumentsParser(commandParams);

            if (argumentsParser.NextArgumentsCount < 2)
            {
                throw new MenuException();
            }

            int?position = argumentsParser.GetNextAsInt();

            if (position == null)
            {
                throw new MenuException();
            }
            string text = argumentsParser.GetNextsAsString(' ');

            ICommand command = new ReplaceTextCommand(position.Value, text, _document);

            command.Execute();
        }