Exemplo n.º 1
0
        /// <summary>
        /// Действие по инициализации.
        /// </summary>
        /// <param name="moduleProvider">Провайдер модулей.</param>
        protected override async ValueTask <Nothing> OnInitialize(IModuleProvider moduleProvider)
        {
            await base.OnInitialize(moduleProvider);

            _htmlParser = await moduleProvider.QueryEngineCapabilityAsync <IHtmlParser>(MakabaConstants.MakabaEngineId) ?? throw new ModuleNotFoundException(typeof(IHtmlParser));

            _htmlDocumentFactory = await moduleProvider.QueryModuleAsync <IHtmlDocumentFactory>() ?? throw new ModuleNotFoundException(typeof(IHtmlDocumentFactory));

            _postsParser = await moduleProvider.FindNetworkDtoParserAsync <BoardPost2WithParentLink, IBoardPost>() ?? throw new ModuleNotFoundException(typeof(INetworkDtoParser <BoardPost2WithParentLink, IBoardPost>));

            _threadPreviewParser = await moduleProvider.FindNetworkDtoParserAsync <ThreadPreviewData, IThreadPreviewPostCollection>() ?? throw new ModuleNotFoundException(typeof(INetworkDtoParser <ThreadPreviewData, IThreadPreviewPostCollection>));

            return(Nothing.Value);
        }