示例#1
0
        /// <summary>
        /// Creates a <c>SectionThread</c>
        /// </summary>
        /// <param name="session"> Session that is used for sending the request </param>
        /// <param name="section"> Section under which the <c>SectionThread</c> is listed </param>
        /// <param name="startPost"> Represents the content and title of the <c>SectionThread</c> </param>
        /// <param name="settings"> Additional options that can be set </param>
        /// <param name="closed"> If true, the thread state is closed meaning that no one (except the staff) can answer to this thread </param>
        /// <returns> Freshly created <c>SectionThread</c> </returns>
        public static SectionThread Create <TUser>(AuthenticatedSession <TUser> session, Section section, SectionPost startPost,
                                                   SectionPost.Settings settings = SectionPost.Settings.ParseUrl | SectionPost.Settings.ShowSignature,
                                                   bool closed = false)
            where TUser : User
        {
            session.ThrowIfInvalid();

            session.Post("https://www.elitepvpers.com/forum/newthread.php?do=postthread&f=" + section.ID,
                         new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("subject", String.IsNullOrEmpty(startPost.Title) ? "-" : startPost.Title),
                new KeyValuePair <string, string>("message", startPost.Content.ToString()),
                new KeyValuePair <string, string>("wysiwyg", "0"),
                new KeyValuePair <string, string>("taglist", String.Empty),
                new KeyValuePair <string, string>("iconid", "0"),
                new KeyValuePair <string, string>("s", String.Empty),
                new KeyValuePair <string, string>("securitytoken", session.SecurityToken),
                new KeyValuePair <string, string>("f", section.ID.ToString()),
                new KeyValuePair <string, string>("do", "postthread"),
                new KeyValuePair <string, string>("posthash", "74532335f4d3a9f352db6af1b1c257f7"),
                new KeyValuePair <string, string>("poststarttime", "1389309192"),
                new KeyValuePair <string, string>("loggedinuser", session.User.ID.ToString()),
                new KeyValuePair <string, string>("sbutton", "Submit New Thread"),
                new KeyValuePair <string, string>("signature", settings.HasFlag(SectionPost.Settings.ShowSignature) ? "1" : "0"),
                new KeyValuePair <string, string>("parseurl", settings.HasFlag(SectionPost.Settings.ParseUrl) ? "1" : "0"),
                new KeyValuePair <string, string>("parseame", "1"),
                new KeyValuePair <string, string>("vbseo_retrtitle", "1"),
                new KeyValuePair <string, string>("vbseo_is_retrtitle", "1"),
                new KeyValuePair <string, string>("emailupdate", "9999"),
                new KeyValuePair <string, string>("polloptions", "4")
            });

            return(new SectionThread(0, section));
        }
示例#2
0
        /// <summary>
        /// Replies to the <c>SectionThread</c>
        /// </summary>
        /// <param name="session"> Session that is used for sending the request </param>
        /// <param name="post"> Reply to post </param>
        /// <param name="settings"> Additional options that can be set </param>
        /// <remarks>
        /// The ID of the thread has to be given in order to reply
        /// </remarks>
        public void Reply <TUser>(AuthenticatedSession <TUser> session, SectionPost post,
                                  SectionPost.Settings settings = SectionPost.Settings.ParseUrl | SectionPost.Settings.ShowSignature)
            where TUser : User
        {
            if (ID == 0)
            {
                throw new ArgumentException("ID must not be empty");
            }
            session.ThrowIfInvalid();

            session.Post("https://www.elitepvpers.com/forum/newreply.php?do=postreply&t=" + ID,
                         new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("title", String.IsNullOrEmpty(post.Title) ? "-" : post.Title),
                new KeyValuePair <string, string>("message", post.Content.ToString()),
                new KeyValuePair <string, string>("wysiwyg", "0"),
                new KeyValuePair <string, string>("iconid", post.Icon.ToString()),
                new KeyValuePair <string, string>("s", String.Empty),
                new KeyValuePair <string, string>("securitytoken", session.SecurityToken),
                new KeyValuePair <string, string>("do", "postreply"),
                new KeyValuePair <string, string>("t", ID.ToString()),
                new KeyValuePair <string, string>("p", String.Empty),
                new KeyValuePair <string, string>("specifiedpost", "0"),
                new KeyValuePair <string, string>("posthash", "6fd3840e9b2ed6a8dcc9d9d0432abb14"),
                new KeyValuePair <string, string>("poststarttime", String.Empty),
                new KeyValuePair <string, string>("loggedinuser", session.User.ID.ToString()),
                new KeyValuePair <string, string>("multiquoteempty", String.Empty),
                new KeyValuePair <string, string>("sbutton", "Submit Reply"),
                new KeyValuePair <string, string>("signature", settings.HasFlag(SectionPost.Settings.ShowSignature) ? "1" : "0"),
                new KeyValuePair <string, string>("parseurl", settings.HasFlag(SectionPost.Settings.ParseUrl) ? "1" : "0"),
                new KeyValuePair <string, string>("parseame", "1"),
                new KeyValuePair <string, string>("vbseo_retrtitle", "1"),
                new KeyValuePair <string, string>("vbseo_is_retrtitle", "1"),
                new KeyValuePair <string, string>("emailupdate", "9999"),
                new KeyValuePair <string, string>("rating", "0"),
                new KeyValuePair <string, string>("openclose", "0")
            });
        }