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(); }
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(); }
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(); }