예제 #1
0
        /// <summary>
        /// Get the forum adapter for the provided quest.
        /// </summary>
        /// <param name="quest">The quest to get a forum adapter for.</param>
        /// <param name="token">The cancellation token.</param>
        /// <returns>Returns the forum adapter that knows how to read the forum of the quest thread.</returns>
        private async Task <IForumAdapter> GetForumAdapterAsync(IQuest quest, CancellationToken token)
        {
            if (quest.ForumType == ForumType.Unknown)
            {
                quest.ForumType = await ForumIdentifier.IdentifyForumTypeAsync(quest.ThreadUri, token).ConfigureAwait(false);
            }

            var adapter = ForumAdapterSelector.GetForumAdapter(quest.ForumType, quest.ThreadUri);

            quest.ForumAdapter = adapter;

            return(adapter);
        }
예제 #2
0
        /// <summary>
        /// Get the forum adapter for the provided quest.
        /// </summary>
        /// <param name="quest">The quest to get a forum adapter for.</param>
        /// <param name="token">The cancellation token.</param>
        /// <returns>Returns the forum adapter that knows how to read the forum of the quest thread.</returns>
        private async Task <IForumAdapter> GetForumAdapterAsync(IQuest quest, CancellationToken token)
        {
            var adapter = await ForumAdapterSelector.GetForumAdapterAsync(quest.ThreadUri, token);

            if (quest.PostsPerPage == 0)
            {
                quest.PostsPerPage = adapter.DefaultPostsPerPage;
            }

            quest.LineBreak = adapter.LineBreak;

            quest.PermalinkForId = adapter.GetPermalinkForId;

            if (adapter.HasRSSThreadmarks == BoolEx.True && quest.UseRSSThreadmarks == BoolEx.Unknown)
            {
                quest.UseRSSThreadmarks = BoolEx.True;
            }

            return(adapter);
        }