public async Task StartAsync(CancellationToken cancellationToken)
        {
            await m_PermissionChecker.InitAsync();

            Smart.Default.Parser.UseAlternativeEscapeChar();// '\\' is the default value

            m_Logger.LogInformation($"Initializing for host: {m_Host.HostDisplayName} v{m_Host.HostVersion}");
            await m_Host.InitAsync();

            m_Logger.LogInformation("Loading plugins...");

            var i = 0;

            foreach (var pluginAssembly in m_PluginAssemblyStore.LoadedPluginAssemblies)
            {
                if (await m_PluginActivator.TryActivatePluginAsync(pluginAssembly) != null)
                {
                    i++;
                }
            }

            m_Logger.LogInformation($"> {i} plugins loaded.");

            var initializedEvent = new OpenModInitializedEvent(m_Host);
            await m_EventBus.EmitAsync(m_Host, this, initializedEvent);
        }
Esempio n. 2
0
        public async Task StartAsync(CancellationToken cancellationToken)
        {
            await m_PermissionChecker.InitAsync();

            Smart.Default.Parser.UseAlternativeEscapeChar();// '\\' is the default value

            m_Logger.LogInformation("Initializing for host: {HostName} v{HostVersion}",
                                    m_HostInformation.HostName, m_HostInformation.HostVersion);
            await m_Host.InitAsync();

            foreach (var assembly in m_Runtime.HostAssemblies)
            {
                m_EventBus.Subscribe(m_Host, assembly);
            }

            m_Logger.LogInformation("Loading plugins...");

            var i = 0;

            foreach (var pluginAssembly in m_PluginAssemblyStore.LoadedPluginAssemblies)
            {
                if (await m_PluginActivator.TryActivatePluginAsync(pluginAssembly) != null)
                {
                    i++;
                }
            }

            m_Logger.LogInformation("> {Count} plugins loaded", i);

            AsyncHelper.Schedule("OpenMod initialize event", () => m_EventBus.EmitAsync(m_Host, this, new OpenModInitializedEvent(m_Host)));
            await m_JobScheduler.StartAsync();
        }