mirror of
https://github.com/greenshot/greenshot
synced 2025-07-14 17:13:44 -07:00
Reused new OAuth 2 code for the Box plug-in, this was possible by adding the embedded browser. Also refactored code to be more readable, and have more reuse. Fixed problems with Picasa upload and pressing cancel on the PleaseWaitForm. [skip ci]
This commit is contained in:
parent
9d7299e5ea
commit
1f80d56b10
16 changed files with 408 additions and 277 deletions
|
@ -1,10 +1,22 @@
|
|||
/*
|
||||
* Created by SharpDevelop.
|
||||
* User: jens
|
||||
* Date: 09.04.2012
|
||||
* Time: 19:24
|
||||
* Greenshot - a free and open source screenshot tool
|
||||
* Copyright (C) 2007-2015 Thomas Braun, Jens Klingen, Robin Krom
|
||||
*
|
||||
* To change this template use Tools | Options | Coding | Edit Standard Headers.
|
||||
* For more information see: http://getgreenshot.org/
|
||||
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using GreenshotPlugin.Core;
|
||||
|
@ -28,7 +40,7 @@ namespace Greenshot.Help
|
|||
}
|
||||
|
||||
public static void LoadHelp() {
|
||||
string uri = findOnlineHelpUrl(Language.CurrentLanguage);
|
||||
string uri = FindOnlineHelpUrl(Language.CurrentLanguage);
|
||||
if(uri == null) {
|
||||
uri = Language.HelpFilePath;
|
||||
}
|
||||
|
@ -36,7 +48,7 @@ namespace Greenshot.Help
|
|||
}
|
||||
|
||||
/// <returns>URL of help file in selected ietf, or (if not present) default ietf, or null (if not present, too. probably indicating that there is no internet connection)</returns>
|
||||
private static string findOnlineHelpUrl(string currentIETF) {
|
||||
private static string FindOnlineHelpUrl(string currentIETF) {
|
||||
string ret = null;
|
||||
|
||||
string extHelpUrlForCurrrentIETF = EXT_HELP_URL;
|
||||
|
@ -45,12 +57,12 @@ namespace Greenshot.Help
|
|||
extHelpUrlForCurrrentIETF += currentIETF.ToLower() + "/";
|
||||
}
|
||||
|
||||
HttpStatusCode? httpStatusCode = getHttpStatus(extHelpUrlForCurrrentIETF);
|
||||
HttpStatusCode? httpStatusCode = GetHttpStatus(extHelpUrlForCurrrentIETF);
|
||||
if(httpStatusCode == HttpStatusCode.OK) {
|
||||
ret = extHelpUrlForCurrrentIETF;
|
||||
} else if(httpStatusCode != null && !extHelpUrlForCurrrentIETF.Equals(EXT_HELP_URL)) {
|
||||
LOG.DebugFormat("Localized online help not found at {0}, will try {1} as fallback", extHelpUrlForCurrrentIETF, EXT_HELP_URL);
|
||||
httpStatusCode = getHttpStatus(EXT_HELP_URL);
|
||||
httpStatusCode = GetHttpStatus(EXT_HELP_URL);
|
||||
if(httpStatusCode == HttpStatusCode.OK) {
|
||||
ret = EXT_HELP_URL;
|
||||
} else {
|
||||
|
@ -68,9 +80,9 @@ namespace Greenshot.Help
|
|||
/// </summary>
|
||||
/// <param name="url">URL for which the HTTP status is to be checked</param>
|
||||
/// <returns>An HTTP status code, or null if there is none (probably indicating that there is no internet connection available</returns>
|
||||
private static HttpStatusCode? getHttpStatus(string url) {
|
||||
private static HttpStatusCode? GetHttpStatus(string url) {
|
||||
try {
|
||||
HttpWebRequest req = (HttpWebRequest)NetworkHelper.CreateWebRequest(url);
|
||||
HttpWebRequest req = NetworkHelper.CreateWebRequest(url);
|
||||
HttpWebResponse res = (HttpWebResponse)req.GetResponse();
|
||||
return res.StatusCode;
|
||||
} catch(WebException e) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue