public void ShortenURL(UrlShortenerType urlShortener) { if (IsItemSelected && SelectedItem.IsURLExist) { UploadManager.ShortenURL(SelectedItem.Info.Result.ToString(), urlShortener); } }
public bool IsValid(UrlShortenerType destination) { URLShortenerService service = UploaderFactory.GetURLShortenerServiceByEnum(destination); if (service != null) { return(service.CheckConfig(this)); } switch (destination) { case UrlShortenerType.Google: return(GoogleURLShortenerAccountType == AccountType.Anonymous || OAuth2Info.CheckOAuth(GoogleURLShortenerOAuth2Info)); case UrlShortenerType.YOURLS: 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.CoinURL: return(!string.IsNullOrEmpty(CoinURLUUID)); case UrlShortenerType.Polr: return(!string.IsNullOrEmpty(PolrAPIKey)); case UrlShortenerType.CustomURLShortener: return(CustomUploadersList != null && CustomUploadersList.IsValidIndex(CustomURLShortenerSelected)); } return(true); }
public bool IsValid(UrlShortenerType destination) { switch (destination) { case UrlShortenerType.Google: return(GoogleURLShortenerAccountType == AccountType.Anonymous || OAuth2Info.CheckOAuth(GoogleURLShortenerOAuth2Info)); case UrlShortenerType.BITLY: return(OAuth2Info.CheckOAuth(BitlyOAuth2Info)); case UrlShortenerType.YOURLS: 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.CoinURL: return(!string.IsNullOrEmpty(CoinURLUUID)); case UrlShortenerType.Polr: return(!string.IsNullOrEmpty(PolrAPIKey)); case UrlShortenerType.CustomURLShortener: return(CustomUploadersList != null && CustomUploadersList.IsValidIndex(CustomURLShortenerSelected)); } return(true); }
private void SetDefaultSettings() { if (Program.DefaultTaskSettings != null) { TaskSettings defaultTaskSettings = Program.DefaultTaskSettings.Copy(); if (UseDefaultAfterCaptureJob) { AfterCaptureJob = defaultTaskSettings.AfterCaptureJob; } if (UseDefaultAfterUploadJob) { AfterUploadJob = defaultTaskSettings.AfterUploadJob; } if (UseDefaultDestinations) { ImageDestination = defaultTaskSettings.ImageDestination; TextDestination = defaultTaskSettings.TextDestination; FileDestination = defaultTaskSettings.FileDestination; URLShortenerDestination = defaultTaskSettings.URLShortenerDestination; SocialNetworkingServiceDestination = defaultTaskSettings.SocialNetworkingServiceDestination; } if (UseDefaultGeneralSettings) { GeneralSettings = defaultTaskSettings.GeneralSettings; } if (UseDefaultImageSettings) { ImageSettings = defaultTaskSettings.ImageSettings; } if (UseDefaultCaptureSettings) { CaptureSettings = defaultTaskSettings.CaptureSettings; } if (UseDefaultUploadSettings) { UploadSettings = defaultTaskSettings.UploadSettings; } if (UseDefaultActions) { ExternalPrograms = defaultTaskSettings.ExternalPrograms; } if (UseDefaultIndexerSettings) { IndexerSettings = defaultTaskSettings.IndexerSettings; } if (UseDefaultAdvancedSettings) { AdvancedSettings = defaultTaskSettings.AdvancedSettings; } } }
public static void ShortenURL(string url, UrlShortenerType urlShortener) { if (!string.IsNullOrEmpty(url)) { TaskSettings taskSettings = TaskSettings.GetDefaultTaskSettings(); taskSettings.URLShortenerDestination = urlShortener; UploadTask task = UploadTask.CreateURLShortenerTask(url, taskSettings); TaskManager.Start(task); } }
public bool IsActive(UrlShortenerType destination) { switch (destination) { case UrlShortenerType.Google: return(GoogleURLShortenerAccountType == AccountType.Anonymous || OAuth2Info.CheckOAuth(GoogleURLShortenerOAuth2Info)); case UrlShortenerType.CustomURLShortener: return(CustomUploadersList != null && CustomUploadersList.IsValidIndex(CustomURLShortenerSelected)); default: return(true); } }
public bool IsActive(UrlShortenerType destination) { switch (destination) { case UrlShortenerType.Google: return(GoogleURLShortenerAccountType == AccountType.Anonymous || OAuth2Info.CheckOAuth(GoogleURLShortenerOAuth2Info)); case UrlShortenerType.BITLY: return(OAuth2Info.CheckOAuth(BitlyOAuth2Info)); case UrlShortenerType.YOURLS: return(!string.IsNullOrEmpty(YourlsAPIURL) && (!string.IsNullOrEmpty(YourlsSignature) || (!string.IsNullOrEmpty(YourlsUsername) && !string.IsNullOrEmpty(YourlsPassword)))); case UrlShortenerType.CustomURLShortener: return(CustomUploadersList != null && CustomUploadersList.IsValidIndex(CustomURLShortenerSelected)); default: return(true); } }
public static bool Validate(UrlShortenerType destination, UploadersConfig config) { return(UploaderFactory.URLShortenerServices[destination].CheckConfig(config)); }
public void ShortenURL(UrlShortenerType urlShortener) { if (IsItemSelected && SelectedItem.IsURLExist) UploadManager.ShortenURL(SelectedItem.Info.Result.ToString(), urlShortener); }
public static void ShortenURL(string url, UrlShortenerType urlShortener) { if (!string.IsNullOrEmpty(url)) { TaskSettings taskSettings = TaskSettings.GetDefaultTaskSettings(); taskSettings.URLShortenerDestination = urlShortener; UploadTask task = UploadTask.CreateURLShortenerTask(url, taskSettings); TaskManager.Start(task); } }
public static URLShortenerService GetURLShortenerService(UrlShortenerType enumValue) { return(urlShortenerServices.First(x => x.EnumValue == enumValue)); }
private void SetDefaultSettings() { if (Program.DefaultTaskSettings != null) { TaskSettings defaultTaskSettings = Program.DefaultTaskSettings.Copy(); if (UseDefaultAfterCaptureJob) { AfterCaptureJob = defaultTaskSettings.AfterCaptureJob; } if (UseDefaultAfterUploadJob) { AfterUploadJob = defaultTaskSettings.AfterUploadJob; } if (UseDefaultDestinations) { ImageDestination = defaultTaskSettings.ImageDestination; ImageFileDestination = defaultTaskSettings.ImageFileDestination; TextDestination = defaultTaskSettings.TextDestination; TextFileDestination = defaultTaskSettings.TextFileDestination; FileDestination = defaultTaskSettings.FileDestination; URLShortenerDestination = defaultTaskSettings.URLShortenerDestination; URLSharingServiceDestination = defaultTaskSettings.URLSharingServiceDestination; } if (UseDefaultGeneralSettings) { GeneralSettings = defaultTaskSettings.GeneralSettings; } if (UseDefaultImageSettings) { ImageSettings = defaultTaskSettings.ImageSettings; } if (UseDefaultCaptureSettings) { CaptureSettings = defaultTaskSettings.CaptureSettings; } if (UseDefaultUploadSettings) { UploadSettings = defaultTaskSettings.UploadSettings; } if (UseDefaultActions) { ExternalPrograms = defaultTaskSettings.ExternalPrograms; } if (UseDefaultToolsSettings) { ToolsSettings = defaultTaskSettings.ToolsSettings; } if (UseDefaultAdvancedSettings) { AdvancedSettings = defaultTaskSettings.AdvancedSettings; } } }