Beispiel #1
0
        public async Task <Result> SendPost(ForumReply forumReplyEntity)
        {
            var result = new Result();

            try
            {
                var form = new MultipartFormDataContent
                {
                    { new StringContent("postreply"), "action" },
                    { new StringContent(forumReplyEntity.ThreadId), "threadid" },
                    { new StringContent(forumReplyEntity.FormKey), "formkey" },
                    { new StringContent(forumReplyEntity.FormCookie), "form_cookie" },
                    { new StringContent(HtmlEncode(forumReplyEntity.Message)), "message" },
                    { new StringContent(forumReplyEntity.ParseUrl.ToString()), "parseurl" },
                    { new StringContent("2097152"), "MAX_FILE_SIZE" },
                    { new StringContent("Submit Reply"), "submit" }
                };
                result = await _webManager.PostFormData(EndPoints.NewReply, form);

                return(result);
            }
            catch (Exception)
            {
                return(result);
            }
        }
Beispiel #2
0
        public async Task <Result> CreateNewThreadAsync(NewThread newThreadEntity)
        {
            var form = new MultipartFormDataContent
            {
                { new StringContent("postthread"), "action" },
                { new StringContent(newThreadEntity.ForumId.ToString(CultureInfo.InvariantCulture)), "forumid" },
                { new StringContent(newThreadEntity.FormKey), "formkey" },
                { new StringContent(newThreadEntity.FormCookie), "form_cookie" },
                { new StringContent(newThreadEntity.PostIcon.Id.ToString(CultureInfo.InvariantCulture)), "iconid" },
                { new StringContent(Extensions.HtmlEncode(newThreadEntity.Subject)), "subject" },
                { new StringContent(Extensions.HtmlEncode(newThreadEntity.Content)), "message" },
                { new StringContent(newThreadEntity.ParseUrl.ToString()), "parseurl" },
                { new StringContent("Submit Reply"), "submit" }
            };

            return(await _webManager.PostFormData(EndPoints.NewThreadBase, form));
        }
Beispiel #3
0
        public async Task <Result> SendPrivateMessageAsync(NewPrivateMessage newPrivateMessageEntity)
        {
            Result result = new Result();
            MultipartFormDataContent form;

            try
            {
                form = new MultipartFormDataContent
                {
                    { new StringContent("dosend"), "action" },
                    { new StringContent(newPrivateMessageEntity.Receiver), "touser" },
                    { new StringContent(Extensions.HtmlEncode(newPrivateMessageEntity.Title)), "title" },
                    { new StringContent(Extensions.HtmlEncode(newPrivateMessageEntity.Body)), "message" },
                    { new StringContent("yes"), "parseurl" },
                    { new StringContent("yes"), "parseurl" },
                    { new StringContent("Send Message"), "submit" }
                };
                if (newPrivateMessageEntity.Icon != null)
                {
                    form.Add(new StringContent(newPrivateMessageEntity.Icon.Id.ToString(CultureInfo.InvariantCulture)), "iconid");
                }
            }
            catch (Exception ex)
            {
                ErrorHandler.CreateErrorObject(result, ex.Message, ex.StackTrace);
                return(result);
            }
            try
            {
                result = await _webManager.PostFormData(EndPoints.NewPrivateMessageBase, form);

                return(result);
            }
            catch (Exception ex)
            {
                ErrorHandler.CreateErrorObject(result, ex.Message, ex.StackTrace);
                return(result);
            }
        }