コード例 #1
0
        public async Task <List <PostIcon> > GetPostIconsAsync(bool isPrivateMessage = false, int forumId = 0)
        {
            if (!_webManager.IsAuthenticated)
            {
                throw new Exception("User must be authenticated before using this method.");
            }
            string url    = isPrivateMessage ? EndPoints.NewPrivateMessage : string.Format(EndPoints.NewThread, forumId);
            var    result = await _webManager.GetDataAsync(url);

            var document = await _webManager.Parser.ParseAsync(result.ResultHtml);

            return(PostIconHandler.ParsePostIconList(document));
        }
コード例 #2
0
        private async Task <List <PostIcon> > GetPostIcons_InternalAsync(bool isPrivateMessage = false, int forumId = 0, CancellationToken token = default)
        {
            if (!this.webManager.IsAuthenticated)
            {
                throw new UserAuthenticationException(Awful.Core.Resources.ExceptionMessages.UserAuthenticationError);
            }

            string url    = isPrivateMessage ? EndPoints.NewPrivateMessageBase : string.Format(CultureInfo.InvariantCulture, EndPoints.NewThread, forumId);
            var    result = await this.webManager.GetDataAsync(url, token).ConfigureAwait(false);

            var document = await this.webManager.Parser.ParseDocumentAsync(result.ResultHtml, token).ConfigureAwait(false);

            return(PostIconHandler.ParsePostIconList(document));
        }