From 843a07566b67fb10d23a6aa8d67992d0a3569f2a Mon Sep 17 00:00:00 2001 From: Daniel McAssey Date: Mon, 20 Jul 2015 15:51:34 +0100 Subject: [PATCH 1/4] Add LnkU URL Shortener --- ShareX.UploadersLib/Enums.cs | 2 + ShareX.UploadersLib/Favicons/LnkU.ico | Bin 0 -> 1150 bytes .../Forms/UploadersConfigForm.cs | 21 +++++- .../Properties/Resources.Designer.cs | 10 +++ ShareX.UploadersLib/Properties/Resources.resx | 3 + .../ShareX.UploadersLib.csproj | 5 ++ .../URLShorteners/LnkUURLShortener.cs | 69 ++++++++++++++++++ ShareX.UploadersLib/UploadersConfig.cs | 5 ++ ShareX/UploadTask.cs | 6 ++ 9 files changed, 117 insertions(+), 4 deletions(-) create mode 100644 ShareX.UploadersLib/Favicons/LnkU.ico create mode 100644 ShareX.UploadersLib/URLShorteners/LnkUURLShortener.cs diff --git a/ShareX.UploadersLib/Enums.cs b/ShareX.UploadersLib/Enums.cs index 3370fcd12..1da253f40 100644 --- a/ShareX.UploadersLib/Enums.cs +++ b/ShareX.UploadersLib/Enums.cs @@ -154,6 +154,8 @@ public enum UrlShortenerType NLCM, [Description("adf.ly")] AdFly, + [Description("lnku.co")] + LnkU, CustomURLShortener // Localized } diff --git a/ShareX.UploadersLib/Favicons/LnkU.ico b/ShareX.UploadersLib/Favicons/LnkU.ico new file mode 100644 index 0000000000000000000000000000000000000000..1c12613a79312df52fa10ea2542e1578f27ebb56 GIT binary patch literal 1150 zcmZ{jTS!z<6oyY1D(E38u%H*|A)=>(=%Jt}D0(QmVFi`gO*Bj_QR|_LN={i*Y6T&Z zV`WxDQ{jY_O`3SgO2@{=(b1a5oN;VM=a9F#|NVQsgjVP9?RC~(>tFkv#X6ESjdw(Z z#5GEapD9U^k|Zr7+~UsYK8++XHh=CYVSma3KqAYCAruTC6!eGT65`%fGM!9O{c%N% z9QP0Rqp#%=T>4@-^(y?byaQ{rGPdYn`Z3)c+8yML@0T6UrXuR^!u7cXa>q;Y9s`VB zBP)qGXX4;7fA`Sfz+k)40NHM${tn!x=a9`WG1&b9ZpT+Rf3zVK3VvYz!f`#Vc&F_| ztN&Ps=*_FpSf#k5zBH8M zVO}EZq#`5rFf!ARAy<)(gaezQE9aTO{RzFP5U^^2=IjZ5rRD|-Gxk!ShRn1hIF}NO zl(=0;Iw@yKQGa0JvgAjEJ^0IJr-$opXUXNq6 zjSZX$ponM?7#V_B4te`6a5QV-?&(C$i$drgUx!Ye3)80xxV|@`^HUidHYGH`DHQhq}WJOfVnhx(Wnddp>j(2QT=nTT1~M6}lSMkwM| zh0i^`dohYG9)#cLl^IJXOUR`8ol+-GcG*yN=X|*D>YFF={`Ea}IoLv7q|pBF8mk*c mTSGYO;(#-#9Hj>r+Y + /// Looks up a localized resource of type System.Drawing.Icon similar to (Icon). + /// + internal static System.Drawing.Icon LnkU { + get { + object obj = ResourceManager.GetObject("LnkU", resourceCulture); + return ((System.Drawing.Icon)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/ShareX.UploadersLib/Properties/Resources.resx b/ShareX.UploadersLib/Properties/Resources.resx index df4cd2c1f..44bad0af8 100644 --- a/ShareX.UploadersLib/Properties/Resources.resx +++ b/ShareX.UploadersLib/Properties/Resources.resx @@ -461,4 +461,7 @@ Created folders: ..\Favicons\hubic.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Favicons\LnkU.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/ShareX.UploadersLib/ShareX.UploadersLib.csproj b/ShareX.UploadersLib/ShareX.UploadersLib.csproj index 39bf84235..8d50483ae 100644 --- a/ShareX.UploadersLib/ShareX.UploadersLib.csproj +++ b/ShareX.UploadersLib/ShareX.UploadersLib.csproj @@ -289,6 +289,7 @@ + @@ -745,6 +746,10 @@ + + + + diff --git a/ShareX.UploadersLib/URLShorteners/LnkUURLShortener.cs b/ShareX.UploadersLib/URLShorteners/LnkUURLShortener.cs new file mode 100644 index 000000000..91a76282e --- /dev/null +++ b/ShareX.UploadersLib/URLShorteners/LnkUURLShortener.cs @@ -0,0 +1,69 @@ +#region License Information (GPL v3) + +/* + ShareX - A program that allows you to take screenshots and share any file type + Copyright © 2007-2015 ShareX Developers + + 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 2 + 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, write to the Free Software + Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + + Optionally you can also view the license at . +*/ + +#endregion License Information (GPL v3) + +using Newtonsoft.Json; +using System.Collections.Generic; + +namespace ShareX.UploadersLib.URLShorteners +{ + public sealed class LnkUURLShortener : URLShortener + { + private const string API_ENDPOINT = "https://api-ssl.bitly.com/"; + public string API_KEY { get; set; } + + public override UploadResult ShortenURL(string url) + { + UploadResult result = new UploadResult { URL = url }; + + Dictionary args = new Dictionary(); + args.Add("apikey", API_KEY); + args.Add("action" , "shorten"); + args.Add("url", url); + + string response = SendRequest(HttpMethod.GET, API_ENDPOINT, args); + + if (!string.IsNullOrEmpty(response)) + { + LnkUURLShortenerResponse jsonResponse = JsonConvert.DeserializeObject(response); + + if (jsonResponse != null) + { + result.ShortenedURL = jsonResponse.shorturl; + } + } + + return result; + } + } + + public class LnkUURLShortenerResponse + { + public string shortcode { get; set; } + public string site { get; set; } + public string shorturl { get; set; } + public string fullurl { get; set; } + public string title { get; set; } + } +} diff --git a/ShareX.UploadersLib/UploadersConfig.cs b/ShareX.UploadersLib/UploadersConfig.cs index d5c854f55..e09077373 100644 --- a/ShareX.UploadersLib/UploadersConfig.cs +++ b/ShareX.UploadersLib/UploadersConfig.cs @@ -275,6 +275,9 @@ public class UploadersConfig : SettingsBase public string AdFlyAPIKEY = String.Empty; public string AdFlyAPIUID = String.Empty; + // lnku.co + public string LnkUAPIKEY = string.Empty; + #endregion URL shorteners #region URL sharing services @@ -428,6 +431,8 @@ public bool IsValid(UrlShortenerType destination) return !string.IsNullOrEmpty(YourlsAPIURL) && (!string.IsNullOrEmpty(YourlsSignature) || (!string.IsNullOrEmpty(YourlsUsername) && !string.IsNullOrEmpty(YourlsPassword))); case UrlShortenerType.AdFly: return !string.IsNullOrEmpty(AdFlyAPIKEY) && !string.IsNullOrEmpty(AdFlyAPIUID); + case UrlShortenerType.LnkU: + return !string.IsNullOrEmpty(LnkUAPIKEY); case UrlShortenerType.CustomURLShortener: return CustomUploadersList != null && CustomUploadersList.IsValidIndex(CustomURLShortenerSelected); } diff --git a/ShareX/UploadTask.cs b/ShareX/UploadTask.cs index 0a34c6fa4..ac92f80f0 100644 --- a/ShareX/UploadTask.cs +++ b/ShareX/UploadTask.cs @@ -1075,6 +1075,12 @@ public UploadResult ShortenURL(string url) APIUID = Program.UploadersConfig.AdFlyAPIUID }; break; + case UrlShortenerType.LnkU: + urlShortener = new LnkUURLShortener + { + API_KEY = Program.UploadersConfig.LnkUAPIKEY + }; + break; case UrlShortenerType.CustomURLShortener: CustomUploaderItem customUploader = GetCustomUploader(Program.UploadersConfig.CustomURLShortenerSelected); if (customUploader != null) From a7ffeb3efa52fc16442502df0ba5cd76ad5c627d Mon Sep 17 00:00:00 2001 From: Daniel McAssey Date: Mon, 20 Jul 2015 16:35:01 +0100 Subject: [PATCH 2/4] Fix correct URL and GET argument --- .../Forms/UploadersConfigForm.resx | 240 ++++++++++++------ .../URLShorteners/LnkUURLShortener.cs | 4 +- 2 files changed, 158 insertions(+), 86 deletions(-) diff --git a/ShareX.UploadersLib/Forms/UploadersConfigForm.resx b/ShareX.UploadersLib/Forms/UploadersConfigForm.resx index 8aa65950a..5ee8a6e83 100644 --- a/ShareX.UploadersLib/Forms/UploadersConfigForm.resx +++ b/ShareX.UploadersLib/Forms/UploadersConfigForm.resx @@ -462,7 +462,7 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ Twitter - @Invariant + tpTwitter @@ -1485,7 +1485,7 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ - @Invariant + txtCustomUploaderLog @@ -1647,7 +1647,7 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ URL: - @Invariant + lblCustomUploaderURL @@ -2004,7 +2004,7 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ bit.ly - @Invariant + tpBitly @@ -2073,7 +2073,7 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ Google - @Invariant + tpGoogleURLShortener @@ -2307,7 +2307,7 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ API URL: - @Invariant + lblYourlsAPIURL @@ -2334,7 +2334,7 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ YOURLS - @Invariant + tpYourls @@ -2415,7 +2415,7 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ API UID: - @Invariant + lblAdflyAPIUID @@ -2493,7 +2493,7 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ adf.ly - @Invariant + tpAdFly @@ -2506,6 +2506,81 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ 3 + + 16, 38 + + + 224, 20 + + + 7 + + + txtLnkUAPIKEY + + + System.Windows.Forms.TextBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tpLnkU + + + 0 + + + True + + + NoControl + + + 13, 22 + + + 47, 13 + + + 6 + + + API key: + + + lblLnkUAPIKey + + + System.Windows.Forms.Label, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tpLnkU + + + 1 + + + 4, 22 + + + 972, 493 + + + 4 + + + LnkU.co + + + tpLnkU + + + System.Windows.Forms.TabPage, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tcURLShorteners + + + 4 + Fill @@ -2799,7 +2874,7 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ FTP - @Invariant + tpFTP @@ -3169,20 +3244,20 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ 8 - 4, 22 + 4, 40 3, 3, 3, 3 - 972, 493 + 972, 475 0 Dropbox - @Invariant + tpDropbox @@ -3301,20 +3376,20 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ 3 - 4, 22 + 4, 40 3, 3, 3, 3 - 972, 493 + 972, 475 17 OneDrive - @Invariant + tpOneDrive @@ -3523,20 +3598,20 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ 6 - 4, 22 + 4, 40 3, 3, 3, 3 - 972, 493 + 972, 475 1 Google Drive - @Invariant + tpGoogleDrive @@ -3718,20 +3793,20 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ 5 - 4, 22 + 4, 40 3, 3, 3, 3 - 972, 493 + 972, 475 2 Box - @Invariant + tpBox @@ -4012,20 +4087,20 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ 6 - 4, 22 + 4, 40 3, 3, 3, 3 - 972, 493 + 972, 475 0 Copy - @Invariant + tpCopy @@ -4207,20 +4282,20 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ 5 - 4, 22 + 4, 40 3, 3, 3, 3 - 972, 493 + 972, 475 19 hubiC - @Invariant + tpHubic @@ -4328,7 +4403,7 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ ... - @Invariant + btnAmazonS3BucketNameOpen @@ -4355,7 +4430,7 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ ... - @Invariant + btnAmazonS3AccessKeyOpen @@ -4624,20 +4699,20 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ 16 - 4, 22 + 4, 40 3, 3, 3, 3 - 972, 493 + 972, 475 13 Amazon S3 - @Invariant + tpAmazonS3 @@ -4945,17 +5020,17 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ 10 - 4, 22 + 4, 40 - 972, 493 + 972, 475 12 Mega - @Invariant + tpMega @@ -5263,20 +5338,20 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ 10 - 4, 22 + 4, 40 3, 3, 3, 3 - 972, 493 + 972, 475 15 ownCloud - @Invariant + tpOwnCloud @@ -5476,20 +5551,20 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ 6 - 4, 22 + 4, 40 3, 3, 3, 3 - 972, 493 + 972, 475 16 MediaFire - @Invariant + tpMediaFire @@ -5638,20 +5713,20 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ 4 - 4, 22 + 4, 40 3, 3, 3, 3 - 972, 493 + 972, 475 14 Pushbullet - @Invariant + tpPushbullet @@ -5815,20 +5890,20 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ 5 - 4, 22 + 4, 40 3, 3, 3, 3 - 972, 493 + 972, 475 6 SendSpace - @Invariant + tpSendSpace @@ -6001,20 +6076,20 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ 5 - 4, 22 + 4, 40 3, 3, 3, 3 - 972, 493 + 972, 475 7 Ge.tt - @Invariant + tpGe_tt @@ -6160,20 +6235,20 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ 4 - 4, 22 + 4, 40 3, 3, 3, 3 - 972, 493 + 972, 475 8 Hostr - @Invariant + tpHostr @@ -6610,20 +6685,20 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ 3 - 4, 22 + 4, 40 3, 3, 3, 3 - 972, 493 + 972, 475 3 Minus - @Invariant + tpMinus @@ -6647,7 +6722,7 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ PROJECT- - @Invariant + txtJiraIssuePrefix @@ -6731,7 +6806,7 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ http:// - @Invariant + txtJiraHost @@ -6820,17 +6895,17 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ 3 - 4, 22 + 4, 40 - 972, 493 + 972, 475 11 Atlassian Jira - @Invariant + tpJira @@ -6925,20 +7000,20 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ 2 - 4, 22 + 4, 40 3, 3, 3, 3 - 972, 493 + 972, 475 20 Lambda - @Invariant + tpLambda @@ -7079,7 +7154,7 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ Up1 - @Invariant + tpUp1 @@ -8171,7 +8246,7 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ Pastebin - @Invariant + tpPastebin @@ -8249,7 +8324,7 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ Paste.ee - @Invariant + tpPaste_ee @@ -8348,7 +8423,7 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ Gist - @Invariant + tpGist @@ -8456,7 +8531,7 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ uPaste - @Invariant + tpUpaste @@ -8585,7 +8660,7 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ Hastebin - @Invariant + tpHastebin @@ -8753,7 +8828,7 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ ID - @Invariant + Title @@ -8882,7 +8957,7 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ Imgur - @Invariant + tpImgur @@ -9122,7 +9197,7 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ ImageShack - @Invariant + tpImageShack @@ -9326,7 +9401,7 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ TinyPic - @Invariant + tpTinyPic @@ -9506,7 +9581,7 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ Flickr - @Invariant + tpFlickr @@ -9998,7 +10073,7 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ Photobucket - @Invariant + tpPhotobucket @@ -10064,7 +10139,7 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ ID - @Invariant + 135 @@ -10166,7 +10241,7 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ Picasa - @Invariant + tpPicasa @@ -10226,7 +10301,7 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ /api/1/upload - @Invariant + lblCheveretoWebsiteTip @@ -10355,7 +10430,7 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ Chevereto - @Invariant + tpChevereto @@ -10530,9 +10605,6 @@ For example, if your bucket is called bucket.example.com then URL will be http:/ 1000, 557 - - NoControl - 840, 572 diff --git a/ShareX.UploadersLib/URLShorteners/LnkUURLShortener.cs b/ShareX.UploadersLib/URLShorteners/LnkUURLShortener.cs index 91a76282e..f6c31124b 100644 --- a/ShareX.UploadersLib/URLShorteners/LnkUURLShortener.cs +++ b/ShareX.UploadersLib/URLShorteners/LnkUURLShortener.cs @@ -30,7 +30,7 @@ namespace ShareX.UploadersLib.URLShorteners { public sealed class LnkUURLShortener : URLShortener { - private const string API_ENDPOINT = "https://api-ssl.bitly.com/"; + private const string API_ENDPOINT = "http://lnku.co/api/go/"; public string API_KEY { get; set; } public override UploadResult ShortenURL(string url) @@ -40,7 +40,7 @@ public override UploadResult ShortenURL(string url) Dictionary args = new Dictionary(); args.Add("apikey", API_KEY); args.Add("action" , "shorten"); - args.Add("url", url); + args.Add("fullurl", url); string response = SendRequest(HttpMethod.GET, API_ENDPOINT, args); From 52db0dfcb39c3b51c18d5611d8849b0736f43c12 Mon Sep 17 00:00:00 2001 From: Daniel McAssey Date: Mon, 20 Jul 2015 16:50:37 +0100 Subject: [PATCH 3/4] Fix Form Designer --- .../Forms/UploadersConfigForm.Designer.cs | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/ShareX.UploadersLib/Forms/UploadersConfigForm.Designer.cs b/ShareX.UploadersLib/Forms/UploadersConfigForm.Designer.cs index 616b4da18..da1a58f9b 100644 --- a/ShareX.UploadersLib/Forms/UploadersConfigForm.Designer.cs +++ b/ShareX.UploadersLib/Forms/UploadersConfigForm.Designer.cs @@ -433,6 +433,9 @@ private void InitializeComponent() this.atcGoogleURLShortenerAccountType = new ShareX.UploadersLib.AccountTypeControl(); this.oauthTwitter = new ShareX.UploadersLib.OAuthControl(); this.actRapidShareAccountType = new ShareX.UploadersLib.AccountTypeControl(); + this.tpLnkU = new System.Windows.Forms.TabPage(); + this.txtLnkUAPIKEY = new System.Windows.Forms.TextBox(); + this.lblLnkUAPIKey = new System.Windows.Forms.Label(); this.tpOtherUploaders.SuspendLayout(); this.tcOtherUploaders.SuspendLayout(); this.tpTwitter.SuspendLayout(); @@ -495,6 +498,7 @@ private void InitializeComponent() this.tpPicasa.SuspendLayout(); this.tpChevereto.SuspendLayout(); this.tcUploaders.SuspendLayout(); + this.tpLnkU.SuspendLayout(); this.SuspendLayout(); // // txtRapidSharePremiumUserName @@ -1059,6 +1063,7 @@ private void InitializeComponent() this.tcURLShorteners.Controls.Add(this.tpGoogleURLShortener); this.tcURLShorteners.Controls.Add(this.tpYourls); this.tcURLShorteners.Controls.Add(this.tpAdFly); + this.tcURLShorteners.Controls.Add(this.tpLnkU); resources.ApplyResources(this.tcURLShorteners, "tcURLShorteners"); this.tcURLShorteners.Name = "tcURLShorteners"; this.tcURLShorteners.SelectedIndex = 0; @@ -3415,15 +3420,25 @@ private void InitializeComponent() this.oauth2GoogleURLShortener.CompleteButtonClicked += new ShareX.UploadersLib.OAuthControl.CompleteButtonClickedEventHandler(this.oauth2GoogleURLShortener_CompleteButtonClicked); this.oauth2GoogleURLShortener.ClearButtonClicked += new ShareX.UploadersLib.OAuthControl.ClearButtonclickedEventHandler(this.oauth2GoogleURLShortener_ClearButtonClicked); this.oauth2GoogleURLShortener.RefreshButtonClicked += new ShareX.UploadersLib.OAuthControl.RefreshButtonClickedEventHandler(this.oauth2GoogleURLShortener_RefreshButtonClicked); + // tpLnkU // // atcGoogleURLShortenerAccountType + this.tpLnkU.Controls.Add(this.txtLnkUAPIKEY); + this.tpLnkU.Controls.Add(this.lblLnkUAPIKey); + resources.ApplyResources(this.tpLnkU, "tpLnkU"); + this.tpLnkU.Name = "tpLnkU"; + this.tpLnkU.UseVisualStyleBackColor = true; // resources.ApplyResources(this.atcGoogleURLShortenerAccountType, "atcGoogleURLShortenerAccountType"); this.atcGoogleURLShortenerAccountType.Name = "atcGoogleURLShortenerAccountType"; this.atcGoogleURLShortenerAccountType.SelectedAccountType = ShareX.UploadersLib.AccountType.Anonymous; this.atcGoogleURLShortenerAccountType.AccountTypeChanged += new ShareX.UploadersLib.AccountTypeControl.AccountTypeChangedEventHandler(this.atcGoogleURLShortenerAccountType_AccountTypeChanged); + // txtLnkUAPIKEY // // oauthTwitter + resources.ApplyResources(this.txtLnkUAPIKEY, "txtLnkUAPIKEY"); + this.txtLnkUAPIKEY.Name = "txtLnkUAPIKEY"; + this.txtLnkUAPIKEY.TextChanged += new System.EventHandler(this.txtLnkUAPIKEY_TextChanged); // resources.ApplyResources(this.oauthTwitter, "oauthTwitter"); this.oauthTwitter.IsRefreshable = false; @@ -3431,12 +3446,15 @@ private void InitializeComponent() this.oauthTwitter.OpenButtonClicked += new ShareX.UploadersLib.OAuthControl.OpenButtonClickedEventHandler(this.oauthTwitter_OpenButtonClicked); this.oauthTwitter.CompleteButtonClicked += new ShareX.UploadersLib.OAuthControl.CompleteButtonClickedEventHandler(this.oauthTwitter_CompleteButtonClicked); this.oauthTwitter.ClearButtonClicked += new ShareX.UploadersLib.OAuthControl.ClearButtonclickedEventHandler(this.oauthTwitter_ClearButtonClicked); + // lblLnkUAPIKey // // actRapidShareAccountType // resources.ApplyResources(this.actRapidShareAccountType, "actRapidShareAccountType"); this.actRapidShareAccountType.Name = "actRapidShareAccountType"; this.actRapidShareAccountType.SelectedAccountType = ShareX.UploadersLib.AccountType.Anonymous; + resources.ApplyResources(this.lblLnkUAPIKey, "lblLnkUAPIKey"); + this.lblLnkUAPIKey.Name = "lblLnkUAPIKey"; // // UploadersConfigForm // @@ -3557,6 +3575,8 @@ private void InitializeComponent() this.tpChevereto.ResumeLayout(false); this.tpChevereto.PerformLayout(); this.tcUploaders.ResumeLayout(false); + this.tpLnkU.ResumeLayout(false); + this.tpLnkU.PerformLayout(); this.ResumeLayout(false); } @@ -3966,5 +3986,8 @@ private void InitializeComponent() private System.Windows.Forms.TextBox txtUp1Host; private System.Windows.Forms.Label lblUp1Key; private System.Windows.Forms.Label lblUp1Host; + private System.Windows.Forms.TabPage tpLnkU; + private System.Windows.Forms.TextBox txtLnkUAPIKEY; + private System.Windows.Forms.Label lblLnkUAPIKey; } } \ No newline at end of file From 7d245e042b32e7698f5f6c41e24ff28996251e14 Mon Sep 17 00:00:00 2001 From: Daniel McAssey Date: Mon, 20 Jul 2015 20:01:57 +0100 Subject: [PATCH 4/4] Change tabs to 4 spaces --- ShareX.UploadersLib/Enums.cs | 4 +- .../Forms/UploadersConfigForm.Designer.cs | 46 +++++++------- .../Forms/UploadersConfigForm.cs | 26 ++++---- .../URLShorteners/LnkUURLShortener.cs | 62 +++++++++---------- ShareX.UploadersLib/UploadersConfig.cs | 8 +-- ShareX/UploadTask.cs | 12 ++-- 6 files changed, 79 insertions(+), 79 deletions(-) diff --git a/ShareX.UploadersLib/Enums.cs b/ShareX.UploadersLib/Enums.cs index 1da253f40..43c861e85 100644 --- a/ShareX.UploadersLib/Enums.cs +++ b/ShareX.UploadersLib/Enums.cs @@ -154,8 +154,8 @@ public enum UrlShortenerType NLCM, [Description("adf.ly")] AdFly, - [Description("lnku.co")] - LnkU, + [Description("lnku.co")] + LnkU, CustomURLShortener // Localized } diff --git a/ShareX.UploadersLib/Forms/UploadersConfigForm.Designer.cs b/ShareX.UploadersLib/Forms/UploadersConfigForm.Designer.cs index da1a58f9b..9564856e7 100644 --- a/ShareX.UploadersLib/Forms/UploadersConfigForm.Designer.cs +++ b/ShareX.UploadersLib/Forms/UploadersConfigForm.Designer.cs @@ -433,9 +433,9 @@ private void InitializeComponent() this.atcGoogleURLShortenerAccountType = new ShareX.UploadersLib.AccountTypeControl(); this.oauthTwitter = new ShareX.UploadersLib.OAuthControl(); this.actRapidShareAccountType = new ShareX.UploadersLib.AccountTypeControl(); - this.tpLnkU = new System.Windows.Forms.TabPage(); - this.txtLnkUAPIKEY = new System.Windows.Forms.TextBox(); - this.lblLnkUAPIKey = new System.Windows.Forms.Label(); + this.tpLnkU = new System.Windows.Forms.TabPage(); + this.txtLnkUAPIKEY = new System.Windows.Forms.TextBox(); + this.lblLnkUAPIKey = new System.Windows.Forms.Label(); this.tpOtherUploaders.SuspendLayout(); this.tcOtherUploaders.SuspendLayout(); this.tpTwitter.SuspendLayout(); @@ -498,7 +498,7 @@ private void InitializeComponent() this.tpPicasa.SuspendLayout(); this.tpChevereto.SuspendLayout(); this.tcUploaders.SuspendLayout(); - this.tpLnkU.SuspendLayout(); + this.tpLnkU.SuspendLayout(); this.SuspendLayout(); // // txtRapidSharePremiumUserName @@ -3420,25 +3420,25 @@ private void InitializeComponent() this.oauth2GoogleURLShortener.CompleteButtonClicked += new ShareX.UploadersLib.OAuthControl.CompleteButtonClickedEventHandler(this.oauth2GoogleURLShortener_CompleteButtonClicked); this.oauth2GoogleURLShortener.ClearButtonClicked += new ShareX.UploadersLib.OAuthControl.ClearButtonclickedEventHandler(this.oauth2GoogleURLShortener_ClearButtonClicked); this.oauth2GoogleURLShortener.RefreshButtonClicked += new ShareX.UploadersLib.OAuthControl.RefreshButtonClickedEventHandler(this.oauth2GoogleURLShortener_RefreshButtonClicked); - // tpLnkU + // tpLnkU // // atcGoogleURLShortenerAccountType - this.tpLnkU.Controls.Add(this.txtLnkUAPIKEY); - this.tpLnkU.Controls.Add(this.lblLnkUAPIKey); - resources.ApplyResources(this.tpLnkU, "tpLnkU"); - this.tpLnkU.Name = "tpLnkU"; - this.tpLnkU.UseVisualStyleBackColor = true; + this.tpLnkU.Controls.Add(this.txtLnkUAPIKEY); + this.tpLnkU.Controls.Add(this.lblLnkUAPIKey); + resources.ApplyResources(this.tpLnkU, "tpLnkU"); + this.tpLnkU.Name = "tpLnkU"; + this.tpLnkU.UseVisualStyleBackColor = true; // resources.ApplyResources(this.atcGoogleURLShortenerAccountType, "atcGoogleURLShortenerAccountType"); this.atcGoogleURLShortenerAccountType.Name = "atcGoogleURLShortenerAccountType"; this.atcGoogleURLShortenerAccountType.SelectedAccountType = ShareX.UploadersLib.AccountType.Anonymous; this.atcGoogleURLShortenerAccountType.AccountTypeChanged += new ShareX.UploadersLib.AccountTypeControl.AccountTypeChangedEventHandler(this.atcGoogleURLShortenerAccountType_AccountTypeChanged); - // txtLnkUAPIKEY + // txtLnkUAPIKEY // // oauthTwitter - resources.ApplyResources(this.txtLnkUAPIKEY, "txtLnkUAPIKEY"); - this.txtLnkUAPIKEY.Name = "txtLnkUAPIKEY"; - this.txtLnkUAPIKEY.TextChanged += new System.EventHandler(this.txtLnkUAPIKEY_TextChanged); + resources.ApplyResources(this.txtLnkUAPIKEY, "txtLnkUAPIKEY"); + this.txtLnkUAPIKEY.Name = "txtLnkUAPIKEY"; + this.txtLnkUAPIKEY.TextChanged += new System.EventHandler(this.txtLnkUAPIKEY_TextChanged); // resources.ApplyResources(this.oauthTwitter, "oauthTwitter"); this.oauthTwitter.IsRefreshable = false; @@ -3446,15 +3446,15 @@ private void InitializeComponent() this.oauthTwitter.OpenButtonClicked += new ShareX.UploadersLib.OAuthControl.OpenButtonClickedEventHandler(this.oauthTwitter_OpenButtonClicked); this.oauthTwitter.CompleteButtonClicked += new ShareX.UploadersLib.OAuthControl.CompleteButtonClickedEventHandler(this.oauthTwitter_CompleteButtonClicked); this.oauthTwitter.ClearButtonClicked += new ShareX.UploadersLib.OAuthControl.ClearButtonclickedEventHandler(this.oauthTwitter_ClearButtonClicked); - // lblLnkUAPIKey + // lblLnkUAPIKey // // actRapidShareAccountType // resources.ApplyResources(this.actRapidShareAccountType, "actRapidShareAccountType"); this.actRapidShareAccountType.Name = "actRapidShareAccountType"; this.actRapidShareAccountType.SelectedAccountType = ShareX.UploadersLib.AccountType.Anonymous; - resources.ApplyResources(this.lblLnkUAPIKey, "lblLnkUAPIKey"); - this.lblLnkUAPIKey.Name = "lblLnkUAPIKey"; + resources.ApplyResources(this.lblLnkUAPIKey, "lblLnkUAPIKey"); + this.lblLnkUAPIKey.Name = "lblLnkUAPIKey"; // // UploadersConfigForm // @@ -3575,8 +3575,8 @@ private void InitializeComponent() this.tpChevereto.ResumeLayout(false); this.tpChevereto.PerformLayout(); this.tcUploaders.ResumeLayout(false); - this.tpLnkU.ResumeLayout(false); - this.tpLnkU.PerformLayout(); + this.tpLnkU.ResumeLayout(false); + this.tpLnkU.PerformLayout(); this.ResumeLayout(false); } @@ -3985,9 +3985,9 @@ private void InitializeComponent() private System.Windows.Forms.TextBox txtUp1Key; private System.Windows.Forms.TextBox txtUp1Host; private System.Windows.Forms.Label lblUp1Key; - private System.Windows.Forms.Label lblUp1Host; - private System.Windows.Forms.TabPage tpLnkU; - private System.Windows.Forms.TextBox txtLnkUAPIKEY; - private System.Windows.Forms.Label lblLnkUAPIKey; + private System.Windows.Forms.Label lblUp1Host; + private System.Windows.Forms.TabPage tpLnkU; + private System.Windows.Forms.TextBox txtLnkUAPIKEY; + private System.Windows.Forms.Label lblLnkUAPIKey; } } \ No newline at end of file diff --git a/ShareX.UploadersLib/Forms/UploadersConfigForm.cs b/ShareX.UploadersLib/Forms/UploadersConfigForm.cs index 34a5cb422..9af85f195 100644 --- a/ShareX.UploadersLib/Forms/UploadersConfigForm.cs +++ b/ShareX.UploadersLib/Forms/UploadersConfigForm.cs @@ -95,7 +95,7 @@ private void FormSettings() AddIconToTab(tpImageShack, Resources.ImageShack); AddIconToTab(tpImgur, Resources.Imgur); AddIconToTab(tpJira, Resources.jira); - AddIconToTab(tpLnkU, Resources.LnkU); + AddIconToTab(tpLnkU, Resources.LnkU); AddIconToTab(tpMediaFire, Resources.MediaFire); AddIconToTab(tpMega, Resources.Mega); AddIconToTab(tpMinus, Resources.Minus); @@ -583,9 +583,9 @@ public void LoadSettings(UploadersConfig uploadersConfig) txtAdflyAPIKEY.Text = Config.AdFlyAPIKEY; txtAdflyAPIUID.Text = Config.AdFlyAPIUID; - // lnku.co + // lnku.co - txtLnkUAPIKEY.Text = Config.LnkUAPIKEY; + txtLnkUAPIKEY.Text = Config.LnkUAPIKEY; #endregion URL Shorteners @@ -2138,21 +2138,21 @@ private void llAdflyLink_LinkClicked(object sender, LinkLabelLinkClickedEventArg #endregion adf.ly - #region LnkU.co + #region LnkU.co - private void txtLnkUAPIKEY_TextChanged(object sender, EventArgs e) - { - Config.LnkUAPIKEY = txtLnkUAPIKEY.Text; - } - #endregion + private void txtLnkUAPIKEY_TextChanged(object sender, EventArgs e) + { + Config.LnkUAPIKEY = txtLnkUAPIKEY.Text; + } + #endregion - #endregion URL Shorteners + #endregion URL Shorteners - #region Other Uploaders + #region Other Uploaders - #region Twitter + #region Twitter - private void btnTwitterAdd_Click(object sender, EventArgs e) + private void btnTwitterAdd_Click(object sender, EventArgs e) { OAuthInfo oauth = new OAuthInfo(); Config.TwitterOAuthInfoList.Add(oauth); diff --git a/ShareX.UploadersLib/URLShorteners/LnkUURLShortener.cs b/ShareX.UploadersLib/URLShorteners/LnkUURLShortener.cs index f6c31124b..36daf4c53 100644 --- a/ShareX.UploadersLib/URLShorteners/LnkUURLShortener.cs +++ b/ShareX.UploadersLib/URLShorteners/LnkUURLShortener.cs @@ -28,42 +28,42 @@ namespace ShareX.UploadersLib.URLShorteners { - public sealed class LnkUURLShortener : URLShortener - { - private const string API_ENDPOINT = "http://lnku.co/api/go/"; - public string API_KEY { get; set; } + public sealed class LnkUURLShortener : URLShortener + { + private const string API_ENDPOINT = "http://lnku.co/api/go/"; + public string API_KEY { get; set; } - public override UploadResult ShortenURL(string url) - { - UploadResult result = new UploadResult { URL = url }; + public override UploadResult ShortenURL(string url) + { + UploadResult result = new UploadResult { URL = url }; - Dictionary args = new Dictionary(); - args.Add("apikey", API_KEY); - args.Add("action" , "shorten"); - args.Add("fullurl", url); + Dictionary args = new Dictionary(); + args.Add("apikey", API_KEY); + args.Add("action", "shorten"); + args.Add("fullurl", url); - string response = SendRequest(HttpMethod.GET, API_ENDPOINT, args); + string response = SendRequest(HttpMethod.GET, API_ENDPOINT, args); - if (!string.IsNullOrEmpty(response)) - { - LnkUURLShortenerResponse jsonResponse = JsonConvert.DeserializeObject(response); + if (!string.IsNullOrEmpty(response)) + { + LnkUURLShortenerResponse jsonResponse = JsonConvert.DeserializeObject(response); - if (jsonResponse != null) - { - result.ShortenedURL = jsonResponse.shorturl; - } - } + if (jsonResponse != null) + { + result.ShortenedURL = jsonResponse.shorturl; + } + } - return result; - } - } + return result; + } + } - public class LnkUURLShortenerResponse - { - public string shortcode { get; set; } - public string site { get; set; } - public string shorturl { get; set; } - public string fullurl { get; set; } - public string title { get; set; } - } + public class LnkUURLShortenerResponse + { + public string shortcode { get; set; } + public string site { get; set; } + public string shorturl { get; set; } + public string fullurl { get; set; } + public string title { get; set; } + } } diff --git a/ShareX.UploadersLib/UploadersConfig.cs b/ShareX.UploadersLib/UploadersConfig.cs index e09077373..c6d486178 100644 --- a/ShareX.UploadersLib/UploadersConfig.cs +++ b/ShareX.UploadersLib/UploadersConfig.cs @@ -275,8 +275,8 @@ public class UploadersConfig : SettingsBase public string AdFlyAPIKEY = String.Empty; public string AdFlyAPIUID = String.Empty; - // lnku.co - public string LnkUAPIKEY = string.Empty; + // lnku.co + public string LnkUAPIKEY = string.Empty; #endregion URL shorteners @@ -431,8 +431,8 @@ public bool IsValid(UrlShortenerType destination) return !string.IsNullOrEmpty(YourlsAPIURL) && (!string.IsNullOrEmpty(YourlsSignature) || (!string.IsNullOrEmpty(YourlsUsername) && !string.IsNullOrEmpty(YourlsPassword))); case UrlShortenerType.AdFly: return !string.IsNullOrEmpty(AdFlyAPIKEY) && !string.IsNullOrEmpty(AdFlyAPIUID); - case UrlShortenerType.LnkU: - return !string.IsNullOrEmpty(LnkUAPIKEY); + case UrlShortenerType.LnkU: + return !string.IsNullOrEmpty(LnkUAPIKEY); case UrlShortenerType.CustomURLShortener: return CustomUploadersList != null && CustomUploadersList.IsValidIndex(CustomURLShortenerSelected); } diff --git a/ShareX/UploadTask.cs b/ShareX/UploadTask.cs index ac92f80f0..ac62f6572 100644 --- a/ShareX/UploadTask.cs +++ b/ShareX/UploadTask.cs @@ -1075,12 +1075,12 @@ public UploadResult ShortenURL(string url) APIUID = Program.UploadersConfig.AdFlyAPIUID }; break; - case UrlShortenerType.LnkU: - urlShortener = new LnkUURLShortener - { - API_KEY = Program.UploadersConfig.LnkUAPIKEY - }; - break; + case UrlShortenerType.LnkU: + urlShortener = new LnkUURLShortener + { + API_KEY = Program.UploadersConfig.LnkUAPIKEY + }; + break; case UrlShortenerType.CustomURLShortener: CustomUploaderItem customUploader = GetCustomUploader(Program.UploadersConfig.CustomURLShortenerSelected); if (customUploader != null)