コード例 #1
0
        /// <summary>
        /// Creates a <c>SocialGroupThread</c>
        /// </summary>
        /// <param name="session"> Session that is used for sending the request </param>
        /// <param name="socialGroup"> SocialGroup where to create the <c>SocialGroupThread</c></param>
        /// <param name="startPost"> Represents the content and title of the <c>SocialGroupThread</c> </param>
        /// <param name="settings"> Additional options that can be set </param>
        /// <returns> Freshly created <c>SocialGroupThread</c></returns>
        public static SocialGroupThread Create <TUser>(AuthenticatedSession <TUser> session, SocialGroup socialGroup, SocialGroupPost startPost,
                                                       Message.Settings settings = Message.Settings.ParseUrl)
            where TUser : User
        {
            session.ThrowIfInvalid();

            session.Post("http://www.elitepvpers.com/forum/group.php?do=message",
                         new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("subject", startPost.Title),
                new KeyValuePair <string, string>("message", startPost.Content.ToString()),
                new KeyValuePair <string, string>("wysiwyg", "0"),
                new KeyValuePair <string, string>("s", String.Empty),
                new KeyValuePair <string, string>("securitytoken", session.SecurityToken),
                new KeyValuePair <string, string>("do", "message"),
                new KeyValuePair <string, string>("gmid", String.Empty),
                new KeyValuePair <string, string>("posthash", String.Empty),
                new KeyValuePair <string, string>("loggedinuser", session.User.ID.ToString()),
                new KeyValuePair <string, string>("groupid", socialGroup.ID.ToString()),
                new KeyValuePair <string, string>("discussionid", String.Empty),
                new KeyValuePair <string, string>("sbutton", "Nachricht+speichern"),
                new KeyValuePair <string, string>("parseurl", settings.HasFlag(Message.Settings.ParseUrl) ? "1" : "0"),
                new KeyValuePair <string, string>("parseame", "1"),
            });

            var socialGroupThread = new SocialGroupThread(0, socialGroup)
            {
                Creator = session.User, Deleted = false
            };

            socialGroupThread.Posts.Insert(0, startPost);
            return(socialGroupThread);
        }
コード例 #2
0
        /// <summary>
        /// Replies to the <c>SocialGroupThread</c>
        /// </summary>
        /// <param name="session"> Session that is used for sending the request </param>
        /// <param name="settings"> Additional options that can be set </param>
        /// <param name="post"> Reply to post </param>
        public void Reply <TUser>(AuthenticatedSession <TUser> session, SocialGroupPost post, Message.Settings settings = Message.Settings.ParseUrl) where TUser : User
        {
            session.ThrowIfInvalid();

            session.Post("http://www.elitepvpers.com/forum/group.php?do=message",
                         new List <KeyValuePair <string, string> >()
            {
                new KeyValuePair <string, string>("message", post.Content.ToString()),
                new KeyValuePair <string, string>("wysiwyg", "0"),
                new KeyValuePair <string, string>("s", String.Empty),
                new KeyValuePair <string, string>("securitytoken", session.SecurityToken),
                new KeyValuePair <string, string>("do", "message"),
                new KeyValuePair <string, string>("gmid", String.Empty),
                new KeyValuePair <string, string>("posthash", String.Empty),
                new KeyValuePair <string, string>("loggedinuser", session.User.ID.ToString()),
                new KeyValuePair <string, string>("groupid", SocialGroup.ID.ToString()),
                new KeyValuePair <string, string>("discussionid", ID.ToString()),
                new KeyValuePair <string, string>("sbutton", "Post+Message"),
                new KeyValuePair <string, string>("parseurl", (settings & Message.Settings.ParseUrl).ToString()),
                new KeyValuePair <string, string>("parseame", "1"),
            });
        }