public CommandExecutorContext(ICommandExecutor executor, CommandExpression expression, object parameter) { if (executor == null) { throw new ArgumentNullException(nameof(executor)); } if (expression == null) { throw new ArgumentNullException(nameof(expression)); } _executor = executor; _expression = expression; _parameter = parameter; }
public CommandContext(ICommandExecutor executor, CommandExpression expression, ICommand command, object parameter, IDictionary <string, object> extendedProperties = null) { if (command == null) { throw new ArgumentNullException("command"); } _executor = executor; _command = command; _parameter = parameter; _expression = expression; if (extendedProperties != null && extendedProperties.Count > 0) { _extendedProperties = new Dictionary <string, object>(extendedProperties, StringComparer.OrdinalIgnoreCase); } }
protected virtual object ExecuteCommand(CommandExecutorContext context, CommandExpression expression, CommandTreeNode node, object parameter) { if (context == null) { throw new ArgumentNullException(nameof(context)); } if (node == null) { throw new ArgumentNullException(nameof(node)); } if (node.Command == null) { return(null); } return(node.Command.Execute(this.CreateCommandContext(expression, node, parameter))); }
public CommandContext(ICommandExecutor executor, CommandExpression expression, CommandTreeNode commandNode, object parameter, IDictionary <string, object> extendedProperties = null) { if (commandNode == null) { throw new ArgumentNullException("commandNode"); } if (commandNode.Command == null) { throw new ArgumentException(string.Format("The Command property of '{0}' command-node is null.", commandNode.FullPath)); } _executor = executor; _commandNode = commandNode; _command = commandNode.Command; _parameter = parameter; _expression = expression; if (extendedProperties != null && extendedProperties.Count > 0) { _extendedProperties = new Dictionary <string, object>(extendedProperties, StringComparer.OrdinalIgnoreCase); } }
public CommandExpression Parse(string text) { if (string.IsNullOrWhiteSpace(text)) { return(null); } CommandExpression result = null; CommandExpression current = null; using (var reader = new StringReader(text)) { while (reader.Peek() > 0) { current = Parse(reader); if (result == null) { result = current; } else //线性查找命令表达式的管道链,并更新其指向 { var previous = result; while (previous.Next != null) { previous = previous.Next; } previous.Next = current; } } } return(result); }
protected virtual CommandContext CreateCommandContext(CommandExpression expression, CommandTreeNode node, object parameter) { return(new CommandContext(this, expression, node, parameter)); }