/// <summary> /// Writes the value to the specified <code>stream</code>. /// </summary> /// <param name="stream">The stream the value should be written to.</param> /// <param name="boundary">The multipart boundary.</param> /// <param name="newLine">The characters used to indicate a new line.</param> /// <param name="isLast">Whether the value is the last in the request body.</param> public void WriteToMultipartStream(Stream stream, string boundary, string newLine, bool isLast) { SocialHttpPostData.Write(stream, "--" + boundary + newLine); SocialHttpPostData.Write(stream, "Content-Disposition: form-data; name=\"" + Name + "\"" + newLine); SocialHttpPostData.Write(stream, newLine); SocialHttpPostData.Write(stream, Value); SocialHttpPostData.Write(stream, newLine); SocialHttpPostData.Write(stream, "--" + boundary + (isLast ? "--" : "") + newLine); }
/// <summary> /// Writes the value to the specified <code>stream</code>. /// </summary> /// <param name="stream">The stream the value should be written to.</param> /// <param name="boundary">The multipart boundary.</param> /// <param name="newLine">The characters used to indicate a new line.</param> /// <param name="isLast">Whether the value is the last in the request body.</param> public void WriteToMultipartStream(Stream stream, string boundary, string newLine, bool isLast) { SocialHttpPostData.Write(stream, "--" + boundary + newLine); SocialHttpPostData.Write(stream, "Content-Disposition: form-data; name=\"" + Name + "\"; filename=\"" + FileName + "\"" + newLine); SocialHttpPostData.Write(stream, "Content-Type: " + ContentType + newLine); SocialHttpPostData.Write(stream, newLine); stream.Write(Data, 0, Data.Length); SocialHttpPostData.Write(stream, newLine); SocialHttpPostData.Write(stream, newLine); SocialHttpPostData.Write(stream, "--" + boundary + (isLast ? "--" : "") + newLine); }