mirror of
https://github.com/greenshot/greenshot
synced 2025-08-20 13:33:27 -07:00
Added a PleaseWait form which allows the user to cancel the operation. This already is implemented for the Imgur plug-in but should be used for all the others with long operations. Also fixed a bug in the Imgur plug-in: while retrieving the history a "no longer available" answer was not processed.
git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@1984 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
parent
b589d756d6
commit
a8025ac8cf
6 changed files with 256 additions and 15 deletions
|
@ -69,6 +69,20 @@ namespace GreenshotImgurPlugin {
|
|||
config.ImgurUploadHistory.Remove(hash);
|
||||
saveNeeded = true;
|
||||
}
|
||||
} catch (WebException wE) {
|
||||
bool redirected = false;
|
||||
if (wE.Status == WebExceptionStatus.ProtocolError) {
|
||||
HttpWebResponse response = ((HttpWebResponse)wE.Response);
|
||||
// Image no longer available
|
||||
if (response.StatusCode == HttpStatusCode.Redirect) {
|
||||
LOG.InfoFormat("ImgUr image for hash {0} is no longer available", hash);
|
||||
config.ImgurUploadHistory.Remove(hash);
|
||||
redirected = true;
|
||||
}
|
||||
}
|
||||
if (!redirected) {
|
||||
LOG.Error("Problem loading ImgUr history for hash " + hash, wE);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
LOG.Error("Problem loading ImgUr history for hash " + hash, e);
|
||||
}
|
||||
|
@ -152,16 +166,17 @@ namespace GreenshotImgurPlugin {
|
|||
}
|
||||
LOG.Info(responseString);
|
||||
ImgurInfo imgurInfo = ImgurInfo.ParseResponse(responseString);
|
||||
LOG.Debug("Upload to imgur was finished");
|
||||
return imgurInfo;
|
||||
}
|
||||
|
||||
public static void RetrieveImgurThumbnail(ImgurInfo imgurInfo) {
|
||||
if (imgurInfo.SmallSquare == null) {
|
||||
LOG.Warn("Imgur URL was null, not retrieving thumbnail.");
|
||||
return;
|
||||
}
|
||||
LOG.InfoFormat("Retrieving Imgur image for {0} with url {1}", imgurInfo.Hash, imgurInfo);
|
||||
HttpWebRequest webRequest = (HttpWebRequest)NetworkHelper.CreateWebRequest(imgurInfo.SmallSquare);
|
||||
if (imgurInfo.SmallSquare == null) {
|
||||
LOG.Warn("Imgur URL was null, not retrieving thumbnail.");
|
||||
return;
|
||||
}
|
||||
LOG.InfoFormat("Retrieving Imgur image for {0} with url {1}", imgurInfo.Hash, imgurInfo.SmallSquare);
|
||||
HttpWebRequest webRequest = (HttpWebRequest)NetworkHelper.CreateWebRequest(imgurInfo.SmallSquare);
|
||||
webRequest.Method = "GET";
|
||||
webRequest.ServicePoint.Expect100Continue = false;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue