示例#1
0
        private void InitializeAdvisor()
        {
            AdvisorLog.Info("Initializing Advisor Core...");
            var sw = new Stopwatch();

            _services = new AdvisorServiceContainer(this);

            _configuration = new ConfigurationService();
            _configuration.LoadConfiguration();
            _services.AddService(_configuration);

            _commandRegistry = new CommandRegistry(this);
            _services.AddService(_commandRegistry);

            // Register Advisor's argument converters and commands.
            _commandRegistry.RegisterArgumentConverters(Assembly.GetExecutingAssembly());
            _commandRegistry.RegisterCommandModules(Assembly.GetExecutingAssembly());

            _commandHandler = new CommandHandler(this);
            _services.AddService(_commandHandler);

            AdvisorLog.Info($"Successfully initialized Advisor Core in {sw.ElapsedMilliseconds} ms");
        }