コード例 #1
0
        /// <summary>
        ///      Constructs an engine that communicates with a given server,
        ///      and uses a given kernel context.
        /// </summary>
        /// <remarks>
        ///      This constructor should only be called by a dependency
        ///      injection framework.
        /// </remarks>
        public BaseEngine(
            IShellServer shell,
            IShellRouter router,
            IOptions <KernelContext> context,
            ILogger logger,
            IServiceProvider serviceProvider
            )
        {
            if (serviceProvider == null)
            {
                throw new ArgumentNullException(nameof(serviceProvider));
            }
            this.ShellServer     = shell;
            this.ShellRouter     = router;
            this.Context         = context.Value;
            this.Logger          = logger;
            this.serviceProvider = serviceProvider;

            History = new List <string>();

            this.inputParser = new InputParser(this);

            logger.LogDebug("Registering magic symbol resolution.");
            var magicResolver = new MagicCommandResolver(this);

            RegisterSymbolResolver(magicResolver);

            RegisterDefaultEncoders();
        }
コード例 #2
0
        /// <summary>
        ///      Constructs an engine that communicates with a given server,
        ///      and uses a given kernel context.
        /// </summary>
        /// <remarks>
        ///      This constructor should only be called by a dependency
        ///      injection framework.
        /// </remarks>
        public BaseEngine(
            IShellServer shell,
            IOptions <KernelContext> context,
            ILogger logger)
        {
            ExecutionCount   = 0;
            this.ShellServer = shell;
            this.Context     = context.Value;
            this.Logger      = logger;

            History = new List <string>();
            var magicResolver = new MagicCommandResolver(this);

            RegisterSymbolResolver(magicResolver);

            RegisterDefaultEncoders();
        }