Ejemplo n.º 1
0
        /// <summary>
        /// Register a command service.
        /// </summary>
        /// <typeparam name="T">The type of the service being registered.</typeparam>
        /// <param name="service">The service instance to register.</param>
        public void RegisterCommandService <T>(T service)
        {
            if (service == null)
            {
                throw new ArgumentNullException(nameof(service));
            }

            _commandServices.Register <T>(service);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Create a new instance.
        /// </summary>
        public Runtime()
        {
            var nameValidator = new NameValidator();
            var commandDescriptorGenerator = new CommandAttributeInspector();

            _commandRegistry = new CommandRegistry(nameValidator, commandDescriptorGenerator);

            _commandServices  = new CommandServices();
            _parser           = new Parser();
            _variableReplacer = new VariableReplacer();

            _sessionObjectTypes = new ScopedObjectRegistry();
            _sessionObjectTypes.Register <VariableCollection>();

            _commandRegistry.Register(typeof(Help));
            _commandRegistry.Register(typeof(Var));

            _commandServices.Register(_commandRegistry);
            _commandServices.Register <IPhraseDictionary>(new PhraseDictionary());
        }