예제 #1
0
        /// <summary>
        /// Sets the signature content
        /// </summary>
        /// <param name="session">Session used for sending the request</param>
        /// <param name="signatureContent"> Content to set as signature </param>
        public void SetSignature(AuthenticatedSession <TUser> session, Content signatureContent)
        {
            var content = new MultipartFormDataContent
            {
                // Encoding (SBCSCodePageEncoding) is important and required to transmit german characters such as Ä, Ü, Ö...
                { new StringContent(signatureContent.ToString(), System.Text.Encoding.GetEncoding("ISO-8859-1")), "message" },
                { new StringContent("0"), "wysiwyg" },
                { new StringContent("http://www.elitepvpers.com/forum/usercp.php"), "url" },
                { new StringContent(String.Empty), "s" },
                { new StringContent(session.SecurityToken), "securitytoken" },
                { new StringContent("updatesignature"), "do" },
                { new StringContent("52428800"), "MAX_FILE_SIZE" }
            };

            session.PostMultipartFormData("http://www.elitepvpers.com/forum/profile.php?do=updatesignature", content);
        }
예제 #2
0
        /// <summary>
        /// Sets the Avatar
        /// </summary>
        /// <param name="session">Session used for sending the request</param>
        /// <param name="image"> <c>Image</c> to set as new avatar </param>
        /// <param name="changeType"> 0 for uploading a new avatar, -1 for deleting the old one without uploading a new one </param>
        protected void SetAvatar(AuthenticatedSession <TUser> session, Image image, int changeType)
        {
            var content = new MultipartFormDataContent
            {
                {
                    new ByteArrayContent(image.Data), "upload",
                    (String.IsNullOrEmpty(image.Name)) ? "Unnamed.jpeg" : image.Name + image.Format
                },
                { new StringContent(String.Empty), "s" },
                { new StringContent(session.SecurityToken), "securitytoken" },
                { new StringContent("updateavatar"), "do" },
                { new StringContent(changeType.ToString()), "avatarid" }
            };

            session.PostMultipartFormData("http://www.elitepvpers.com/forum/profile.php?do=updateavatar", content);
        }