diff --git a/Greenshot/Greenshot.csproj b/Greenshot/Greenshot.csproj index 79b2f4666..ee50aa76a 100644 --- a/Greenshot/Greenshot.csproj +++ b/Greenshot/Greenshot.csproj @@ -1,5 +1,5 @@  - + {CD642BF4-D815-4D67-A0B5-C69F0B8231AF} @@ -18,7 +18,8 @@ 3.5 - + + diff --git a/Greenshot/Help/HelpFileLoader.cs b/Greenshot/Help/HelpFileLoader.cs index 93759a850..c3acda86d 100644 --- a/Greenshot/Help/HelpFileLoader.cs +++ b/Greenshot/Help/HelpFileLoader.cs @@ -83,10 +83,15 @@ namespace Greenshot.Help private static HttpStatusCode? GetHttpStatus(string url) { try { HttpWebRequest req = NetworkHelper.CreateWebRequest(url); - HttpWebResponse res = (HttpWebResponse)req.GetResponse(); - return res.StatusCode; - } catch(WebException e) { - if(e.Response != null) return ((HttpWebResponse)e.Response).StatusCode; + using (HttpWebResponse res = (HttpWebResponse)req.GetResponse()) + { + return res.StatusCode; + } + } catch (WebException e) { + if (e.Response != null) + { + return ((HttpWebResponse)e.Response).StatusCode; + } return null; } } diff --git a/Greenshot/Helpers/PluginHelper.cs b/Greenshot/Helpers/PluginHelper.cs index 75a300bbf..9062490e3 100644 --- a/Greenshot/Helpers/PluginHelper.cs +++ b/Greenshot/Helpers/PluginHelper.cs @@ -213,7 +213,7 @@ namespace Greenshot.Helpers { /// /// /// - private void findPluginsOnPath(List pluginFiles, String path) { + private void findPluginsOnPath(List pluginFiles, string path) { if (Directory.Exists(path)) { try { foreach (string pluginFile in Directory.GetFiles(path, "*.gsp", SearchOption.AllDirectories)) { diff --git a/Greenshot/Helpers/UpdateHelper.cs b/Greenshot/Helpers/UpdateHelper.cs index a8a5bcda1..723331d25 100644 --- a/Greenshot/Helpers/UpdateHelper.cs +++ b/Greenshot/Helpers/UpdateHelper.cs @@ -34,21 +34,20 @@ namespace Greenshot.Experimental { /// Description of RssFeedHelper. /// public static class UpdateHelper { - private static ILog LOG = LogManager.GetLogger(typeof(UpdateHelper)); + private static readonly ILog LOG = LogManager.GetLogger(typeof(UpdateHelper)); private static CoreConfiguration conf = IniConfig.GetIniSection(); private const string STABLE_DOWNLOAD_LINK = "http://getgreenshot.org/downloads/"; private const string VERSION_HISTORY_LINK = "http://getgreenshot.org/version-history/"; - private static object lockObject = new object(); - private static SourceforgeFile latestGreenshot; - private static SourceforgeFile currentGreenshot; - private static string downloadLink = STABLE_DOWNLOAD_LINK; + private static readonly object LockObject = new object(); + private static SourceforgeFile _latestGreenshot; + private static string _downloadLink = STABLE_DOWNLOAD_LINK; /// /// Is an update check needed? /// /// bool true if yes public static bool IsUpdateCheckNeeded() { - lock (lockObject) { + lock (LockObject) { if (conf.UpdateCheckInterval == 0) { return false; } @@ -60,7 +59,7 @@ namespace Greenshot.Experimental { return false; } LOG.DebugFormat("Update check is due, last check was {0} check needs to be made after {1} (which is one {2} later)", conf.LastUpdateCheck, checkTime, conf.UpdateCheckInterval); - if (!SourceForgeHelper.isRSSModifiedAfter(conf.LastUpdateCheck)) { + if (!SourceForgeHelper.IsRSSModifiedAfter(conf.LastUpdateCheck)) { LOG.DebugFormat("RSS feed has not been updated since after {0}", conf.LastUpdateCheck); return false; } @@ -73,18 +72,18 @@ namespace Greenshot.Experimental { /// Read the RSS feed to see if there is a Greenshot update /// public static void CheckAndAskForUpdate() { - lock (lockObject) { + lock (LockObject) { Version currentVersion = Assembly.GetExecutingAssembly().GetName().Version; // Test like this: // currentVersion = new Version("0.8.1.1198"); try { - latestGreenshot = null; + _latestGreenshot = null; ProcessRSSInfo(currentVersion); - if (latestGreenshot != null) { + if (_latestGreenshot != null) { MainForm.Instance.NotifyIcon.BalloonTipClicked += HandleBalloonTipClick; MainForm.Instance.NotifyIcon.BalloonTipClosed += CleanupBalloonTipClick; - MainForm.Instance.NotifyIcon.ShowBalloonTip(10000, "Greenshot", Language.GetFormattedString(LangKey.update_found, "'" + latestGreenshot.File + "'"), ToolTipIcon.Info); + MainForm.Instance.NotifyIcon.ShowBalloonTip(10000, "Greenshot", Language.GetFormattedString(LangKey.update_found, "'" + _latestGreenshot.File + "'"), ToolTipIcon.Info); } conf.LastUpdateCheck = DateTime.Now; } catch (Exception e) { @@ -100,14 +99,14 @@ namespace Greenshot.Experimental { private static void HandleBalloonTipClick(object sender, EventArgs e) { try { - if (latestGreenshot != null) { + if (_latestGreenshot != null) { // "Direct" download link // Process.Start(latestGreenshot.Link); // Go to getgreenshot.org - Process.Start(downloadLink); + Process.Start(_downloadLink); } } catch (Exception) { - MessageBox.Show(Language.GetFormattedString(LangKey.error_openlink, downloadLink), Language.GetString(LangKey.error)); + MessageBox.Show(Language.GetFormattedString(LangKey.error_openlink, _downloadLink), Language.GetString(LangKey.error)); } finally { CleanupBalloonTipClick(sender, e); } @@ -158,18 +157,17 @@ namespace Greenshot.Experimental { int versionCompare = rssFile.Version.CompareTo(currentVersion); if (versionCompare > 0) { LOG.DebugFormat("Found newer Greenshot '{0}' with version {1} published at {2} : {3}", file, rssFile.Version, rssFile.Pubdate.ToLocalTime(), rssFile.Link); - if (latestGreenshot == null || rssFile.Version.CompareTo(latestGreenshot.Version) > 0) { - latestGreenshot = rssFile; + if (_latestGreenshot == null || rssFile.Version.CompareTo(_latestGreenshot.Version) > 0) { + _latestGreenshot = rssFile; if (rssFile.isReleaseCandidate || rssFile.isUnstable) { - downloadLink = VERSION_HISTORY_LINK; + _downloadLink = VERSION_HISTORY_LINK; } else { - downloadLink = STABLE_DOWNLOAD_LINK; + _downloadLink = STABLE_DOWNLOAD_LINK; } } } else if (versionCompare < 0) { LOG.DebugFormat("Skipping older greenshot with version {0}", rssFile.Version); } else if (versionCompare == 0) { - currentGreenshot = rssFile; LOG.DebugFormat("Found current version as exe {0} with version {1} published at {2} : {3}", file, rssFile.Version, rssFile.Pubdate.ToLocalTime(), rssFile.Link); } } diff --git a/Greenshot/releases/additional_files/readme.txt.template b/Greenshot/releases/additional_files/readme.txt.template index 6ec082c85..0881700f2 100644 --- a/Greenshot/releases/additional_files/readme.txt.template +++ b/Greenshot/releases/additional_files/readme.txt.template @@ -9,6 +9,31 @@ All details to our tickets can be found here: https://greenshot.atlassian.net @DETAILVERSION@ +There were some major issues with the authenticated (non anonymous) uploads to Imgur. +After contacting Imgur they told us that their old API was deprecated or disabled, unfortunately this was not communicated. +Although we are working hard on Greenshot 1.3, where we changed most of the Imgur code already, we can't release it. +We did see a need to fix the imgur uploads, so in this release we quickly updated the Imgur API. +This should resolve a lot of tickets that were reported to us. + +Additionally our website http://getgreenshot.org is hosted by sourceforge and they seem to have a lot of stability problems. +Due to these problems a bug in the Greenshot update check manifested itself and causes Greenshot to get slow or even stop responding. +In this version we fix the bug in the update check, and we are also working on a solution for the instability with our website. + +Here is the list of chances: + +Bugs Resolved: + +BUG-1527 / BUG-1848 / BUG-1850 / BUG-1851 / BUG-1859 : Greenshot stops responding, hangs or crashes +BUG-1843 / BUG-1844 / BUG-1846 : Imgur problems with authenticated uploads +BUG-1864: Imgur link wasn't copied to the clipboard + +Features: +FEATURE-896: Use Imgur with HTTPS (with changing the Imgur API from V2 to V3 this was already required for the upload anyway.) + + + +1.2.7.2-342a506 RELEASE + Bugs Resolved: * BUG-1809: OverflowException when changing the windows input language * BUG-1835: Imgur: uploads were cancelled due to a timeout which was set too small diff --git a/GreenshotBoxPlugin/GreenshotBoxPlugin.csproj b/GreenshotBoxPlugin/GreenshotBoxPlugin.csproj index 57a002359..7bc39f15a 100644 --- a/GreenshotBoxPlugin/GreenshotBoxPlugin.csproj +++ b/GreenshotBoxPlugin/GreenshotBoxPlugin.csproj @@ -1,5 +1,5 @@  - + {697CF066-9077-4F22-99D9-D989CCE7282B} @@ -14,6 +14,11 @@ false Always + + + + + 3.5 diff --git a/GreenshotConfluencePlugin/GreenshotConfluencePlugin.csproj b/GreenshotConfluencePlugin/GreenshotConfluencePlugin.csproj index a0722875c..b0535116e 100644 --- a/GreenshotConfluencePlugin/GreenshotConfluencePlugin.csproj +++ b/GreenshotConfluencePlugin/GreenshotConfluencePlugin.csproj @@ -1,8 +1,8 @@  - + - 1685 + 1685 {C3052651-598A-44E2-AAB3-2E41311D50F9} Library GreenshotConfluencePlugin @@ -15,6 +15,11 @@ false OnBuildSuccess Client + + + + + 3.5 diff --git a/GreenshotDropboxPlugin/GreenshotDropboxPlugin.csproj b/GreenshotDropboxPlugin/GreenshotDropboxPlugin.csproj index a9f9a0092..58f8f231e 100644 --- a/GreenshotDropboxPlugin/GreenshotDropboxPlugin.csproj +++ b/GreenshotDropboxPlugin/GreenshotDropboxPlugin.csproj @@ -1,5 +1,5 @@  - + {AD7CFFE2-40E7-46CF-A172-D48CF7AE9A12} @@ -14,6 +14,11 @@ false Always + + + + + 3.5 diff --git a/GreenshotExternalCommandPlugin/GreenshotExternalCommandPlugin.csproj b/GreenshotExternalCommandPlugin/GreenshotExternalCommandPlugin.csproj index ca0f6b424..2f534d1b4 100644 --- a/GreenshotExternalCommandPlugin/GreenshotExternalCommandPlugin.csproj +++ b/GreenshotExternalCommandPlugin/GreenshotExternalCommandPlugin.csproj @@ -1,5 +1,5 @@  - + {47F23C86-604E-4CC3-8767-B3D4088F30BB} @@ -14,6 +14,11 @@ false OnBuildSuccess + + + + + 3.5 diff --git a/GreenshotFlickrPlugin/FlickrPlugin.cs b/GreenshotFlickrPlugin/FlickrPlugin.cs index 6e3285afb..ba6210b6e 100644 --- a/GreenshotFlickrPlugin/FlickrPlugin.cs +++ b/GreenshotFlickrPlugin/FlickrPlugin.cs @@ -125,7 +125,7 @@ namespace GreenshotFlickrPlugin _config.ShowConfigDialog(); } - public bool Upload(ICaptureDetails captureDetails, ISurface surface, out String uploadUrl) { + public bool Upload(ICaptureDetails captureDetails, ISurface surface, out string uploadUrl) { SurfaceOutputSettings outputSettings = new SurfaceOutputSettings(_config.UploadFormat, _config.UploadJpegQuality, false); uploadUrl = null; try { diff --git a/GreenshotFlickrPlugin/GreenshotFlickrPlugin.csproj b/GreenshotFlickrPlugin/GreenshotFlickrPlugin.csproj index 50ee51535..5c3c047e0 100644 --- a/GreenshotFlickrPlugin/GreenshotFlickrPlugin.csproj +++ b/GreenshotFlickrPlugin/GreenshotFlickrPlugin.csproj @@ -1,5 +1,5 @@  - + {7EC72A5A-D73A-4B4B-9CA1-2216C7D92D5E} @@ -15,6 +15,10 @@ Always 3.5 + + + + diff --git a/GreenshotImgurPlugin/GreenshotImgurPlugin.csproj b/GreenshotImgurPlugin/GreenshotImgurPlugin.csproj index 8cdaff142..6dea91f73 100644 --- a/GreenshotImgurPlugin/GreenshotImgurPlugin.csproj +++ b/GreenshotImgurPlugin/GreenshotImgurPlugin.csproj @@ -1,5 +1,5 @@  - + {80D8DEB9-94E3-4876-8CCA-2DF1ED5F2C50} @@ -17,7 +17,8 @@ 3.5 - + + diff --git a/GreenshotImgurPlugin/ImgurConfiguration.cs b/GreenshotImgurPlugin/ImgurConfiguration.cs index 4dfb5acb3..104839352 100644 --- a/GreenshotImgurPlugin/ImgurConfiguration.cs +++ b/GreenshotImgurPlugin/ImgurConfiguration.cs @@ -18,6 +18,8 @@ * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ + +using System; using System.Collections.Generic; using System.Windows.Forms; using Greenshot.IniFile; @@ -41,14 +43,26 @@ namespace GreenshotImgurPlugin { public int UploadJpegQuality; [IniProperty("UploadReduceColors", Description="Reduce color amount of the uploaded image to 256", DefaultValue="False")] public bool UploadReduceColors; + [IniProperty("CopyLinkToClipboard", Description = "Copy the link, which one is controlled by the UsePageLink, on the clipboard", DefaultValue = "True")] + public bool CopyLinkToClipboard; [IniProperty("UsePageLink", Description = "Use pagelink instead of direct link on the clipboard", DefaultValue = "False")] public bool UsePageLink; [IniProperty("AnonymousAccess", Description = "Use anonymous access to Imgur", DefaultValue="true")] public bool AnonymousAccess; - [IniProperty("ImgurToken", Description = "The Imgur token", Encrypted=true, ExcludeIfNull=true)] - public string ImgurToken; - [IniProperty("ImgurTokenSecret", Description = "The Imgur token secret", Encrypted=true, ExcludeIfNull=true)] - public string ImgurTokenSecret; + + [IniProperty("RefreshToken", Description = "Imgur refresh Token", Encrypted = true, ExcludeIfNull = true)] + public string RefreshToken; + + /// + /// AccessToken, not stored + /// + public string AccessToken; + + /// + /// AccessTokenExpires, not stored + /// + public DateTimeOffset AccessTokenExpires; + [IniProperty("AddTitle", Description = "Is the title passed on to Imgur", DefaultValue = "False")] public bool AddTitle; [IniProperty("AddFilename", Description = "Is the filename passed on to Imgur", DefaultValue = "False")] diff --git a/GreenshotImgurPlugin/ImgurInfo.cs b/GreenshotImgurPlugin/ImgurInfo.cs index fd8b61d20..37e5a3ce8 100644 --- a/GreenshotImgurPlugin/ImgurInfo.cs +++ b/GreenshotImgurPlugin/ImgurInfo.cs @@ -29,10 +29,11 @@ namespace GreenshotImgurPlugin /// public class ImgurInfo : IDisposable { private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(ImgurInfo)); - private string hash; - public string Hash { - get {return hash;} - set {hash = value;} + + public string Hash + { + get; + set; } private string deleteHash; @@ -40,57 +41,58 @@ namespace GreenshotImgurPlugin get {return deleteHash;} set { deleteHash = value; - deletePage = "http://imgur.com/delete/" + value; + DeletePage = "https://imgur.com/delete/" + value; } } - private string title; - public string Title { - get {return title;} - set {title = value;} + public string Title + { + get; + set; } - private string imageType; - public string ImageType { - get {return imageType;} - set {imageType = value;} + public string ImageType + { + get; + set; } - private DateTime timestamp; - public DateTime Timestamp { - get {return timestamp;} - set {timestamp = value;} + public DateTime Timestamp + { + get; + set; } - private string original; - public string Original { - get {return original;} - set {original = value;} + public string Original + { + get; + set; } - private string page; - public string Page { - get {return page;} - set {page = value;} + public string Page + { + get; + set; } - private string smallSquare; - public string SmallSquare { - get {return smallSquare;} - set {smallSquare = value;} + public string SmallSquare + { + get; + set; } - private string largeThumbnail; - public string LargeThumbnail { - get {return largeThumbnail;} - set {largeThumbnail = value;} + public string LargeThumbnail + { + get; + set; } - private string deletePage; - public string DeletePage { - get {return deletePage;} - set {deletePage = value;} + public string DeletePage + { + get; + set; } + private Image image; public Image Image { get {return image;} @@ -166,48 +168,43 @@ namespace GreenshotImgurPlugin } nodes = doc.GetElementsByTagName("datetime"); if(nodes.Count > 0) { - try + // Version 3 has seconds since Epoch + double secondsSince; + if (double.TryParse(nodes.Item(0).InnerText, out secondsSince)) { - imgurInfo.Timestamp = DateTime.Parse(nodes.Item(0).InnerText); - } - catch (Exception) - { - // Version 3 has seconds since Epoch - double secondsSince; - if (double.TryParse(nodes.Item(0).InnerText, out secondsSince)) - { - var epoch = new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero); - imgurInfo.Timestamp = epoch.AddSeconds(secondsSince).DateTime; - } + var epoch = new DateTimeOffset(1970, 1, 1, 0, 0, 0, TimeSpan.Zero); + imgurInfo.Timestamp = epoch.AddSeconds(secondsSince).DateTime; } } nodes = doc.GetElementsByTagName("original"); - if(nodes.Count > 0) { - imgurInfo.Original = nodes.Item(0).InnerText; + if (nodes.Count > 0) + { + imgurInfo.Original = nodes.Item(0).InnerText.Replace("http:", "https:"); } // Version 3 API only has Link nodes = doc.GetElementsByTagName("link"); if (nodes.Count > 0) { - imgurInfo.Original = nodes.Item(0).InnerText; + imgurInfo.Original = nodes.Item(0).InnerText.Replace("http:", "https:"); } nodes = doc.GetElementsByTagName("imgur_page"); if (nodes.Count > 0) { - imgurInfo.Page = nodes.Item(0).InnerText; + imgurInfo.Page = nodes.Item(0).InnerText.Replace("http:", "https:"); } else { // Version 3 doesn't have a page link in the response - imgurInfo.Page = string.Format("http://imgur.com/{0}", imgurInfo.Hash); + imgurInfo.Page = string.Format("https://imgur.com/{0}", imgurInfo.Hash); } nodes = doc.GetElementsByTagName("small_square"); if(nodes.Count > 0) { imgurInfo.SmallSquare = nodes.Item(0).InnerText; } nodes = doc.GetElementsByTagName("large_thumbnail"); - if(nodes.Count > 0) { - imgurInfo.LargeThumbnail = nodes.Item(0).InnerText; + if(nodes.Count > 0) + { + imgurInfo.LargeThumbnail = nodes.Item(0).InnerText.Replace("http:", "https:"); } } catch(Exception e) { LOG.ErrorFormat("Could not parse Imgur response due to error {0}, response was: {1}", e.Message, response); diff --git a/GreenshotImgurPlugin/ImgurPlugin.cs b/GreenshotImgurPlugin/ImgurPlugin.cs index 6c7b4c57a..c5c354eec 100644 --- a/GreenshotImgurPlugin/ImgurPlugin.cs +++ b/GreenshotImgurPlugin/ImgurPlugin.cs @@ -194,17 +194,27 @@ namespace GreenshotImgurPlugin { imgurInfo.Image = ImageHelper.CreateThumbnail(tmpImage, 90, 90); } IniConfig.Save(); - try { - if (config.UsePageLink) { - uploadURL = imgurInfo.Page; - ClipboardHelper.SetClipboardData(imgurInfo.Page); - } else { - uploadURL = imgurInfo.Original; - ClipboardHelper.SetClipboardData(imgurInfo.Original); + + if (config.UsePageLink) + { + uploadURL = imgurInfo.Page; + } + else + { + uploadURL = imgurInfo.Original; + } + if (!string.IsNullOrEmpty(uploadURL) && config.CopyLinkToClipboard) + { + try + { + ClipboardHelper.SetClipboardData(uploadURL); + + } + catch (Exception ex) + { + LOG.Error("Can't write to clipboard: ", ex); + uploadURL = null; } - } catch (Exception ex) { - LOG.Error("Can't write to clipboard: ", ex); - uploadURL = null; } return true; } diff --git a/GreenshotImgurPlugin/ImgurUtils.cs b/GreenshotImgurPlugin/ImgurUtils.cs index 7e4829a64..3bb80e0f8 100644 --- a/GreenshotImgurPlugin/ImgurUtils.cs +++ b/GreenshotImgurPlugin/ImgurUtils.cs @@ -33,38 +33,39 @@ namespace GreenshotImgurPlugin { /// public static class ImgurUtils { private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(ImgurUtils)); - private const string IMGUR_ANONYMOUS_API_KEY = "60e8838e21d6b66"; - private const string SMALL_URL_PATTERN = "http://i.imgur.com/{0}s.png"; - private static ImgurConfiguration config = IniConfig.GetIniSection(); + private const string SmallUrlPattern = "http://i.imgur.com/{0}s.jpg"; + private static readonly ImgurConfiguration Config = IniConfig.GetIniSection(); + private const string AuthUrlPattern = "https://api.imgur.com/oauth2/authorize?response_type=code&client_id={ClientId}&redirect_uri={RedirectUrl}&state={State}"; + private const string TokenUrl = "https://api.imgur.com/oauth2/token"; /// /// Load the complete history of the imgur uploads, with the corresponding information /// public static void LoadHistory() { - if (config.runtimeImgurHistory.Count == config.ImgurUploadHistory.Count) { + if (Config.runtimeImgurHistory.Count == Config.ImgurUploadHistory.Count) { return; } // Load the ImUr history List hashes = new List(); - foreach(string hash in config.ImgurUploadHistory.Keys) { + foreach(string hash in Config.ImgurUploadHistory.Keys) { hashes.Add(hash); } bool saveNeeded = false; foreach(string hash in hashes) { - if (config.runtimeImgurHistory.ContainsKey(hash)) { + if (Config.runtimeImgurHistory.ContainsKey(hash)) { // Already loaded continue; } try { - ImgurInfo imgurInfo = RetrieveImgurInfo(hash, config.ImgurUploadHistory[hash]); + ImgurInfo imgurInfo = RetrieveImgurInfo(hash, Config.ImgurUploadHistory[hash]); if (imgurInfo != null) { RetrieveImgurThumbnail(imgurInfo); - config.runtimeImgurHistory.Add(hash, imgurInfo); + Config.runtimeImgurHistory.Add(hash, imgurInfo); } else { LOG.DebugFormat("Deleting not found ImgUr {0} from config.", hash); - config.ImgurUploadHistory.Remove(hash); + Config.ImgurUploadHistory.Remove(hash); saveNeeded = true; } } catch (WebException wE) { @@ -74,7 +75,7 @@ namespace GreenshotImgurPlugin { // 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); + Config.ImgurUploadHistory.Remove(hash); redirected = true; } } @@ -96,7 +97,7 @@ namespace GreenshotImgurPlugin { /// /// private static void SetClientId(HttpWebRequest webRequest) { - webRequest.Headers.Add("Authorization", "Client-ID " + IMGUR_ANONYMOUS_API_KEY); + webRequest.Headers.Add("Authorization", "Client-ID " + ImgurCredentials.CONSUMER_KEY); } /// @@ -109,21 +110,20 @@ namespace GreenshotImgurPlugin { /// Filename /// ImgurInfo with details public static ImgurInfo UploadToImgur(ISurface surfaceToUpload, SurfaceOutputSettings outputSettings, string title, string filename) { - IDictionary uploadParameters = new Dictionary(); IDictionary otherParameters = new Dictionary(); // add title - if (title != null && config.AddTitle) { + if (title != null && Config.AddTitle) { otherParameters.Add("title", title); } // add filename - if (filename != null && config.AddFilename) { + if (filename != null && Config.AddFilename) { otherParameters.Add("name", filename); } - string responseString = null; - if (config.AnonymousAccess) { + string responseString; + if (Config.AnonymousAccess) { // add key, we only use the other parameters for the AnonymousAccess //otherParameters.Add("key", IMGUR_ANONYMOUS_API_KEY); - HttpWebRequest webRequest = NetworkHelper.CreateWebRequest(config.ImgurApi3Url + "/upload.xml?" + NetworkHelper.GenerateQueryParameters(otherParameters), HTTPMethod.POST); + HttpWebRequest webRequest = NetworkHelper.CreateWebRequest(Config.ImgurApi3Url + "/upload.xml?" + NetworkHelper.GenerateQueryParameters(otherParameters), HTTPMethod.POST); webRequest.ContentType = "image/" + outputSettings.Format; webRequest.ServicePoint.Expect100Continue = false; @@ -144,40 +144,38 @@ namespace GreenshotImgurPlugin { throw; } } else { - OAuthSession oAuth = new OAuthSession(ImgurCredentials.CONSUMER_KEY, ImgurCredentials.CONSUMER_SECRET); - oAuth.BrowserSize = new Size(650, 500); - oAuth.CallbackUrl = "http://getgreenshot.org"; - oAuth.AccessTokenUrl = "http://api.imgur.com/oauth/access_token"; - oAuth.AuthorizeUrl = "http://api.imgur.com/oauth/authorize"; - oAuth.RequestTokenUrl = "http://api.imgur.com/oauth/request_token"; - oAuth.LoginTitle = "Imgur authorization"; - oAuth.Token = config.ImgurToken; - oAuth.TokenSecret = config.ImgurTokenSecret; - if (string.IsNullOrEmpty(oAuth.Token)) { - if (!oAuth.Authorize()) { - return null; - } - if (!string.IsNullOrEmpty(oAuth.Token)) { - config.ImgurToken = oAuth.Token; - } - if (!string.IsNullOrEmpty(oAuth.TokenSecret)) { - config.ImgurTokenSecret = oAuth.TokenSecret; - } - IniConfig.Save(); - } - try { + + var oauth2Settings = new OAuth2Settings(); + oauth2Settings.AuthUrlPattern = AuthUrlPattern; + oauth2Settings.TokenUrl = TokenUrl; + oauth2Settings.RedirectUrl = "https://imgur.com"; + oauth2Settings.CloudServiceName = "Imgur"; + oauth2Settings.ClientId = ImgurCredentials.CONSUMER_KEY; + oauth2Settings.ClientSecret = ImgurCredentials.CONSUMER_SECRET; + oauth2Settings.AuthorizeMode = OAuth2AuthorizeMode.EmbeddedBrowser; + oauth2Settings.BrowserSize = new Size(680, 880); + + // Copy the settings from the config, which is kept in memory and on the disk + oauth2Settings.RefreshToken = Config.RefreshToken; + oauth2Settings.AccessToken = Config.AccessToken; + oauth2Settings.AccessTokenExpires = Config.AccessTokenExpires; + + try + { + var webRequest = OAuth2Helper.CreateOAuth2WebRequest(HTTPMethod.POST, Config.ImgurApi3Url + "/upload.xml", oauth2Settings); otherParameters.Add("image", new SurfaceContainer(surfaceToUpload, outputSettings, filename)); - responseString = oAuth.MakeOAuthRequest(HTTPMethod.POST, "http://api.imgur.com/2/account/images.xml", uploadParameters, otherParameters, null); - } catch (Exception ex) { - LOG.Error("Upload to imgur gave an exeption: ", ex); - throw; - } finally { - if (oAuth.Token != null) { - config.ImgurToken = oAuth.Token; - } - if (oAuth.TokenSecret != null) { - config.ImgurTokenSecret = oAuth.TokenSecret; - } + + NetworkHelper.WriteMultipartFormData(webRequest, otherParameters); + + responseString = NetworkHelper.GetResponseAsString(webRequest); + } + finally + { + // Copy the settings back to the config, so they are stored. + Config.RefreshToken = oauth2Settings.RefreshToken; + Config.AccessToken = oauth2Settings.AccessToken; + Config.AccessTokenExpires = oauth2Settings.AccessTokenExpires; + Config.IsDirty = true; IniConfig.Save(); } } @@ -194,15 +192,17 @@ namespace GreenshotImgurPlugin { return; } LOG.InfoFormat("Retrieving Imgur image for {0} with url {1}", imgurInfo.Hash, imgurInfo.SmallSquare); - HttpWebRequest webRequest = NetworkHelper.CreateWebRequest(string.Format(SMALL_URL_PATTERN, imgurInfo.Hash), HTTPMethod.GET); + HttpWebRequest webRequest = NetworkHelper.CreateWebRequest(string.Format(SmallUrlPattern, imgurInfo.Hash), HTTPMethod.GET); webRequest.ServicePoint.Expect100Continue = false; SetClientId(webRequest); using (WebResponse response = webRequest.GetResponse()) { LogRateLimitInfo(response); Stream responseStream = response.GetResponseStream(); - imgurInfo.Image = Image.FromStream(responseStream); + if (responseStream != null) + { + imgurInfo.Image = Image.FromStream(responseStream); + } } - return; } /// @@ -212,7 +212,7 @@ namespace GreenshotImgurPlugin { /// /// ImgurInfo public static ImgurInfo RetrieveImgurInfo(string hash, string deleteHash) { - string url = config.ImgurApiUrl + "/image/" + hash; + string url = Config.ImgurApiUrl + "/image/" + hash; LOG.InfoFormat("Retrieving Imgur info for {0} with url {1}", hash, url); HttpWebRequest webRequest = NetworkHelper.CreateWebRequest(url, HTTPMethod.GET); webRequest.ServicePoint.Expect100Continue = false; @@ -247,7 +247,7 @@ namespace GreenshotImgurPlugin { LOG.InfoFormat("Deleting Imgur image for {0}", imgurInfo.DeleteHash); try { - string url = config.ImgurApiUrl + "/delete/" + imgurInfo.DeleteHash; + string url = Config.ImgurApiUrl + "/delete/" + imgurInfo.DeleteHash; HttpWebRequest webRequest = NetworkHelper.CreateWebRequest(url, HTTPMethod.GET); webRequest.ServicePoint.Expect100Continue = false; SetClientId(webRequest); @@ -268,8 +268,8 @@ namespace GreenshotImgurPlugin { } } // Make sure we remove it from the history, if no error occured - config.runtimeImgurHistory.Remove(imgurInfo.Hash); - config.ImgurUploadHistory.Remove(imgurInfo.Hash); + Config.runtimeImgurHistory.Remove(imgurInfo.Hash); + Config.ImgurUploadHistory.Remove(imgurInfo.Hash); imgurInfo.Image = null; } @@ -304,9 +304,9 @@ namespace GreenshotImgurPlugin { LogHeader(nameValues, "X-RateLimit-ClientRemaining"); // Update the credits in the config, this is shown in a form - int credits = 0; + int credits; if (nameValues.ContainsKey("X-RateLimit-Remaining") && int.TryParse(nameValues["X-RateLimit-Remaining"], out credits)) { - config.Credits = credits; + Config.Credits = credits; } } } diff --git a/GreenshotJiraPlugin/GreenshotJiraPlugin.csproj b/GreenshotJiraPlugin/GreenshotJiraPlugin.csproj index f844ceb09..671d710a9 100644 --- a/GreenshotJiraPlugin/GreenshotJiraPlugin.csproj +++ b/GreenshotJiraPlugin/GreenshotJiraPlugin.csproj @@ -1,5 +1,5 @@  - + {19FEEF09-313F-43C7-819D-F1BCA782B08B} @@ -17,7 +17,8 @@ 3.5 - + + @@ -37,7 +38,9 @@ JiraForm.cs - + + Form + Form diff --git a/GreenshotOCRCommand/GreenshotOCRCommand.csproj b/GreenshotOCRCommand/GreenshotOCRCommand.csproj index 49089a7fb..94b553e26 100644 --- a/GreenshotOCRCommand/GreenshotOCRCommand.csproj +++ b/GreenshotOCRCommand/GreenshotOCRCommand.csproj @@ -1,5 +1,5 @@  - + Debug x86 @@ -20,6 +20,11 @@ Off 4194304 x86 + + + + + 3.5 full diff --git a/GreenshotOCRPlugin/GreenshotOCRPlugin.csproj b/GreenshotOCRPlugin/GreenshotOCRPlugin.csproj index 7d0c78be1..56cbb92ca 100644 --- a/GreenshotOCRPlugin/GreenshotOCRPlugin.csproj +++ b/GreenshotOCRPlugin/GreenshotOCRPlugin.csproj @@ -1,5 +1,5 @@  - + {C6988EE8-2FEE-4349-9F09-F9628A0D8965} @@ -17,7 +17,8 @@ 3.5 - + + diff --git a/GreenshotOfficePlugin/GreenshotOfficePlugin.csproj b/GreenshotOfficePlugin/GreenshotOfficePlugin.csproj index 7709d4fb3..07bf79ccf 100644 --- a/GreenshotOfficePlugin/GreenshotOfficePlugin.csproj +++ b/GreenshotOfficePlugin/GreenshotOfficePlugin.csproj @@ -1,5 +1,5 @@  - + {92599C09-FF29-4ABD-B6E6-C48ECD781BAB} Debug @@ -15,6 +15,11 @@ 4 false + + + + + 3.5 x86 diff --git a/GreenshotOfficePlugin/OfficePlugin.cs b/GreenshotOfficePlugin/OfficePlugin.cs index 0f90a6243..234171a74 100644 --- a/GreenshotOfficePlugin/OfficePlugin.cs +++ b/GreenshotOfficePlugin/OfficePlugin.cs @@ -31,7 +31,6 @@ namespace GreenshotOfficePlugin { public class OfficePlugin : IGreenshotPlugin { private static readonly log4net.ILog LOG = log4net.LogManager.GetLogger(typeof(OfficePlugin)); public static PluginAttribute Attributes; - private IGreenshotHost host; public void Dispose() { Dispose(true); @@ -42,11 +41,8 @@ namespace GreenshotOfficePlugin { //if (disposing) {} } - public OfficePlugin() { - } - public IEnumerable Destinations() { - IDestination destination = null; + IDestination destination; try { destination = new ExcelDestination(); } catch { @@ -100,12 +96,10 @@ namespace GreenshotOfficePlugin { /// /// Implementation of the IGreenshotPlugin.Initialize /// - /// Use the IGreenshotPluginHost interface to register events - /// Use the ICaptureHost interface to register in the MainContextMenu - /// My own attributes + /// Use the IGreenshotPluginHost interface to register events + /// My own attributes /// true if plugin is initialized, false if not (doesn't show) public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes) { - this.host = (IGreenshotHost)pluginHost; Attributes = myAttributes; return true; } diff --git a/GreenshotPhotobucketPlugin/GreenshotPhotobucketPlugin.csproj b/GreenshotPhotobucketPlugin/GreenshotPhotobucketPlugin.csproj index aaa61dcd4..2a5bfe70e 100644 --- a/GreenshotPhotobucketPlugin/GreenshotPhotobucketPlugin.csproj +++ b/GreenshotPhotobucketPlugin/GreenshotPhotobucketPlugin.csproj @@ -1,5 +1,5 @@  - + {9C0ECC4C-7807-4111-916A-4F57BB29788A} @@ -14,6 +14,11 @@ false OnBuildSuccess + + + + + 3.5 diff --git a/GreenshotPicasaPlugin/GreenshotPicasaPlugin.csproj b/GreenshotPicasaPlugin/GreenshotPicasaPlugin.csproj index 67beb0e1b..926f22050 100644 --- a/GreenshotPicasaPlugin/GreenshotPicasaPlugin.csproj +++ b/GreenshotPicasaPlugin/GreenshotPicasaPlugin.csproj @@ -1,5 +1,5 @@  - + {1893A2E4-A78A-4713-A8E7-E70058DABEE0} @@ -13,9 +13,12 @@ 4 false Always - + + 3.5 + + diff --git a/GreenshotPlugin/Core/NetworkHelper.cs b/GreenshotPlugin/Core/NetworkHelper.cs index 0acf63bf3..dc816eab7 100644 --- a/GreenshotPlugin/Core/NetworkHelper.cs +++ b/GreenshotPlugin/Core/NetworkHelper.cs @@ -77,12 +77,18 @@ namespace GreenshotPlugin.Core { Uri url = new Uri(baseUri, new Uri("favicon.ico")); try { HttpWebRequest request = CreateWebRequest(url); - HttpWebResponse response = (HttpWebResponse)request.GetResponse(); - if (request.HaveResponse) { - using (Stream responseStream = response.GetResponseStream()) { - if (responseStream != null) { - using (Image image = Image.FromStream(responseStream)) { - return (image.Height > 16 && image.Width > 16) ? new Bitmap(image, 16, 16) : new Bitmap(image); + using (HttpWebResponse response = (HttpWebResponse)request.GetResponse()) + { + if (request.HaveResponse) + { + using (Stream responseStream = response.GetResponseStream()) + { + if (responseStream != null) + { + using (Image image = Image.FromStream(responseStream)) + { + return (image.Height > 16 && image.Width > 16) ? new Bitmap(image, 16, 16) : new Bitmap(image); + } } } } @@ -424,6 +430,32 @@ namespace GreenshotPlugin.Core { return GetResponseAsString(webRequest, false); } + /// + /// Read the response as string + /// + /// + /// string or null + private static string GetResponseAsString(HttpWebResponse response) + { + string responseData = null; + if (response == null) + { + return null; + } + using (response) + { + Stream responseStream = response.GetResponseStream(); + if (responseStream != null) + { + using (StreamReader reader = new StreamReader(responseStream, true)) + { + responseData = reader.ReadToEnd(); + } + } + } + return responseData; + } + /// /// /// @@ -431,40 +463,54 @@ namespace GreenshotPlugin.Core { /// public static string GetResponseAsString(HttpWebRequest webRequest, bool alsoReturnContentOnError) { string responseData = null; - try { - HttpWebResponse response = (HttpWebResponse) webRequest.GetResponse(); + HttpWebResponse response = null; + bool isHttpError = false; + try { + response = (HttpWebResponse)webRequest.GetResponse(); LOG.InfoFormat("Response status: {0}", response.StatusCode); - bool isHttpError = (int) response.StatusCode >= 300; - DebugHeaders(response); - Stream responseStream = response.GetResponseStream(); - if (responseStream != null) { - using (StreamReader reader = new StreamReader(responseStream, true)) { - responseData = reader.ReadToEnd(); - } - if (isHttpError) { - LOG.ErrorFormat("HTTP error {0} with content: {1}", response.StatusCode, responseData); - } - } - } catch (WebException e) { - HttpWebResponse response = (HttpWebResponse) e.Response; - if (response != null) { + isHttpError = (int)response.StatusCode >= 300; + if (isHttpError) + { LOG.ErrorFormat("HTTP error {0}", response.StatusCode); - using (Stream responseStream = response.GetResponseStream()) { - if (responseStream != null) { - using (StreamReader streamReader = new StreamReader(responseStream, true)) { - string errorContent = streamReader.ReadToEnd(); - if (alsoReturnContentOnError) { - return errorContent; - } - LOG.ErrorFormat("Content: {0}", errorContent); - } - } + } + DebugHeaders(response); + responseData = GetResponseAsString(response); + if (isHttpError) + { + LOG.ErrorFormat("HTTP response {0}", responseData); + } + } + catch (WebException e) { + response = (HttpWebResponse) e.Response; + HttpStatusCode statusCode = HttpStatusCode.Unused; + if (response != null) { + statusCode = response.StatusCode; + LOG.ErrorFormat("HTTP error {0}", statusCode); + string errorContent = GetResponseAsString(response); + if (alsoReturnContentOnError) + { + return errorContent; } + LOG.ErrorFormat("Content: {0}", errorContent); } LOG.Error("WebException: ", e); + if (statusCode == HttpStatusCode.Unauthorized) + { + throw new UnauthorizedAccessException(e.Message); + } throw; } - + finally + { + if (response != null) + { + if (isHttpError) + { + LOG.ErrorFormat("HTTP error {0} with content: {1}", response.StatusCode, responseData); + } + response.Close(); + } + } return responseData; } @@ -477,9 +523,11 @@ namespace GreenshotPlugin.Core { try { HttpWebRequest webRequest = CreateWebRequest(uri); webRequest.Method = HTTPMethod.HEAD.ToString(); - HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse(); - LOG.DebugFormat("RSS feed was updated at {0}", webResponse.LastModified); - return webResponse.LastModified; + using (HttpWebResponse webResponse = (HttpWebResponse)webRequest.GetResponse()) + { + LOG.DebugFormat("RSS feed was updated at {0}", webResponse.LastModified); + return webResponse.LastModified; + } } catch (Exception wE) { LOG.WarnFormat("Problem requesting HTTP - HEAD on uri {0}", uri); LOG.Warn(wE.Message); diff --git a/GreenshotPlugin/Core/OAuthHelper.cs b/GreenshotPlugin/Core/OAuthHelper.cs index 94b73dc8c..110736f5e 100644 --- a/GreenshotPlugin/Core/OAuthHelper.cs +++ b/GreenshotPlugin/Core/OAuthHelper.cs @@ -476,7 +476,8 @@ namespace GreenshotPlugin.Core { /// /// Get the request token using the consumer key and secret. Also initializes tokensecret /// - private void GetRequestToken() { + /// response, this doesn't need to be used!! + private string GetRequestToken() { IDictionary parameters = new Dictionary(); foreach(var value in _requestTokenParameters) { parameters.Add(value); @@ -493,15 +494,17 @@ namespace GreenshotPlugin.Core { TokenSecret = _requestTokenResponseParameters[OAUTH_TOKEN_SECRET_KEY]; } } + return response; } /// /// Authorize the token by showing the dialog /// + /// Pass the response from the server's request token, so if there is something wrong we can show it. /// The request token. - private String GetAuthorizeToken() { + private string GetAuthorizeToken(string requestTokenResponse) { if (string.IsNullOrEmpty(Token)) { - Exception e = new Exception("The request token is not set"); + Exception e = new Exception("The request token is not set, service responded with: " + requestTokenResponse); throw e; } LOG.DebugFormat("Opening AuthorizationLink: {0}", AuthorizationLink); @@ -532,7 +535,7 @@ namespace GreenshotPlugin.Core { /// Get the access token /// /// The access token. - private String GetAccessToken() { + private string GetAccessToken() { if (string.IsNullOrEmpty(Token) || (CheckVerifier && string.IsNullOrEmpty(Verifier))) { Exception e = new Exception("The request token and verifier were not set"); throw e; @@ -567,13 +570,14 @@ namespace GreenshotPlugin.Core { TokenSecret = null; Verifier = null; LOG.Debug("Creating Token"); - try { - GetRequestToken(); + string requestTokenResponse; + try { + requestTokenResponse = GetRequestToken(); } catch (Exception ex) { LOG.Error(ex); throw new NotSupportedException("Service is not available: " + ex.Message); } - if (string.IsNullOrEmpty(GetAuthorizeToken())) { + if (string.IsNullOrEmpty(GetAuthorizeToken(requestTokenResponse))) { LOG.Debug("User didn't authenticate!"); return false; } @@ -663,39 +667,36 @@ namespace GreenshotPlugin.Core { } try { Sign(method, signUrl, parametersToSign); - + // Join all parameters IDictionary newParameters = new Dictionary(); - foreach(var parameter in parametersToSign) { + foreach (var parameter in parametersToSign) { newParameters.Add(parameter); } if (additionalParameters != null) { - foreach(var parameter in additionalParameters) { + foreach (var parameter in additionalParameters) { newParameters.Add(parameter); } } return MakeRequest(method, requestURL, headers, newParameters, postData); - } catch (WebException wEx) { - lastException = wEx; - if (wEx.Response != null) { - HttpWebResponse response = wEx.Response as HttpWebResponse; - if (response != null && response.StatusCode == HttpStatusCode.Unauthorized) { - Token = null; - TokenSecret = null; - // Remove oauth keys, so they aren't added double - List keysToDelete = new List(); - foreach (string parameterKey in parametersToSign.Keys) { - if (parameterKey.StartsWith(OAUTH_PARAMETER_PREFIX)) { - keysToDelete.Add(parameterKey); - } - } - foreach(string keyToDelete in keysToDelete) { - parametersToSign.Remove(keyToDelete); - } - continue; + } catch (UnauthorizedAccessException uaEx) { + lastException = uaEx; + Token = null; + TokenSecret = null; + // Remove oauth keys, so they aren't added double + List keysToDelete = new List(); + foreach (string parameterKey in parametersToSign.Keys) + { + if (parameterKey.StartsWith(OAUTH_PARAMETER_PREFIX)) + { + keysToDelete.Add(parameterKey); } } - throw; + foreach (string keyToDelete in keysToDelete) + { + parametersToSign.Remove(keyToDelete); + } + continue; } } if (lastException != null) { diff --git a/GreenshotPlugin/Core/SourceForgeHelper.cs b/GreenshotPlugin/Core/SourceForgeHelper.cs index c54c27ff5..3a027cbbb 100644 --- a/GreenshotPlugin/Core/SourceForgeHelper.cs +++ b/GreenshotPlugin/Core/SourceForgeHelper.cs @@ -97,15 +97,21 @@ namespace GreenshotPlugin.Core { /// public class SourceForgeHelper { private static ILog LOG = LogManager.GetLogger(typeof(SourceForgeHelper)); - private const String RSSFEED = "http://getgreenshot.org/project-feed/"; + private const string RSSFEED = "http://getgreenshot.org/project-feed/"; /// /// This is using the HTTP HEAD Method to check if the RSS Feed is modified after the supplied date /// /// DateTime /// true if the feed is newer - public static bool isRSSModifiedAfter(DateTime updateTime) { + public static bool IsRSSModifiedAfter(DateTime updateTime) { DateTime lastModified = NetworkHelper.GetLastModified(new Uri(RSSFEED)); + if (lastModified == DateTime.MinValue) + { + // Time could not be read, just take now and add one hour to it. + // This assist BUG-1850 + lastModified = DateTime.Now.AddHours(1); + } return updateTime.CompareTo(lastModified) < 0; } diff --git a/GreenshotPlugin/Core/WindowsHelper.cs b/GreenshotPlugin/Core/WindowsHelper.cs index 15dab04d1..4b69f88ad 100644 --- a/GreenshotPlugin/Core/WindowsHelper.cs +++ b/GreenshotPlugin/Core/WindowsHelper.cs @@ -1490,7 +1490,7 @@ namespace GreenshotPlugin.Core { /// /// IntPtr with the windows handle /// String with ClassName - public static String GetClassName(IntPtr hWnd) { + public static string GetClassName(IntPtr hWnd) { StringBuilder classNameBuilder = new StringBuilder(260, 260); User32.GetClassName(hWnd, classNameBuilder, classNameBuilder.Capacity); return classNameBuilder.ToString(); diff --git a/GreenshotPlugin/GreenshotPlugin.csproj b/GreenshotPlugin/GreenshotPlugin.csproj index e9c313f6f..917a12654 100644 --- a/GreenshotPlugin/GreenshotPlugin.csproj +++ b/GreenshotPlugin/GreenshotPlugin.csproj @@ -1,5 +1,5 @@  - + {5B924697-4DCD-4F98-85F1-105CB84B7341} @@ -14,6 +14,11 @@ 4 false + + + + + 3.5 diff --git a/GreenshotPlugin/UnmanagedHelpers/User32.cs b/GreenshotPlugin/UnmanagedHelpers/User32.cs index 90aabc66e..416a38823 100644 --- a/GreenshotPlugin/UnmanagedHelpers/User32.cs +++ b/GreenshotPlugin/UnmanagedHelpers/User32.cs @@ -142,8 +142,6 @@ namespace GreenshotPlugin.UnmanagedHelpers { public static extern bool ShowScrollBar(IntPtr hwnd, ScrollBarDirection scrollBar, bool show); [DllImport("user32", SetLastError = true)] public static extern int SetScrollPos(IntPtr hWnd, Orientation nBar, int nPos, bool bRedraw); - [DllImport("user32", SetLastError=true)] - public static extern bool PostMessage(IntPtr hWnd, uint msg, int wParam, int lParam); [DllImport("user32", SetLastError = true)] public static extern RegionResult GetWindowRgn(IntPtr hWnd, SafeHandle hRgn); [DllImport("user32", SetLastError = true)] diff --git a/appveyor.yml b/appveyor12.yml similarity index 95% rename from appveyor.yml rename to appveyor12.yml index 2b4283e3e..e8532425e 100644 --- a/appveyor.yml +++ b/appveyor12.yml @@ -1,10 +1,11 @@ -version: 1.2.7.{build} +version: 1.2.8.{build} branches: only: - 1.2 skip_tags: true configuration: Release platform: Any CPU +shallow_clone: true clone_depth: 1 assembly_info: patch: true @@ -26,9 +27,9 @@ environment: credentials_flickr_consumer_secret: secure: 9TthlljPHXWPkDDeG3uiFVJ9YJwHZOV0ZsojaIBBuvw= credentials_imgur_consumer_key: - secure: z8S4QZ3/InPe3dgCf0CNyS0VGKuRyjjP8WMAq+AkK5OZJxZcbIxwobjgelE5CWYL + secure: XRTg1Ecs6ER9m4779CJAng== credentials_imgur_consumer_secret: - secure: ovfXJRorkkKUzbMXuZ4m0U6KF4icngmS+nzSljXJGSKfhI+GNXbMNa//mKYfTCXI + secure: gcCp/gJF8vqmnCUPKyb04H8Oz9mWmiB00U5X7iI/DGr5mxjoCG1khc6/zn6aSSqn credentials_photobucket_consumer_key: secure: oo9GD1Y8dkrli6hMfnnYsw== credentials_photobucket_consumer_secret: @@ -81,4 +82,4 @@ notifications: - jens@getgreenshot.org on_build_success: true on_build_failure: true - on_build_status_changed: false \ No newline at end of file + on_build_status_changed: false diff --git a/appveyor13.yml b/appveyor13.yml new file mode 100644 index 000000000..42be232f5 --- /dev/null +++ b/appveyor13.yml @@ -0,0 +1,92 @@ +version: 1.3.0.{build} +branches: + only: + - 1.3 +skip_tags: true +configuration: Release +platform: Any CPU +shallow_clone: true +assembly_info: + patch: true + file: '**\AssemblyInfo.*' + assembly_version: '{version}' + assembly_file_version: '{version}' + assembly_informational_version: '{version}-$(build_type)-$(APPVEYOR_REPO_COMMIT)' +environment: + credentials_box_client_id: + secure: 8MKxTOowo2fat6cNXGbFfvn6typiEtmCKsrptrWiEFUEoKlT1DUn40iGNcIELRA1 + credentials_box_client_secret: + secure: hJhzDVJuGd/WMnoSXhosvOM/1PGcYlKbtQjA6xyrmnmZcqCTMzqIdA6JXlo/V2Br + credentials_dropbox_consumer_key: + secure: Da/6KY1cu9CUM3iOqSpcUw== + credentials_dropbox_consumer_secret: + secure: KkyKyUY+buT/MZagXDP4cw== + credentials_flickr_consumer_key: + secure: fY8s0OkOMYwCjSZoL/6yZcP8xeT6J2EJLjbUMI5lAW42S5QT2U2B41KrmeP2NpnQ + credentials_flickr_consumer_secret: + secure: 9TthlljPHXWPkDDeG3uiFVJ9YJwHZOV0ZsojaIBBuvw= + credentials_imgur_consumer_key: + secure: XRTg1Ecs6ER9m4779CJAng== + credentials_imgur_consumer_secret: + secure: gcCp/gJF8vqmnCUPKyb04H8Oz9mWmiB00U5X7iI/DGr5mxjoCG1khc6/zn6aSSqn + credentials_photobucket_consumer_key: + secure: oo9GD1Y8dkrli6hMfnnYsw== + credentials_photobucket_consumer_secret: + secure: GiNPoe9klM/YkoHIA/YHqOYrIaYwSFK7Ph9m8jT9uPP1l6+Hd5K8dVMw5DNa50oG + credentials_picasa_consumer_key: + secure: bjKXhFZkDqaq98XBrz5oQKQfT8CLpuv2ZAiBIwkzloaAPUs97b5yx6h/xFaE4NLS + credentials_picasa_consumer_secret: + secure: yNptTpmJWypbu9alOQtetxU66drr2FKxoPflNgRJdag= + build_type: ALPHA +before_build: + - nuget restore + - ps: Build/prebuild.ps1 +build: + project: greenshot.sln + verbosity: normal +after_build: +- ps: Build/build.ps1 +test: off +artifacts: +- path: AssemblyDir\Greenshot*INSTALLER*.exe + name: Installer +- path: AssemblyDir\Greenshot*paf.exe + name: Portable +- path: AssemblyDir\Greenshot-NO*.zip + name: Zip +- path: Build\additional_files\readme.txt + name: Readme +- path: AssemblyDir\Greenshot-DEBUGSYMBOLS*.zip + name: DEBUGSYMBOLS +deploy: +- provider: GitHub + tag: Greenshot-$(build_type)-$(APPVEYOR_BUILD_VERSION) + description: + auth_token: + secure: h0R+O/UoDM5Fy9XBfpRWLxFdR4a6CS+hDxr/MUeiRSviAmUsSlvsGSyOG6KiAVrL + prerelease: true + on: + build_type: RELEASE_CANDIDATE +- provider: GitHub + tag: Greenshot-$(build_type)-$(APPVEYOR_BUILD_VERSION) + description: + auth_token: + secure: h0R+O/UoDM5Fy9XBfpRWLxFdR4a6CS+hDxr/MUeiRSviAmUsSlvsGSyOG6KiAVrL + prerelease: true + on: + build_type: BETA +- provider: GitHub + tag: Greenshot-$(build_type)-$(APPVEYOR_BUILD_VERSION) + auth_token: + secure: h0R+O/UoDM5Fy9XBfpRWLxFdR4a6CS+hDxr/MUeiRSviAmUsSlvsGSyOG6KiAVrL + on: + build_type: RELEASE +notifications: +- provider: Email + to: + - robin@getgreenshot.org + - jens@getgreenshot.org + - thomas@getgreenshot.org + on_build_success: true + on_build_failure: true + on_build_status_changed: true \ No newline at end of file diff --git a/build.ps1 b/build.ps1 index 5327248e2..7e7e2f1d7 100644 --- a/build.ps1 +++ b/build.ps1 @@ -290,5 +290,3 @@ PackagePortable echo "Generating Debug Symbols ZIP" PackageDbgSymbolsZip -echo "build successful, tagging with $fileversion" -TagCode \ No newline at end of file