Merge pull request #1435 from johnduhart/feature/sharing-service

Refactored sharing services to use new pattern
This commit is contained in:
Jaex 2016-03-23 05:52:40 +02:00
commit 608204b71b
32 changed files with 369 additions and 174 deletions

View file

@ -936,6 +936,15 @@ internal static System.Drawing.Bitmap Sul {
}
}
/// <summary>
/// Looks up a localized string similar to Unable to find a valid Twitter account..
/// </summary>
internal static string TaskHelpers_TweetMessage_Unable_to_find_valid_Twitter_account_ {
get {
return ResourceManager.GetString("TaskHelpers_TweetMessage_Unable_to_find_valid_Twitter_account_", resourceCulture);
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Icon similar to (Icon).
/// </summary>

View file

@ -259,4 +259,7 @@ Hergestellte Ordner:</value>
<data name="Pomf_Upload_Please_select_one_of_the_Pomf_uploaders_from__Destination_settings_window____Pomf_tab__" xml:space="preserve">
<value>Bitte wähle einen der Pomf Hochlader vom Pomf Tab im Zieleinstellungs-Fenster aus.</value>
</data>
<data name="TaskHelpers_TweetMessage_Unable_to_find_valid_Twitter_account_" xml:space="preserve">
<value>Kann kein gültiges Twitter Konto finden.</value>
</data>
</root>

View file

@ -259,4 +259,7 @@ Dossiers créés:</value>
<data name="Pomf_Upload_Please_select_one_of_the_Pomf_uploaders_from__Destination_settings_window____Pomf_tab__" xml:space="preserve">
<value>Merci de sélectionner un des services de mise en ligne Pomf dans la fenêtre "Paramètres de destinations -&gt; Pomf".</value>
</data>
<data name="TaskHelpers_TweetMessage_Unable_to_find_valid_Twitter_account_" xml:space="preserve">
<value>Impossible de trouver un compte Twitter valide.</value>
</data>
</root>

View file

@ -259,4 +259,7 @@ Aangemaakte mappen:</value>
<data name="Pomf_Upload_Please_select_one_of_the_Pomf_uploaders_from__Destination_settings_window____Pomf_tab__" xml:space="preserve">
<value>Selecteer een van de Pomf uploaders van het venster "Instellingen voor bestemmingen" -&gt; Pomf tabblad.</value>
</data>
<data name="TaskHelpers_TweetMessage_Unable_to_find_valid_Twitter_account_" xml:space="preserve">
<value>Kan geen geldig Twitter account vinden.</value>
</data>
</root>

View file

@ -259,4 +259,7 @@ Pastas criadas:</value>
<data name="Pomf_Upload_Please_select_one_of_the_Pomf_uploaders_from__Destination_settings_window____Pomf_tab__" xml:space="preserve">
<value>Por favor selecione um dos uploaders Pomf em "Configurações de destino -&gt; Pomf".</value>
</data>
<data name="TaskHelpers_TweetMessage_Unable_to_find_valid_Twitter_account_" xml:space="preserve">
<value>Não foi possível encontrar uma conta válida do Twitter.</value>
</data>
</root>

View file

@ -497,4 +497,7 @@ Created folders:</value>
<data name="OpenLoad" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\favicons\openload.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="TaskHelpers_TweetMessage_Unable_to_find_valid_Twitter_account_" xml:space="preserve">
<value>Unable to find a valid Twitter account.</value>
</data>
</root>

View file

@ -259,4 +259,7 @@
<data name="Pomf_Upload_Please_select_one_of_the_Pomf_uploaders_from__Destination_settings_window____Pomf_tab__" xml:space="preserve">
<value>Пожалуйста, выберите один из сервисов Pomf в окне «Настройки сервисов», вкладка «Pomf».</value>
</data>
<data name="TaskHelpers_TweetMessage_Unable_to_find_valid_Twitter_account_" xml:space="preserve">
<value>Не удалось найти рабочий аккаунт Twitter.</value>
</data>
</root>

View file

@ -259,4 +259,7 @@ Oluşturulmuş dizinler:</value>
<data name="Pomf_Upload_Please_select_one_of_the_Pomf_uploaders_from__Destination_settings_window____Pomf_tab__" xml:space="preserve">
<value>Lütfen geçerli bir Pomf yükleyici seçiniz "Hedef ayarları penceresi -&gt; Pomf sekmesi".</value>
</data>
<data name="TaskHelpers_TweetMessage_Unable_to_find_valid_Twitter_account_" xml:space="preserve">
<value>Geçerli Twitter hesabı bulunamadı.</value>
</data>
</root>

View file

@ -259,4 +259,7 @@ Các thư mục đã tạo:</value>
<data name="UploadersConfigForm_HubicListFolders_Hubic_refresh_folders_list_failed" xml:space="preserve">
<value>Làm mới danh sách thư mục thất bại</value>
</data>
<data name="TaskHelpers_TweetMessage_Unable_to_find_valid_Twitter_account_" xml:space="preserve">
<value>Không thể tìm thấy tài khoàn Twitter hợp lệ.</value>
</data>
</root>

View file

@ -259,4 +259,7 @@
<data name="Pomf_Upload_Please_select_one_of_the_Pomf_uploaders_from__Destination_settings_window____Pomf_tab__" xml:space="preserve">
<value>请从“目的地设置窗口 -&gt; Pomf上传程序”中选择其中的一个Pomf上传程序。</value>
</data>
<data name="TaskHelpers_TweetMessage_Unable_to_find_valid_Twitter_account_" xml:space="preserve">
<value>无法找到可用的Twitter账号。</value>
</data>
</root>

View file

@ -208,6 +208,20 @@
<Compile Include="FileUploaders\GfycatUploader.cs" />
<Compile Include="HelperClasses\OAuth\IOAuthBase.cs" />
<Compile Include="HelperClasses\SSLBypassHelper.cs" />
<Compile Include="SharingService.cs" />
<Compile Include="SharingServices\DeliciousSharingService.cs" />
<Compile Include="SharingServices\EmailSharingService.cs" />
<Compile Include="SharingServices\FacebookSharingService.cs" />
<Compile Include="SharingServices\GooglePlusSharingService.cs" />
<Compile Include="SharingServices\LinkedInSharingService.cs" />
<Compile Include="SharingServices\PinterestSharingService.cs" />
<Compile Include="SharingServices\PushbulletSharingService.cs" />
<Compile Include="SharingServices\RedditSharingService.cs" />
<Compile Include="SharingServices\SimpleSharingService.cs" />
<Compile Include="SharingServices\StumbleUponSharingService.cs" />
<Compile Include="SharingServices\TumblrSharingService.cs" />
<Compile Include="SharingServices\TwitterSharingService.cs" />
<Compile Include="SharingServices\VkSharingService.cs" />
<Compile Include="TaskReferenceHelper.cs" />
<Compile Include="TextUploaderService.cs" />
<Compile Include="UploaderFactory.cs" />
@ -269,6 +283,7 @@
<Compile Include="TextUploaders\CustomTextUploader.cs" />
<Compile Include="TextUploaders\GitHubGist.cs" />
<Compile Include="TextUploaders\Paste_ee.cs" />
<Compile Include="UploadersConfigValidator.cs" />
<Compile Include="UploaderService.cs" />
<Compile Include="UploadResult.cs" />
<Compile Include="Forms\TwitterTweetForm.cs">
@ -902,6 +917,7 @@
<ItemGroup>
<Analyzer Include="..\packages\AWSSDK.S3.3.1.4.0\analyzers\dotnet\cs\AWSSDK.S3.CodeAnalysis.dll" />
</ItemGroup>
<ItemGroup />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Import Project="$(SolutionDir)\.nuget\NuGet.targets" Condition="Exists('$(SolutionDir)\.nuget\NuGet.targets')" />
<PropertyGroup>

View file

@ -0,0 +1,15 @@
namespace ShareX.UploadersLib
{
/// <summary>
/// Defines a service capable of sharing a URL to (eg. Facebook, Twitter)
/// </summary>
public abstract class SharingService : UploaderService<URLSharingServices>
{
/// <summary>
/// Shares the URL with the service
/// </summary>
/// <param name="url">the unencoded URL to share</param>
/// <param name="uploadersConfig">the uploaders configuration for the task</param>
public abstract void ShareURL(string url, UploadersConfig uploadersConfig);
}
}

View file

@ -0,0 +1,8 @@
namespace ShareX.UploadersLib.SharingServices
{
public class DeliciousSharingService : SimpleSharingService
{
public override URLSharingServices EnumValue { get; } = URLSharingServices.Delicious;
protected override string UrlFormatString { get; } = "https://delicious.com/save?v=5&url={0}";
}
}

View file

@ -0,0 +1,49 @@
using System.Windows.Forms;
using ShareX.HelpersLib;
using ShareX.UploadersLib.FileUploaders;
namespace ShareX.UploadersLib.SharingServices
{
public class EmailSharingService : SharingService
{
public override URLSharingServices EnumValue { get; } = URLSharingServices.Email;
public override bool CheckConfig(UploadersConfig config)
{
return !string.IsNullOrEmpty(config.EmailSmtpServer)
&& config.EmailSmtpPort > 0
&& !string.IsNullOrEmpty(config.EmailFrom)
&& !string.IsNullOrEmpty(config.EmailPassword);
}
public override void ShareURL(string url, UploadersConfig uploadersConfig)
{
if (!CheckConfig(uploadersConfig))
{
URLHelpers.OpenURL("mailto:?body=" + URLHelpers.URLEncode(url));
return;
}
using (EmailForm emailForm = new EmailForm(uploadersConfig.EmailRememberLastTo ? uploadersConfig.EmailLastTo : string.Empty,
uploadersConfig.EmailDefaultSubject, url))
{
if (emailForm.ShowDialog() == DialogResult.OK)
{
if (uploadersConfig.EmailRememberLastTo)
{
uploadersConfig.EmailLastTo = emailForm.ToEmail;
}
Email email = new Email
{
SmtpServer = uploadersConfig.EmailSmtpServer,
SmtpPort = uploadersConfig.EmailSmtpPort,
FromEmail = uploadersConfig.EmailFrom,
Password = uploadersConfig.EmailPassword
};
email.Send(emailForm.ToEmail, emailForm.Subject, emailForm.Body);
}
}
}
}
}

View file

@ -0,0 +1,9 @@
namespace ShareX.UploadersLib.SharingServices
{
public class FacebookSharingService : SimpleSharingService
{
public override URLSharingServices EnumValue { get; } = URLSharingServices.Facebook;
protected override string UrlFormatString { get; } = "https://www.facebook.com/sharer/sharer.php?u={0}";
}
}

View file

@ -0,0 +1,9 @@
namespace ShareX.UploadersLib.SharingServices
{
public class GooglePlusSharingService : SimpleSharingService
{
public override URLSharingServices EnumValue { get; } = URLSharingServices.GooglePlus;
protected override string UrlFormatString { get; } = "https://plus.google.com/share?url={0}";
}
}

View file

@ -0,0 +1,8 @@
namespace ShareX.UploadersLib.SharingServices
{
public class LinkedInSharingService : SimpleSharingService
{
public override URLSharingServices EnumValue { get; } = URLSharingServices.LinkedIn;
protected override string UrlFormatString { get; } = "https://www.linkedin.com/shareArticle?url={0}";
}
}

View file

@ -0,0 +1,8 @@
namespace ShareX.UploadersLib.SharingServices
{
public class PinterestSharingService : SimpleSharingService
{
public override URLSharingServices EnumValue { get; } = URLSharingServices.Pinterest;
protected override string UrlFormatString { get; } = "http://pinterest.com/pin/create/button/?url={0}&media={0}";
}
}

View file

@ -0,0 +1,25 @@
using ShareX.HelpersLib;
using ShareX.UploadersLib.FileUploaders;
namespace ShareX.UploadersLib.SharingServices
{
public class PushbulletSharingService : SharingService
{
public override URLSharingServices EnumValue { get; } = URLSharingServices.Pushbullet;
public override bool CheckConfig(UploadersConfig uploadersConfig)
{
var pushbulletSettings = uploadersConfig.PushbulletSettings;
return pushbulletSettings != null
&& !string.IsNullOrEmpty(pushbulletSettings.UserAPIKey)
&& pushbulletSettings.DeviceList != null
&& pushbulletSettings.DeviceList.IsValidIndex(pushbulletSettings.SelectedDevice);
}
public override void ShareURL(string url, UploadersConfig uploadersConfig)
{
new Pushbullet(uploadersConfig.PushbulletSettings).PushLink(url, "ShareX: URL Share");
}
}
}

View file

@ -0,0 +1,8 @@
namespace ShareX.UploadersLib.SharingServices
{
public class RedditSharingService : SimpleSharingService
{
public override URLSharingServices EnumValue { get; } = URLSharingServices.Reddit;
protected override string UrlFormatString { get; } = "http://www.reddit.com/submit?url={0}";
}
}

View file

@ -0,0 +1,26 @@
using System.ComponentModel;
using ShareX.HelpersLib;
namespace ShareX.UploadersLib.SharingServices
{
/// <summary>
/// Base class for services that just open a share dialog in a browser
/// </summary>
public abstract class SimpleSharingService : SharingService
{
/// <summary>
/// A string formatted URL that opens a share dialog
/// </summary>
/// <value>a string with a one placeholder for the URL to share</value>
[Localizable(false)]
protected abstract string UrlFormatString { get; }
public override void ShareURL(string url, UploadersConfig uploadersConfig)
{
string encodedUrl = URLHelpers.URLEncode(url);
URLHelpers.OpenURL(string.Format(UrlFormatString, encodedUrl));
}
public override bool CheckConfig(UploadersConfig uploadersConfig) => true;
}
}

View file

@ -0,0 +1,8 @@
namespace ShareX.UploadersLib.SharingServices
{
public class StumbleUponSharingService : SimpleSharingService
{
public override URLSharingServices EnumValue { get; } = URLSharingServices.StumbleUpon;
protected override string UrlFormatString { get; } = "https://delicious.com/save?v=5&url={0}";
}
}

View file

@ -0,0 +1,8 @@
namespace ShareX.UploadersLib.SharingServices
{
public class TumblrSharingService : SimpleSharingService
{
public override URLSharingServices EnumValue { get; } = URLSharingServices.Tumblr;
protected override string UrlFormatString { get; } = "https://www.tumblr.com/share?v=3&u={0}";
}
}

View file

@ -0,0 +1,50 @@
using System;
using System.Windows.Forms;
using ShareX.HelpersLib;
using ShareX.UploadersLib.HelperClasses;
using ShareX.UploadersLib.ImageUploaders;
using ShareX.UploadersLib.Properties;
namespace ShareX.UploadersLib.SharingServices
{
public class TwitterSharingService : SharingService
{
public override URLSharingServices EnumValue { get; } = URLSharingServices.Twitter;
public override bool CheckConfig(UploadersConfig config)
{
return config.TwitterOAuthInfoList != null
&& config.TwitterOAuthInfoList.IsValidIndex(config.TwitterSelectedAccount)
&& OAuthInfo.CheckOAuth(config.TwitterOAuthInfoList[config.TwitterSelectedAccount]);
}
public override void ShareURL(string url, UploadersConfig uploadersConfig)
{
if (!CheckConfig(uploadersConfig))
{
//URLHelpers.OpenURL("https://twitter.com/intent/tweet?text=" + encodedUrl);
MessageBox.Show(Resources.TaskHelpers_TweetMessage_Unable_to_find_valid_Twitter_account_, "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
OAuthInfo twitterOAuth = uploadersConfig.TwitterOAuthInfoList[uploadersConfig.TwitterSelectedAccount];
if (uploadersConfig.TwitterSkipMessageBox)
{
try
{
new Twitter(twitterOAuth).TweetMessage(url);
}
catch (Exception ex)
{
DebugHelper.WriteException(ex);
}
}
else
{
using (TwitterTweetForm twitter = new TwitterTweetForm(twitterOAuth, url))
{
twitter.ShowDialog();
}
}
}
}
}

View file

@ -0,0 +1,8 @@
namespace ShareX.UploadersLib.SharingServices
{
public class VkSharingService : SimpleSharingService
{
public override URLSharingServices EnumValue { get; } = URLSharingServices.VK;
protected override string UrlFormatString { get; } = "http://vk.com/share.php?url={0}";
}
}

View file

@ -34,6 +34,7 @@ public static class UploaderFactory
private static readonly TextUploaderService[] textUploaderServices = Helpers.GetInstances<TextUploaderService>();
private static readonly FileUploaderService[] fileUploaderServices = Helpers.GetInstances<FileUploaderService>();
private static readonly URLShortenerService[] urlShortenerServices = Helpers.GetInstances<URLShortenerService>();
private static readonly SharingService[] sharingServices = Helpers.GetInstances<SharingService>();
public static ImageUploaderService GetImageUploaderServiceByEnum(ImageDestination enumValue)
{
@ -54,5 +55,10 @@ public static URLShortenerService GetURLShortenerServiceByEnum(UrlShortenerType
{
return urlShortenerServices.First(x => x.EnumValue == enumValue);
}
public static SharingService GetSharingServiceByEnum(URLSharingServices enumValue)
{
return sharingServices.First(x => x.EnumValue == enumValue);
}
}
}

View file

@ -350,79 +350,5 @@ public class UploadersConfig : SettingsBase<UploadersConfig>
public int CustomURLShortenerSelected = 0;
#endregion Custom Uploaders
#region Helper Methods
public bool IsValid<T>(int index)
{
Enum destination = (Enum)Enum.ToObject(typeof(T), index);
if (destination is ImageDestination)
{
return IsValid((ImageDestination)destination);
}
if (destination is TextDestination)
{
return IsValid((TextDestination)destination);
}
if (destination is FileDestination)
{
return IsValid((FileDestination)destination);
}
if (destination is UrlShortenerType)
{
return IsValid((UrlShortenerType)destination);
}
if (destination is URLSharingServices)
{
return IsValid((URLSharingServices)destination);
}
return true;
}
public bool IsValid(ImageDestination destination)
{
if (destination == ImageDestination.FileUploader) return true;
return UploaderFactory.GetImageUploaderServiceByEnum(destination).CheckConfig(this);
}
public bool IsValid(TextDestination destination)
{
if (destination == TextDestination.FileUploader) return true;
return UploaderFactory.GetTextUploaderServiceByEnum(destination).CheckConfig(this);
}
public bool IsValid(FileDestination destination)
{
return UploaderFactory.GetFileUploaderServiceByEnum(destination).CheckConfig(this);
}
public bool IsValid(UrlShortenerType destination)
{
return UploaderFactory.GetURLShortenerServiceByEnum(destination).CheckConfig(this);
}
public bool IsValid(URLSharingServices destination)
{
switch (destination)
{
case URLSharingServices.Email:
return !string.IsNullOrEmpty(EmailSmtpServer) && EmailSmtpPort > 0 && !string.IsNullOrEmpty(EmailFrom) && !string.IsNullOrEmpty(EmailPassword);
case URLSharingServices.Twitter:
return TwitterOAuthInfoList != null && TwitterOAuthInfoList.IsValidIndex(TwitterSelectedAccount) && OAuthInfo.CheckOAuth(TwitterOAuthInfoList[TwitterSelectedAccount]);
case URLSharingServices.Pushbullet:
return PushbulletSettings != null && !string.IsNullOrEmpty(PushbulletSettings.UserAPIKey) && PushbulletSettings.DeviceList != null &&
PushbulletSettings.DeviceList.IsValidIndex(PushbulletSettings.SelectedDevice);
}
return true;
}
#endregion Helper Methods
}
}

View file

@ -0,0 +1,66 @@
using System;
namespace ShareX.UploadersLib
{
public static class UploadersConfigValidator
{
public static bool Validate<T>(int index, UploadersConfig config)
{
Enum destination = (Enum)Enum.ToObject(typeof(T), index);
if (destination is ImageDestination)
{
return Validate((ImageDestination)destination, config);
}
if (destination is TextDestination)
{
return Validate((TextDestination)destination, config);
}
if (destination is FileDestination)
{
return Validate((FileDestination)destination, config);
}
if (destination is UrlShortenerType)
{
return Validate((UrlShortenerType)destination, config);
}
if (destination is URLSharingServices)
{
return Validate((URLSharingServices)destination, config);
}
return true;
}
public static bool Validate(ImageDestination destination, UploadersConfig config)
{
if (destination == ImageDestination.FileUploader) return true;
return UploaderFactory.GetImageUploaderServiceByEnum(destination).CheckConfig(config);
}
public static bool Validate(TextDestination destination, UploadersConfig config)
{
if (destination == TextDestination.FileUploader) return true;
return UploaderFactory.GetTextUploaderServiceByEnum(destination).CheckConfig(config);
}
public static bool Validate(FileDestination destination, UploadersConfig config)
{
return UploaderFactory.GetFileUploaderServiceByEnum(destination).CheckConfig(config);
}
public static bool Validate(UrlShortenerType destination, UploadersConfig config)
{
return UploaderFactory.GetURLShortenerServiceByEnum(destination).CheckConfig(config);
}
public static bool Validate(URLSharingServices destination, UploadersConfig config)
{
return UploaderFactory.GetSharingServiceByEnum(destination).CheckConfig(config);
}
}
}

View file

@ -191,7 +191,7 @@ private void AddDestination<T>(int index, EDataType dataType, TaskSettings taskS
{
Enum destination = (Enum)Enum.ToObject(typeof(T), index);
if (Program.UploadersConfig.IsValid<T>(index))
if (UploadersConfigValidator.Validate<T>(index, Program.UploadersConfig))
{
RadioButton rb = new RadioButton() { AutoSize = true };

View file

@ -456,7 +456,7 @@ private void EnableDisableToolStripMenuItems<T>(params ToolStripDropDownItem[] p
{
for (int i = 0; i < parent.DropDownItems.Count; i++)
{
parent.DropDownItems[i].Enabled = Program.UploadersConfig.IsValid<T>(i);
parent.DropDownItems[i].Enabled = UploadersConfigValidator.Validate<T>(i, Program.UploadersConfig);
}
}
}

View file

@ -550,7 +550,7 @@ private void EnableDisableToolStripMenuItems<T>(params ToolStripDropDownItem[] p
{
for (int i = 0; i < parent.DropDownItems.Count; i++)
{
parent.DropDownItems[i].Enabled = Program.UploadersConfig.IsValid<T>(i);
parent.DropDownItems[i].Enabled = UploadersConfigValidator.Validate<T>(i, Program.UploadersConfig);
}
}
}

View file

@ -894,104 +894,10 @@ public UploadResult ShortenURL(string url)
public void ShareURL(string url)
{
if (!string.IsNullOrEmpty(url))
{
string encodedUrl = URLHelpers.URLEncode(url);
if (string.IsNullOrEmpty(url)) return;
switch (Info.TaskSettings.URLSharingServiceDestination)
{
case URLSharingServices.Email:
if (Program.UploadersConfig.IsValid(URLSharingServices.Email))
{
using (EmailForm emailForm = new EmailForm(Program.UploadersConfig.EmailRememberLastTo ? Program.UploadersConfig.EmailLastTo : string.Empty,
Program.UploadersConfig.EmailDefaultSubject, url))
{
if (emailForm.ShowDialog() == DialogResult.OK)
{
if (Program.UploadersConfig.EmailRememberLastTo)
{
Program.UploadersConfig.EmailLastTo = emailForm.ToEmail;
}
Email email = new Email
{
SmtpServer = Program.UploadersConfig.EmailSmtpServer,
SmtpPort = Program.UploadersConfig.EmailSmtpPort,
FromEmail = Program.UploadersConfig.EmailFrom,
Password = Program.UploadersConfig.EmailPassword
};
email.Send(emailForm.ToEmail, emailForm.Subject, emailForm.Body);
}
}
}
else
{
URLHelpers.OpenURL("mailto:?body=" + encodedUrl);
}
break;
case URLSharingServices.Twitter:
if (Program.UploadersConfig.IsValid(URLSharingServices.Twitter))
{
OAuthInfo twitterOAuth = Program.UploadersConfig.TwitterOAuthInfoList[Program.UploadersConfig.TwitterSelectedAccount];
if (Program.UploadersConfig.TwitterSkipMessageBox)
{
try
{
new Twitter(twitterOAuth).TweetMessage(url);
}
catch (Exception ex)
{
DebugHelper.WriteException(ex);
}
}
else
{
using (TwitterTweetForm twitter = new TwitterTweetForm(twitterOAuth, url))
{
twitter.ShowDialog();
}
}
}
else
{
//URLHelpers.OpenURL("https://twitter.com/intent/tweet?text=" + encodedUrl);
MessageBox.Show(Resources.TaskHelpers_TweetMessage_Unable_to_find_valid_Twitter_account_, "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
break;
case URLSharingServices.Facebook:
URLHelpers.OpenURL("https://www.facebook.com/sharer/sharer.php?u=" + encodedUrl);
break;
case URLSharingServices.GooglePlus:
URLHelpers.OpenURL("https://plus.google.com/share?url=" + encodedUrl);
break;
case URLSharingServices.Reddit:
URLHelpers.OpenURL("http://www.reddit.com/submit?url=" + encodedUrl);
break;
case URLSharingServices.Pinterest:
URLHelpers.OpenURL(string.Format("http://pinterest.com/pin/create/button/?url={0}&media={0}", encodedUrl));
break;
case URLSharingServices.Tumblr:
URLHelpers.OpenURL("https://www.tumblr.com/share?v=3&u=" + encodedUrl);
break;
case URLSharingServices.LinkedIn:
URLHelpers.OpenURL("https://www.linkedin.com/shareArticle?url=" + encodedUrl);
break;
case URLSharingServices.StumbleUpon:
URLHelpers.OpenURL("http://www.stumbleupon.com/submit?url=" + encodedUrl);
break;
case URLSharingServices.Delicious:
URLHelpers.OpenURL("https://delicious.com/save?v=5&url=" + encodedUrl);
break;
case URLSharingServices.VK:
URLHelpers.OpenURL("http://vk.com/share.php?url=" + encodedUrl);
break;
case URLSharingServices.Pushbullet:
new Pushbullet(Program.UploadersConfig.PushbulletSettings).PushLink(url, "ShareX: URL Share");
break;
}
}
UploaderFactory.GetSharingServiceByEnum(Info.TaskSettings.URLSharingServiceDestination)
.ShareURL(url, Program.UploadersConfig);
}
private void PrepareUploader(Uploader currentUploader)