mirror of
https://github.com/greenshot/greenshot
synced 2025-07-14 17:13:44 -07:00
Refactoring to make Picasa work, added Upload to the IBinaryContainer.
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2135 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
03b4b17ea4
commit
756c8d9403
5 changed files with 66 additions and 23 deletions
|
@ -291,6 +291,7 @@ namespace GreenshotPlugin.Core {
|
|||
void WriteToStream(Stream formDataStream);
|
||||
string ToBase64String(Base64FormattingOptions formattingOptions);
|
||||
byte[] ToByteArray();
|
||||
void Upload(HttpWebRequest webRequest);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -361,6 +362,17 @@ namespace GreenshotPlugin.Core {
|
|||
// Write the file data directly to the Stream, rather than serializing it to a string.
|
||||
dataStream.Write(file, 0, fileSize);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Upload the file to the webrequest
|
||||
/// </summary>
|
||||
/// <param name="webRequest"></param>
|
||||
public void Upload(HttpWebRequest webRequest) {
|
||||
webRequest.ContentType = contentType;
|
||||
using (var requestStream = webRequest.GetRequestStream()) {
|
||||
WriteToStream(requestStream);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -426,5 +438,16 @@ namespace GreenshotPlugin.Core {
|
|||
// Write the file data directly to the Stream, rather than serializing it to a string.
|
||||
ImageOutput.SaveToStream(image, dataStream, outputSettings);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Upload the image to the webrequest
|
||||
/// </summary>
|
||||
/// <param name="webRequest"></param>
|
||||
public void Upload(HttpWebRequest webRequest) {
|
||||
webRequest.ContentType = "image/" + outputSettings.Format.ToString();
|
||||
using (var requestStream = webRequest.GetRequestStream()) {
|
||||
WriteToStream(requestStream);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue