From bbfc9b70172b8c72b36e7c963a49282d54326452 Mon Sep 17 00:00:00 2001 From: mcored Date: Sun, 19 Jan 2014 12:27:27 +0800 Subject: [PATCH] Automatic URL shortening support Automatic URL shortening support if the URL longer than a specified length. --- ShareX/Properties/AssemblyInfo.cs | 4 ++-- ShareX/TaskSettings.cs | 9 ++++++--- ShareX/UploadTask.cs | 3 ++- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/ShareX/Properties/AssemblyInfo.cs b/ShareX/Properties/AssemblyInfo.cs index 356c4dfbd..7ab11788b 100644 --- a/ShareX/Properties/AssemblyInfo.cs +++ b/ShareX/Properties/AssemblyInfo.cs @@ -11,5 +11,5 @@ [assembly: AssemblyCulture("")] [assembly: ComVisible(false)] [assembly: Guid("82E6AC09-0FEF-4390-AD9F-0DD3F5561EFC")] -[assembly: AssemblyVersion("8.5.0")] -[assembly: AssemblyFileVersion("8.5.0")] \ No newline at end of file +[assembly: AssemblyVersion("8.5.1")] +[assembly: AssemblyFileVersion("8.5.1")] \ No newline at end of file diff --git a/ShareX/TaskSettings.cs b/ShareX/TaskSettings.cs index 7fcde711c..13a69715d 100644 --- a/ShareX/TaskSettings.cs +++ b/ShareX/TaskSettings.cs @@ -302,9 +302,12 @@ public class TaskSettingsAdvanced [Category("After upload"), DefaultValue(""), Description("Balloon tip content format after uploading. Supported variables: $result, $url, $shorturl, $thumbnailurl, $deletionurl, $filepath, $filename, $filenamenoext, $folderpath, $foldername, $uploadtime and other variables such as %y-%mo-%d etc.")] public string BalloonTipContentFormat { get; set; } + [Category("After upload / Automatic URL Shortener"), DefaultValue(0), Description("Automatically shorten URL if the URL is longer than the specified number of characters. 0 means automatic URL shortening is not active.")] + public int AutoShortenURLLength { get; set; } + private float toastWindowDuration; - [Category("After upload"), DefaultValue(4f), Description("Specify how long should toast notification window will stay on screen (in seconds).")] + [Category("After upload / Notifications"), DefaultValue(4f), Description("Specify how long should toast notification window will stay on screen (in seconds).")] public float ToastWindowDuration { get @@ -317,12 +320,12 @@ public float ToastWindowDuration } } - [Category("After upload"), DefaultValue(ContentAlignment.BottomRight), Description("Specify where should toast notification window appear on the screen.")] + [Category("After upload / Notifications"), DefaultValue(ContentAlignment.BottomRight), Description("Specify where should toast notification window appear on the screen.")] public ContentAlignment ToastWindowPlacement { get; set; } private Size toastWindowSize; - [Category("After upload"), DefaultValue(typeof(Size), "400, 300"), Description("Maximum toast notification window size.")] + [Category("After upload / Notifications"), DefaultValue(typeof(Size), "400, 300"), Description("Maximum toast notification window size.")] public Size ToastWindowSize { get diff --git a/ShareX/UploadTask.cs b/ShareX/UploadTask.cs index 6e18cfb7f..b23450c93 100644 --- a/ShareX/UploadTask.cs +++ b/ShareX/UploadTask.cs @@ -466,7 +466,8 @@ private void DoAfterUploadJobs() { try { - if (Info.TaskSettings.AfterUploadJob.HasFlag(AfterUploadTasks.UseURLShortener) || Info.Job == TaskJob.ShortenURL) + if (Info.TaskSettings.AfterUploadJob.HasFlag(AfterUploadTasks.UseURLShortener) || Info.Job == TaskJob.ShortenURL || + (Info.TaskSettings.AdvancedSettings.AutoShortenURLLength > 0 && Info.Result.URL.Length > Info.TaskSettings.AdvancedSettings.AutoShortenURLLength)) { UploadResult result = ShortenURL(Info.Result.URL);