mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-29 17:02:05 +13:00
Added Share URL task support, clipboard upload can use sharing automatically
This commit is contained in:
parent
2dc782c990
commit
b50a7cddf8
8 changed files with 136 additions and 82 deletions
|
@ -255,9 +255,9 @@ private void UpdatePictureBox()
|
|||
|
||||
private void HistoryForm_Shown(object sender, EventArgs e)
|
||||
{
|
||||
Application.DoEvents();
|
||||
this.ShowActivate();
|
||||
Refresh();
|
||||
RefreshHistoryItems();
|
||||
this.ShowActivate();
|
||||
}
|
||||
|
||||
private void HistoryForm_KeyDown(object sender, KeyEventArgs e)
|
||||
|
|
|
@ -48,7 +48,8 @@ public enum TaskJob
|
|||
DataUpload,
|
||||
FileUpload,
|
||||
TextUpload,
|
||||
ShortenURL
|
||||
ShortenURL,
|
||||
ShareURL
|
||||
}
|
||||
|
||||
[Flags]
|
||||
|
|
86
ShareX/Forms/TaskSettingsForm.Designer.cs
generated
86
ShareX/Forms/TaskSettingsForm.Designer.cs
generated
|
@ -111,6 +111,7 @@ private void InitializeComponent()
|
|||
this.tpCaptureShape = new System.Windows.Forms.TabPage();
|
||||
this.pgShapesCapture = new System.Windows.Forms.PropertyGrid();
|
||||
this.tpScreenRecorder = new System.Windows.Forms.TabPage();
|
||||
this.cbScreenRecordAutoDisableAero = new System.Windows.Forms.CheckBox();
|
||||
this.lblScreenRecorderFixedDuration = new System.Windows.Forms.Label();
|
||||
this.nudScreenRecordFPS = new System.Windows.Forms.NumericUpDown();
|
||||
this.lblScreenRecordFPS = new System.Windows.Forms.Label();
|
||||
|
@ -157,9 +158,9 @@ private void InitializeComponent()
|
|||
this.lblNameFormatPatternPreview = new System.Windows.Forms.Label();
|
||||
this.lblNameFormatPatternPreviewActiveWindow = new System.Windows.Forms.Label();
|
||||
this.tpUploadClipboard = new System.Windows.Forms.TabPage();
|
||||
this.chkClipboardUploadContents = new System.Windows.Forms.CheckBox();
|
||||
this.chkClipboardUploadURLContents = new System.Windows.Forms.CheckBox();
|
||||
this.cbClipboardUploadAutoIndexFolder = new System.Windows.Forms.CheckBox();
|
||||
this.cbClipboardUploadAutoDetectURL = new System.Windows.Forms.CheckBox();
|
||||
this.cbClipboardUploadShortenURL = new System.Windows.Forms.CheckBox();
|
||||
this.chkUseDefaultUploadSettings = new System.Windows.Forms.CheckBox();
|
||||
this.tpIndexer = new System.Windows.Forms.TabPage();
|
||||
this.pgIndexerConfig = new System.Windows.Forms.PropertyGrid();
|
||||
|
@ -167,7 +168,7 @@ private void InitializeComponent()
|
|||
this.tpAdvanced = new System.Windows.Forms.TabPage();
|
||||
this.pgTaskSettings = new System.Windows.Forms.PropertyGrid();
|
||||
this.chkUseDefaultAdvancedSettings = new System.Windows.Forms.CheckBox();
|
||||
this.cbScreenRecordAutoDisableAero = new System.Windows.Forms.CheckBox();
|
||||
this.cbClipboardUploadShareURL = new System.Windows.Forms.CheckBox();
|
||||
this.tcHotkeySettings.SuspendLayout();
|
||||
this.tpTask.SuspendLayout();
|
||||
this.cmsDestinations.SuspendLayout();
|
||||
|
@ -1161,6 +1162,18 @@ private void InitializeComponent()
|
|||
this.tpScreenRecorder.Text = "Screen recorder";
|
||||
this.tpScreenRecorder.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// cbScreenRecordAutoDisableAero
|
||||
//
|
||||
this.cbScreenRecordAutoDisableAero.AutoSize = true;
|
||||
this.cbScreenRecordAutoDisableAero.Location = new System.Drawing.Point(18, 160);
|
||||
this.cbScreenRecordAutoDisableAero.Name = "cbScreenRecordAutoDisableAero";
|
||||
this.cbScreenRecordAutoDisableAero.Size = new System.Drawing.Size(465, 17);
|
||||
this.cbScreenRecordAutoDisableAero.TabIndex = 15;
|
||||
this.cbScreenRecordAutoDisableAero.Text = "Automatically disable Windows Aero while recording (Aero decreasing recording per" +
|
||||
"formance)";
|
||||
this.cbScreenRecordAutoDisableAero.UseVisualStyleBackColor = true;
|
||||
this.cbScreenRecordAutoDisableAero.CheckedChanged += new System.EventHandler(this.cbScreenRecordAutoDisableAero_CheckedChanged);
|
||||
//
|
||||
// lblScreenRecorderFixedDuration
|
||||
//
|
||||
this.lblScreenRecorderFixedDuration.AutoSize = true;
|
||||
|
@ -1683,9 +1696,10 @@ private void InitializeComponent()
|
|||
//
|
||||
// tpUploadClipboard
|
||||
//
|
||||
this.tpUploadClipboard.Controls.Add(this.chkClipboardUploadContents);
|
||||
this.tpUploadClipboard.Controls.Add(this.cbClipboardUploadShareURL);
|
||||
this.tpUploadClipboard.Controls.Add(this.chkClipboardUploadURLContents);
|
||||
this.tpUploadClipboard.Controls.Add(this.cbClipboardUploadAutoIndexFolder);
|
||||
this.tpUploadClipboard.Controls.Add(this.cbClipboardUploadAutoDetectURL);
|
||||
this.tpUploadClipboard.Controls.Add(this.cbClipboardUploadShortenURL);
|
||||
this.tpUploadClipboard.Location = new System.Drawing.Point(4, 22);
|
||||
this.tpUploadClipboard.Name = "tpUploadClipboard";
|
||||
this.tpUploadClipboard.Padding = new System.Windows.Forms.Padding(3);
|
||||
|
@ -1694,21 +1708,21 @@ private void InitializeComponent()
|
|||
this.tpUploadClipboard.Text = "Clipboard upload";
|
||||
this.tpUploadClipboard.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// chkClipboardUploadContents
|
||||
// chkClipboardUploadURLContents
|
||||
//
|
||||
this.chkClipboardUploadContents.AutoSize = true;
|
||||
this.chkClipboardUploadContents.Location = new System.Drawing.Point(16, 16);
|
||||
this.chkClipboardUploadContents.Name = "chkClipboardUploadContents";
|
||||
this.chkClipboardUploadContents.Size = new System.Drawing.Size(308, 17);
|
||||
this.chkClipboardUploadContents.TabIndex = 0;
|
||||
this.chkClipboardUploadContents.Text = "If clipboard contains a file URL then download it and upload";
|
||||
this.chkClipboardUploadContents.UseVisualStyleBackColor = true;
|
||||
this.chkClipboardUploadContents.CheckedChanged += new System.EventHandler(this.chkClipboardUploadContents_CheckedChanged);
|
||||
this.chkClipboardUploadURLContents.AutoSize = true;
|
||||
this.chkClipboardUploadURLContents.Location = new System.Drawing.Point(16, 16);
|
||||
this.chkClipboardUploadURLContents.Name = "chkClipboardUploadURLContents";
|
||||
this.chkClipboardUploadURLContents.Size = new System.Drawing.Size(308, 17);
|
||||
this.chkClipboardUploadURLContents.TabIndex = 0;
|
||||
this.chkClipboardUploadURLContents.Text = "If clipboard contains a file URL then download it and upload";
|
||||
this.chkClipboardUploadURLContents.UseVisualStyleBackColor = true;
|
||||
this.chkClipboardUploadURLContents.CheckedChanged += new System.EventHandler(this.chkClipboardUploadContents_CheckedChanged);
|
||||
//
|
||||
// cbClipboardUploadAutoIndexFolder
|
||||
//
|
||||
this.cbClipboardUploadAutoIndexFolder.AutoSize = true;
|
||||
this.cbClipboardUploadAutoIndexFolder.Location = new System.Drawing.Point(16, 64);
|
||||
this.cbClipboardUploadAutoIndexFolder.Location = new System.Drawing.Point(16, 88);
|
||||
this.cbClipboardUploadAutoIndexFolder.Name = "cbClipboardUploadAutoIndexFolder";
|
||||
this.cbClipboardUploadAutoIndexFolder.Size = new System.Drawing.Size(387, 17);
|
||||
this.cbClipboardUploadAutoIndexFolder.TabIndex = 2;
|
||||
|
@ -1716,16 +1730,16 @@ private void InitializeComponent()
|
|||
this.cbClipboardUploadAutoIndexFolder.UseVisualStyleBackColor = true;
|
||||
this.cbClipboardUploadAutoIndexFolder.CheckedChanged += new System.EventHandler(this.cbClipboardUploadAutoIndexFolder_CheckedChanged);
|
||||
//
|
||||
// cbClipboardUploadAutoDetectURL
|
||||
// cbClipboardUploadShortenURL
|
||||
//
|
||||
this.cbClipboardUploadAutoDetectURL.AutoSize = true;
|
||||
this.cbClipboardUploadAutoDetectURL.Location = new System.Drawing.Point(16, 40);
|
||||
this.cbClipboardUploadAutoDetectURL.Name = "cbClipboardUploadAutoDetectURL";
|
||||
this.cbClipboardUploadAutoDetectURL.Size = new System.Drawing.Size(271, 17);
|
||||
this.cbClipboardUploadAutoDetectURL.TabIndex = 1;
|
||||
this.cbClipboardUploadAutoDetectURL.Text = "If clipboard contains a URL then use URL shortener";
|
||||
this.cbClipboardUploadAutoDetectURL.UseVisualStyleBackColor = true;
|
||||
this.cbClipboardUploadAutoDetectURL.CheckedChanged += new System.EventHandler(this.cbClipboardUploadAutoDetectURL_CheckedChanged);
|
||||
this.cbClipboardUploadShortenURL.AutoSize = true;
|
||||
this.cbClipboardUploadShortenURL.Location = new System.Drawing.Point(16, 40);
|
||||
this.cbClipboardUploadShortenURL.Name = "cbClipboardUploadShortenURL";
|
||||
this.cbClipboardUploadShortenURL.Size = new System.Drawing.Size(271, 17);
|
||||
this.cbClipboardUploadShortenURL.TabIndex = 1;
|
||||
this.cbClipboardUploadShortenURL.Text = "If clipboard contains a URL then use URL shortener";
|
||||
this.cbClipboardUploadShortenURL.UseVisualStyleBackColor = true;
|
||||
this.cbClipboardUploadShortenURL.CheckedChanged += new System.EventHandler(this.cbClipboardUploadAutoDetectURL_CheckedChanged);
|
||||
//
|
||||
// chkUseDefaultUploadSettings
|
||||
//
|
||||
|
@ -1816,17 +1830,16 @@ private void InitializeComponent()
|
|||
this.chkUseDefaultAdvancedSettings.UseVisualStyleBackColor = true;
|
||||
this.chkUseDefaultAdvancedSettings.CheckedChanged += new System.EventHandler(this.chkUseDefaultAdvancedSettings_CheckedChanged);
|
||||
//
|
||||
// cbScreenRecordAutoDisableAero
|
||||
// cbClipboardUploadShareURL
|
||||
//
|
||||
this.cbScreenRecordAutoDisableAero.AutoSize = true;
|
||||
this.cbScreenRecordAutoDisableAero.Location = new System.Drawing.Point(18, 160);
|
||||
this.cbScreenRecordAutoDisableAero.Name = "cbScreenRecordAutoDisableAero";
|
||||
this.cbScreenRecordAutoDisableAero.Size = new System.Drawing.Size(465, 17);
|
||||
this.cbScreenRecordAutoDisableAero.TabIndex = 15;
|
||||
this.cbScreenRecordAutoDisableAero.Text = "Automatically disable Windows Aero while recording (Aero decreasing recording per" +
|
||||
"formance)";
|
||||
this.cbScreenRecordAutoDisableAero.UseVisualStyleBackColor = true;
|
||||
this.cbScreenRecordAutoDisableAero.CheckedChanged += new System.EventHandler(this.cbScreenRecordAutoDisableAero_CheckedChanged);
|
||||
this.cbClipboardUploadShareURL.AutoSize = true;
|
||||
this.cbClipboardUploadShareURL.Location = new System.Drawing.Point(16, 64);
|
||||
this.cbClipboardUploadShareURL.Name = "cbClipboardUploadShareURL";
|
||||
this.cbClipboardUploadShareURL.Size = new System.Drawing.Size(366, 17);
|
||||
this.cbClipboardUploadShareURL.TabIndex = 3;
|
||||
this.cbClipboardUploadShareURL.Text = "If clipboard contains a URL then share it using social networking service";
|
||||
this.cbClipboardUploadShareURL.UseVisualStyleBackColor = true;
|
||||
this.cbClipboardUploadShareURL.CheckedChanged += new System.EventHandler(this.cbClipboardUploadShareURL_CheckedChanged);
|
||||
//
|
||||
// TaskSettingsForm
|
||||
//
|
||||
|
@ -1965,7 +1978,7 @@ private void InitializeComponent()
|
|||
private System.Windows.Forms.Label lblNameFormatPatternPreview;
|
||||
private System.Windows.Forms.Label lblNameFormatPatternPreviewActiveWindow;
|
||||
private System.Windows.Forms.TabPage tpUploadClipboard;
|
||||
private System.Windows.Forms.CheckBox cbClipboardUploadAutoDetectURL;
|
||||
private System.Windows.Forms.CheckBox cbClipboardUploadShortenURL;
|
||||
private System.Windows.Forms.TabPage tpAdvanced;
|
||||
private System.Windows.Forms.PropertyGrid pgTaskSettings;
|
||||
private System.Windows.Forms.CheckBox chkUseDefaultImageSettings;
|
||||
|
@ -2032,13 +2045,14 @@ private void InitializeComponent()
|
|||
private System.Windows.Forms.CheckBox cbClipboardUploadAutoIndexFolder;
|
||||
private System.Windows.Forms.Button btnScreenRecorderOptions;
|
||||
private System.Windows.Forms.CheckBox chkRunScreencastCLI;
|
||||
private System.Windows.Forms.CheckBox chkClipboardUploadContents;
|
||||
private System.Windows.Forms.CheckBox chkClipboardUploadURLContents;
|
||||
private System.Windows.Forms.NumericUpDown nudScreenRecordFPS;
|
||||
private System.Windows.Forms.Label lblScreenRecordFPS;
|
||||
private System.Windows.Forms.CheckBox chkShowBeforeUploadForm;
|
||||
private System.Windows.Forms.Label lblScreenRecorderFixedDuration;
|
||||
private System.Windows.Forms.Button btnDescriptionAutoFill;
|
||||
private System.Windows.Forms.CheckBox cbScreenRecordAutoDisableAero;
|
||||
private System.Windows.Forms.CheckBox cbClipboardUploadShareURL;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -199,8 +199,9 @@ public TaskSettingsForm(TaskSettings hotkeySetting, bool isDefault = false)
|
|||
cbFileUploadUseNamePattern.Checked = TaskSettings.UploadSettings.FileUploadUseNamePattern;
|
||||
|
||||
// Upload / Clipboard upload
|
||||
chkClipboardUploadContents.Checked = TaskSettings.UploadSettings.ClipboardUploadURLContents;
|
||||
cbClipboardUploadAutoDetectURL.Checked = TaskSettings.UploadSettings.ClipboardUploadShortenURL;
|
||||
chkClipboardUploadURLContents.Checked = TaskSettings.UploadSettings.ClipboardUploadURLContents;
|
||||
cbClipboardUploadShortenURL.Checked = TaskSettings.UploadSettings.ClipboardUploadShortenURL;
|
||||
cbClipboardUploadShareURL.Checked = TaskSettings.UploadSettings.ClipboardUploadShareURL;
|
||||
cbClipboardUploadAutoIndexFolder.Checked = TaskSettings.UploadSettings.ClipboardUploadAutoIndexFolder;
|
||||
|
||||
// Indexer
|
||||
|
@ -957,12 +958,17 @@ private void txtNameFormatPattern_TextChanged(object sender, EventArgs e)
|
|||
|
||||
private void chkClipboardUploadContents_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
TaskSettings.UploadSettings.ClipboardUploadURLContents = chkClipboardUploadContents.Checked;
|
||||
TaskSettings.UploadSettings.ClipboardUploadURLContents = chkClipboardUploadURLContents.Checked;
|
||||
}
|
||||
|
||||
private void cbClipboardUploadAutoDetectURL_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
TaskSettings.UploadSettings.ClipboardUploadShortenURL = cbClipboardUploadAutoDetectURL.Checked;
|
||||
TaskSettings.UploadSettings.ClipboardUploadShortenURL = cbClipboardUploadShortenURL.Checked;
|
||||
}
|
||||
|
||||
private void cbClipboardUploadShareURL_CheckedChanged(object sender, EventArgs e)
|
||||
{
|
||||
TaskSettings.UploadSettings.ClipboardUploadShareURL = cbClipboardUploadShareURL.Checked;
|
||||
}
|
||||
|
||||
private void cbClipboardUploadAutoIndexFolder_CheckedChanged(object sender, EventArgs e)
|
||||
|
|
|
@ -106,6 +106,11 @@ public string UploaderHost
|
|||
return TaskSettings.FileDestination.GetDescription();
|
||||
}
|
||||
case EDataType.URL:
|
||||
if (Job == TaskJob.ShareURL)
|
||||
{
|
||||
return TaskSettings.SocialNetworkingServiceDestination.GetDescription();
|
||||
}
|
||||
|
||||
return TaskSettings.URLShortenerDestination.GetDescription();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -325,6 +325,7 @@ public class TaskSettingsUpload
|
|||
|
||||
public bool ClipboardUploadURLContents = false;
|
||||
public bool ClipboardUploadShortenURL = false;
|
||||
public bool ClipboardUploadShareURL = false;
|
||||
public bool ClipboardUploadAutoIndexFolder = false;
|
||||
|
||||
#endregion Upload / Clipboard upload
|
||||
|
|
|
@ -192,6 +192,12 @@ public static void ClipboardUpload(TaskSettings taskSettings = null)
|
|||
ShortenURL(url, taskSettings);
|
||||
return;
|
||||
}
|
||||
|
||||
if (taskSettings.UploadSettings.ClipboardUploadShareURL)
|
||||
{
|
||||
ShareURL(url, taskSettings);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (taskSettings.UploadSettings.ClipboardUploadAutoIndexFolder && text.Length <= 260 && Directory.Exists(text))
|
||||
|
@ -338,52 +344,66 @@ public static void UploadImageStream(Stream stream, string filename, TaskSetting
|
|||
|
||||
public static void ShortenURL(string url, TaskSettings taskSettings = null)
|
||||
{
|
||||
if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
|
||||
|
||||
if (!string.IsNullOrEmpty(url))
|
||||
{
|
||||
if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
|
||||
|
||||
UploadTask task = UploadTask.CreateURLShortenerTask(url, taskSettings);
|
||||
TaskManager.Start(task);
|
||||
}
|
||||
}
|
||||
|
||||
public static void ShareURL(string url, TaskSettings taskSettings = null)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(url))
|
||||
{
|
||||
if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
|
||||
|
||||
UploadTask task = UploadTask.CreateShareURLTask(url, taskSettings);
|
||||
TaskManager.Start(task);
|
||||
}
|
||||
}
|
||||
|
||||
public static void DownloadAndUploadFile(string url, string filename, TaskSettings taskSettings = null)
|
||||
{
|
||||
if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
|
||||
|
||||
string downloadPath = null;
|
||||
bool isDownloaded = false;
|
||||
|
||||
TaskEx.Run(() =>
|
||||
if (!string.IsNullOrEmpty(url))
|
||||
{
|
||||
downloadPath = TaskHelpers.CheckFilePath(taskSettings.CaptureFolder, filename, taskSettings);
|
||||
if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
|
||||
|
||||
if (!string.IsNullOrEmpty(downloadPath))
|
||||
string downloadPath = null;
|
||||
bool isDownloaded = false;
|
||||
|
||||
TaskEx.Run(() =>
|
||||
{
|
||||
try
|
||||
downloadPath = TaskHelpers.CheckFilePath(taskSettings.CaptureFolder, filename, taskSettings);
|
||||
|
||||
if (!string.IsNullOrEmpty(downloadPath))
|
||||
{
|
||||
using (WebClient wc = new WebClient())
|
||||
try
|
||||
{
|
||||
wc.Proxy = ProxyInfo.Current.GetWebProxy();
|
||||
wc.DownloadFile(url, downloadPath);
|
||||
}
|
||||
using (WebClient wc = new WebClient())
|
||||
{
|
||||
wc.Proxy = ProxyInfo.Current.GetWebProxy();
|
||||
wc.DownloadFile(url, downloadPath);
|
||||
}
|
||||
|
||||
isDownloaded = true;
|
||||
isDownloaded = true;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugHelper.WriteException(e);
|
||||
MessageBox.Show("Download failed:\r\n" + e.ToString(), "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugHelper.WriteException(e);
|
||||
MessageBox.Show("Download failed:\r\n" + e.ToString(), "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||
}
|
||||
}
|
||||
},
|
||||
() =>
|
||||
{
|
||||
if (isDownloaded)
|
||||
},
|
||||
() =>
|
||||
{
|
||||
UploadFile(downloadPath, taskSettings);
|
||||
}
|
||||
});
|
||||
if (isDownloaded)
|
||||
{
|
||||
UploadFile(downloadPath, taskSettings);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -151,6 +151,16 @@ public static UploadTask CreateURLShortenerTask(string url, TaskSettings taskSet
|
|||
return task;
|
||||
}
|
||||
|
||||
public static UploadTask CreateShareURLTask(string url, TaskSettings taskSettings)
|
||||
{
|
||||
UploadTask task = new UploadTask(taskSettings);
|
||||
task.Info.Job = TaskJob.ShareURL;
|
||||
task.Info.DataType = EDataType.URL;
|
||||
task.Info.FileName = "Share URL";
|
||||
task.Info.Result.URL = url;
|
||||
return task;
|
||||
}
|
||||
|
||||
public static UploadTask CreateFileJobTask(string filePath, TaskSettings taskSettings)
|
||||
{
|
||||
EDataType dataType = Helpers.FindDataType(filePath);
|
||||
|
@ -557,8 +567,8 @@ private void DoAfterUploadJobs()
|
|||
{
|
||||
try
|
||||
{
|
||||
if (Info.TaskSettings.AfterUploadJob.HasFlag(AfterUploadTasks.UseURLShortener) || Info.Job == TaskJob.ShortenURL ||
|
||||
(Info.TaskSettings.AdvancedSettings.AutoShortenURLLength > 0 && Info.Result.URL.Length > Info.TaskSettings.AdvancedSettings.AutoShortenURLLength))
|
||||
if (Info.Job != TaskJob.ShareURL && (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);
|
||||
|
||||
|
@ -568,9 +578,10 @@ private void DoAfterUploadJobs()
|
|||
}
|
||||
}
|
||||
|
||||
if (Info.TaskSettings.AfterUploadJob.HasFlag(AfterUploadTasks.ShareURLToSocialNetworkingService))
|
||||
if (Info.Job != TaskJob.ShortenURL && (Info.TaskSettings.AfterUploadJob.HasFlag(AfterUploadTasks.ShareURLToSocialNetworkingService) || Info.Job == TaskJob.ShareURL))
|
||||
{
|
||||
DoSocialNetworkingService();
|
||||
ShareURL(Info.Result.ToString());
|
||||
if (Info.Job == TaskJob.ShareURL) Info.Result.IsURLExpected = false;
|
||||
}
|
||||
|
||||
if (Info.TaskSettings.AfterUploadJob.HasFlag(AfterUploadTasks.SendURLWithEmail))
|
||||
|
@ -979,9 +990,6 @@ public UploadResult ShortenURL(string url)
|
|||
case UrlShortenerType.ISGD:
|
||||
urlShortener = new IsgdURLShortener();
|
||||
break;
|
||||
/*case UrlShortenerType.THREELY:
|
||||
urlShortener = new ThreelyURLShortener(Program.ThreelyKey);
|
||||
break;*/
|
||||
case UrlShortenerType.TINYURL:
|
||||
urlShortener = new TinyURLShortener();
|
||||
break;
|
||||
|
@ -1016,10 +1024,8 @@ public UploadResult ShortenURL(string url)
|
|||
return null;
|
||||
}
|
||||
|
||||
public void DoSocialNetworkingService()
|
||||
public void ShareURL(string url)
|
||||
{
|
||||
string url = Info.Result.ToString();
|
||||
|
||||
if (!string.IsNullOrEmpty(url))
|
||||
{
|
||||
string encodedUrl = URLHelpers.URLEncode(url);
|
||||
|
@ -1036,6 +1042,7 @@ public void DoSocialNetworkingService()
|
|||
twitter.ShowDialog();
|
||||
}
|
||||
}
|
||||
//URLHelpers.OpenURL("https://twitter.com/intent/tweet?text=" + encodedUrl);
|
||||
break;
|
||||
case SocialNetworkingService.Facebook:
|
||||
URLHelpers.OpenURL("https://www.facebook.com/sharer/sharer.php?u=" + encodedUrl);
|
||||
|
|
Loading…
Reference in a new issue