2013-11-03 23:53:49 +13:00
|
|
|
|
#region License Information (GPL v3)
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
ShareX - A program that allows you to take screenshots and share any file type
|
2014-12-31 22:41:32 +13:00
|
|
|
|
Copyright © 2007-2015 ShareX Developers
|
2013-11-03 23:53:49 +13:00
|
|
|
|
|
|
|
|
|
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 <http://www.gnu.org/licenses/>.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#endregion License Information (GPL v3)
|
|
|
|
|
|
|
|
|
|
using CG.Web.MegaApiClient;
|
2014-12-11 09:25:20 +13:00
|
|
|
|
using ShareX.HelpersLib;
|
|
|
|
|
using ShareX.UploadersLib.FileUploaders;
|
|
|
|
|
using ShareX.UploadersLib.HelperClasses;
|
|
|
|
|
using ShareX.UploadersLib.ImageUploaders;
|
|
|
|
|
using ShareX.UploadersLib.TextUploaders;
|
2014-12-11 12:19:28 +13:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2013-11-03 23:53:49 +13:00
|
|
|
|
|
2014-12-11 09:25:20 +13:00
|
|
|
|
namespace ShareX.UploadersLib
|
2013-11-03 23:53:49 +13:00
|
|
|
|
{
|
|
|
|
|
public class UploadersConfig : SettingsBase<UploadersConfig>
|
|
|
|
|
{
|
|
|
|
|
#region Image uploaders
|
|
|
|
|
|
2014-06-16 22:47:35 +12:00
|
|
|
|
// Imgur
|
|
|
|
|
|
|
|
|
|
public AccountType ImgurAccountType = AccountType.Anonymous;
|
2014-07-22 12:12:07 +12:00
|
|
|
|
public bool ImgurDirectLink = true;
|
2014-06-16 22:47:35 +12:00
|
|
|
|
public ImgurThumbnailType ImgurThumbnailType = ImgurThumbnailType.Large_Thumbnail;
|
|
|
|
|
public OAuth2Info ImgurOAuth2Info = null;
|
2014-09-07 13:11:55 +12:00
|
|
|
|
public bool ImgurUploadSelectedAlbum = false;
|
|
|
|
|
public ImgurAlbumData ImgurSelectedAlbum = null;
|
|
|
|
|
public List<ImgurAlbumData> ImgurAlbumList = null;
|
2014-06-16 22:47:35 +12:00
|
|
|
|
|
2013-11-03 23:53:49 +13:00
|
|
|
|
// ImageShack
|
2014-02-01 11:11:25 +13:00
|
|
|
|
|
2014-01-12 23:44:06 +13:00
|
|
|
|
public ImageShackOptions ImageShackSettings = new ImageShackOptions();
|
2013-11-03 23:53:49 +13:00
|
|
|
|
|
|
|
|
|
// TinyPic
|
|
|
|
|
|
|
|
|
|
public AccountType TinyPicAccountType = AccountType.Anonymous;
|
|
|
|
|
public string TinyPicRegistrationCode = string.Empty;
|
|
|
|
|
public string TinyPicUsername = string.Empty;
|
|
|
|
|
public string TinyPicPassword = string.Empty;
|
|
|
|
|
public bool TinyPicRememberUserPass = false;
|
|
|
|
|
|
|
|
|
|
// Flickr
|
|
|
|
|
|
|
|
|
|
public FlickrAuthInfo FlickrAuthInfo = new FlickrAuthInfo();
|
|
|
|
|
public FlickrSettings FlickrSettings = new FlickrSettings();
|
|
|
|
|
|
|
|
|
|
// Photobucket
|
|
|
|
|
|
|
|
|
|
public OAuthInfo PhotobucketOAuthInfo = null;
|
|
|
|
|
public PhotobucketAccountInfo PhotobucketAccountInfo = null;
|
|
|
|
|
|
|
|
|
|
// Picasa
|
|
|
|
|
|
|
|
|
|
public OAuth2Info PicasaOAuth2Info = null;
|
|
|
|
|
public string PicasaAlbumID = string.Empty;
|
|
|
|
|
|
2014-09-18 07:25:23 +12:00
|
|
|
|
// Chevereto
|
|
|
|
|
|
|
|
|
|
public string CheveretoWebsite = string.Empty;
|
2014-09-29 18:46:41 +13:00
|
|
|
|
public string CheveretoAPIKey = string.Empty;
|
2014-09-18 07:33:11 +12:00
|
|
|
|
public bool CheveretoDirectURL = true;
|
2014-09-18 07:25:23 +12:00
|
|
|
|
|
2013-11-03 23:53:49 +13:00
|
|
|
|
#endregion Image uploaders
|
|
|
|
|
|
|
|
|
|
#region Text uploaders
|
|
|
|
|
|
|
|
|
|
// Pastebin
|
|
|
|
|
|
|
|
|
|
public PastebinSettings PastebinSettings = new PastebinSettings();
|
|
|
|
|
|
|
|
|
|
// Paste.ee
|
|
|
|
|
|
|
|
|
|
public string Paste_eeUserAPIKey = "public";
|
|
|
|
|
|
2013-12-03 12:11:30 +13:00
|
|
|
|
// Gist
|
|
|
|
|
|
|
|
|
|
public bool GistAnonymousLogin = true;
|
|
|
|
|
public OAuth2Info GistOAuth2Info = null;
|
2013-12-04 10:49:15 +13:00
|
|
|
|
public bool GistPublishPublic = false;
|
2013-12-03 12:11:30 +13:00
|
|
|
|
|
2014-02-01 10:17:39 +13:00
|
|
|
|
// uPaste
|
|
|
|
|
|
|
|
|
|
public string UpasteUserKey = string.Empty;
|
2014-02-01 11:11:25 +13:00
|
|
|
|
public bool UpasteIsPublic = false;
|
2014-02-01 10:17:39 +13:00
|
|
|
|
|
2014-09-26 17:18:44 +12:00
|
|
|
|
// Hastebin
|
|
|
|
|
|
|
|
|
|
public string HastebinCustomDomain = "http://hastebin.com";
|
|
|
|
|
public string HastebinSyntaxHighlighting = "hs";
|
|
|
|
|
|
2013-11-03 23:53:49 +13:00
|
|
|
|
#endregion Text uploaders
|
|
|
|
|
|
|
|
|
|
#region File uploaders
|
|
|
|
|
|
|
|
|
|
// Dropbox
|
|
|
|
|
|
2014-06-09 07:11:44 +12:00
|
|
|
|
public OAuth2Info DropboxOAuth2Info = null;
|
2013-11-03 23:53:49 +13:00
|
|
|
|
public DropboxAccountInfo DropboxAccountInfo = null;
|
2014-04-16 07:30:46 +12:00
|
|
|
|
public string DropboxUploadPath = "Public/ShareX/%y/%mo";
|
2013-11-03 23:53:49 +13:00
|
|
|
|
public bool DropboxAutoCreateShareableLink = false;
|
2014-04-20 11:00:19 +12:00
|
|
|
|
public DropboxURLType DropboxURLType = DropboxURLType.Default;
|
2013-11-03 23:53:49 +13:00
|
|
|
|
|
2014-07-16 00:17:02 +12:00
|
|
|
|
// OneDrive
|
|
|
|
|
|
|
|
|
|
public OAuth2Info OneDriveOAuth2Info = null;
|
2014-12-27 12:23:50 +13:00
|
|
|
|
public OneDriveFileInfo OneDriveSelectedFolder = OneDrive.RootFolder;
|
2014-12-26 10:23:42 +13:00
|
|
|
|
public bool OneDriveAutoCreateShareableLink = true;
|
2014-07-16 00:17:02 +12:00
|
|
|
|
|
2014-06-06 06:19:45 +12:00
|
|
|
|
// Copy
|
|
|
|
|
|
|
|
|
|
public OAuthInfo CopyOAuthInfo = null;
|
|
|
|
|
public CopyAccountInfo CopyAccountInfo = null;
|
|
|
|
|
public string CopyUploadPath = "ShareX/%y/%mo";
|
2014-06-10 07:25:23 +12:00
|
|
|
|
public CopyURLType CopyURLType = CopyURLType.Shortened;
|
2014-06-06 06:19:45 +12:00
|
|
|
|
|
2013-11-03 23:53:49 +13:00
|
|
|
|
// Google Drive
|
|
|
|
|
|
|
|
|
|
public OAuth2Info GoogleDriveOAuth2Info = null;
|
2014-07-02 04:40:40 +12:00
|
|
|
|
public bool GoogleDriveIsPublic = true;
|
2014-07-02 20:52:05 +12:00
|
|
|
|
public bool GoogleDriveUseFolder = false;
|
2014-07-01 20:33:33 +12:00
|
|
|
|
public string GoogleDriveFolderID = string.Empty;
|
2013-11-03 23:53:49 +13:00
|
|
|
|
|
|
|
|
|
// RapidShare
|
|
|
|
|
|
|
|
|
|
public string RapidShareUsername = string.Empty;
|
|
|
|
|
public string RapidSharePassword = string.Empty;
|
|
|
|
|
public string RapidShareFolderID = string.Empty;
|
|
|
|
|
|
|
|
|
|
// SendSpace
|
|
|
|
|
|
|
|
|
|
public AccountType SendSpaceAccountType = AccountType.Anonymous;
|
|
|
|
|
public string SendSpaceUsername = string.Empty;
|
|
|
|
|
public string SendSpacePassword = string.Empty;
|
|
|
|
|
|
|
|
|
|
// Minus
|
|
|
|
|
|
2014-03-21 12:37:43 +13:00
|
|
|
|
public OAuth2Info MinusOAuth2Info = null;
|
2013-11-03 23:53:49 +13:00
|
|
|
|
public MinusOptions MinusConfig = new MinusOptions();
|
|
|
|
|
|
|
|
|
|
// Box
|
|
|
|
|
|
2014-04-17 04:18:25 +12:00
|
|
|
|
public OAuth2Info BoxOAuth2Info = null;
|
2014-04-17 11:34:31 +12:00
|
|
|
|
public BoxFileEntry BoxSelectedFolder = Box.RootFolder;
|
2013-11-03 23:53:49 +13:00
|
|
|
|
public bool BoxShare = true;
|
|
|
|
|
|
|
|
|
|
// Ge.tt
|
|
|
|
|
|
|
|
|
|
public Ge_ttLogin Ge_ttLogin = null;
|
|
|
|
|
|
|
|
|
|
// Localhostr
|
|
|
|
|
|
|
|
|
|
public string LocalhostrEmail = string.Empty;
|
|
|
|
|
public string LocalhostrPassword = string.Empty;
|
|
|
|
|
public bool LocalhostrDirectURL = true;
|
|
|
|
|
|
|
|
|
|
// FTP Server
|
|
|
|
|
|
|
|
|
|
public List<FTPAccount> FTPAccountList = new List<FTPAccount>();
|
|
|
|
|
public int FTPSelectedImage = 0;
|
|
|
|
|
public int FTPSelectedText = 0;
|
|
|
|
|
public int FTPSelectedFile = 0;
|
|
|
|
|
|
|
|
|
|
// Shared Folder
|
|
|
|
|
|
|
|
|
|
public List<LocalhostAccount> LocalhostAccountList = new List<LocalhostAccount>();
|
|
|
|
|
public int LocalhostSelectedImages = 0;
|
|
|
|
|
public int LocalhostSelectedText = 0;
|
|
|
|
|
public int LocalhostSelectedFiles = 0;
|
|
|
|
|
|
|
|
|
|
// Email
|
|
|
|
|
|
|
|
|
|
public string EmailSmtpServer = "smtp.gmail.com";
|
|
|
|
|
public int EmailSmtpPort = 587;
|
|
|
|
|
public string EmailFrom = "...@gmail.com";
|
|
|
|
|
public string EmailPassword = string.Empty;
|
|
|
|
|
public bool EmailRememberLastTo = true;
|
|
|
|
|
public bool EmailConfirmSend = true;
|
|
|
|
|
public string EmailLastTo = string.Empty;
|
2014-10-18 01:19:28 +13:00
|
|
|
|
public string EmailDefaultSubject = "Sending email from ShareX";
|
2013-11-03 23:53:49 +13:00
|
|
|
|
public string EmailDefaultBody = "Screenshot is attached.";
|
|
|
|
|
|
|
|
|
|
// Jira
|
|
|
|
|
|
|
|
|
|
public string JiraHost = "http://";
|
|
|
|
|
public string JiraIssuePrefix = "PROJECT-";
|
|
|
|
|
public OAuthInfo JiraOAuthInfo = null;
|
|
|
|
|
|
|
|
|
|
// Mega
|
|
|
|
|
|
|
|
|
|
public MegaApiClient.AuthInfos MegaAuthInfos = null;
|
|
|
|
|
public string MegaParentNodeId = null;
|
|
|
|
|
|
2014-03-27 05:56:05 +13:00
|
|
|
|
// Amazon S3
|
|
|
|
|
|
2014-03-29 01:55:41 +13:00
|
|
|
|
public AmazonS3Settings AmazonS3Settings = new AmazonS3Settings()
|
|
|
|
|
{
|
2014-04-16 07:30:46 +12:00
|
|
|
|
ObjectPrefix = "ShareX/%y/%mo",
|
2014-03-27 05:56:05 +13:00
|
|
|
|
UseReducedRedundancyStorage = true
|
|
|
|
|
};
|
|
|
|
|
|
2014-07-07 06:45:36 +12:00
|
|
|
|
// ownCloud
|
|
|
|
|
|
|
|
|
|
public string OwnCloudHost = "";
|
|
|
|
|
public string OwnCloudUsername = "";
|
|
|
|
|
public string OwnCloudPassword = "";
|
|
|
|
|
public string OwnCloudPath = "/";
|
2014-07-07 07:51:17 +12:00
|
|
|
|
public bool OwnCloudCreateShare = true;
|
2014-07-07 09:06:37 +12:00
|
|
|
|
public bool OwnCloudDirectLink = false;
|
2014-08-11 00:43:47 +12:00
|
|
|
|
public bool OwnCloudIgnoreInvalidCert = false;
|
2014-07-07 06:45:36 +12:00
|
|
|
|
|
2014-07-23 10:32:14 +12:00
|
|
|
|
// MediaFire
|
|
|
|
|
|
|
|
|
|
public string MediaFireUsername = "";
|
|
|
|
|
public string MediaFirePassword = "";
|
|
|
|
|
public string MediaFirePath = "";
|
2014-07-23 13:59:45 +12:00
|
|
|
|
public bool MediaFireUseLongLink = false;
|
2014-07-23 10:32:14 +12:00
|
|
|
|
|
2014-09-04 23:11:42 +12:00
|
|
|
|
// Pushbullet
|
|
|
|
|
|
|
|
|
|
public PushbulletSettings PushbulletSettings = new PushbulletSettings();
|
|
|
|
|
|
2014-08-09 14:05:56 +12:00
|
|
|
|
// MediaCrush
|
|
|
|
|
|
|
|
|
|
public bool MediaCrushDirectLink = false;
|
|
|
|
|
|
2013-11-03 23:53:49 +13:00
|
|
|
|
#endregion File uploaders
|
|
|
|
|
|
|
|
|
|
#region URL shorteners
|
|
|
|
|
|
2013-12-21 04:59:26 +13:00
|
|
|
|
// bit.ly
|
|
|
|
|
|
|
|
|
|
public OAuth2Info BitlyOAuth2Info = null;
|
2014-06-18 08:10:31 +12:00
|
|
|
|
public string BitlyDomain = string.Empty;
|
2013-12-21 04:59:26 +13:00
|
|
|
|
|
|
|
|
|
// Google URL Shortener
|
|
|
|
|
|
2013-11-03 23:53:49 +13:00
|
|
|
|
public AccountType GoogleURLShortenerAccountType = AccountType.Anonymous;
|
|
|
|
|
public OAuth2Info GoogleURLShortenerOAuth2Info = null;
|
|
|
|
|
|
2014-01-20 14:04:03 +13:00
|
|
|
|
// yourls.org
|
|
|
|
|
|
|
|
|
|
public string YourlsAPIURL = "http://yoursite.com/yourls-api.php";
|
|
|
|
|
public string YourlsSignature = string.Empty;
|
|
|
|
|
public string YourlsUsername = string.Empty;
|
|
|
|
|
public string YourlsPassword = string.Empty;
|
|
|
|
|
|
2014-07-13 23:10:42 +12:00
|
|
|
|
// adf.ly
|
2014-07-14 07:56:31 +12:00
|
|
|
|
public string AdFlyAPIKEY = String.Empty;
|
|
|
|
|
public string AdFlyAPIUID = String.Empty;
|
2014-07-13 23:10:42 +12:00
|
|
|
|
|
2013-11-03 23:53:49 +13:00
|
|
|
|
#endregion URL shorteners
|
|
|
|
|
|
2014-07-12 05:41:39 +12:00
|
|
|
|
#region URL sharing services
|
2013-11-03 23:53:49 +13:00
|
|
|
|
|
|
|
|
|
// Twitter
|
|
|
|
|
|
|
|
|
|
public List<OAuthInfo> TwitterOAuthInfoList = new List<OAuthInfo>();
|
|
|
|
|
public int TwitterSelectedAccount = 0;
|
|
|
|
|
|
2014-07-12 05:41:39 +12:00
|
|
|
|
#endregion URL sharing services
|
2013-11-03 23:53:49 +13:00
|
|
|
|
|
|
|
|
|
#region Custom Uploaders
|
|
|
|
|
|
|
|
|
|
public List<CustomUploaderItem> CustomUploadersList = new List<CustomUploaderItem>();
|
|
|
|
|
public int CustomImageUploaderSelected = 0;
|
|
|
|
|
public int CustomTextUploaderSelected = 0;
|
|
|
|
|
public int CustomFileUploaderSelected = 0;
|
|
|
|
|
public int CustomURLShortenerSelected = 0;
|
|
|
|
|
|
|
|
|
|
#endregion Custom Uploaders
|
|
|
|
|
|
|
|
|
|
#region Helper Methods
|
|
|
|
|
|
2014-07-12 05:41:39 +12:00
|
|
|
|
public bool IsValid<T>(int index)
|
2013-11-03 23:53:49 +13:00
|
|
|
|
{
|
|
|
|
|
Enum destination = (Enum)Enum.ToObject(typeof(T), index);
|
|
|
|
|
|
|
|
|
|
if (destination is ImageDestination)
|
|
|
|
|
{
|
2014-07-12 05:41:39 +12:00
|
|
|
|
return IsValid((ImageDestination)destination);
|
2013-11-03 23:53:49 +13:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (destination is TextDestination)
|
|
|
|
|
{
|
2014-07-12 05:41:39 +12:00
|
|
|
|
return IsValid((TextDestination)destination);
|
2013-11-03 23:53:49 +13:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (destination is FileDestination)
|
|
|
|
|
{
|
2014-07-12 05:41:39 +12:00
|
|
|
|
return IsValid((FileDestination)destination);
|
2013-11-03 23:53:49 +13:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (destination is UrlShortenerType)
|
|
|
|
|
{
|
2014-07-12 05:41:39 +12:00
|
|
|
|
return IsValid((UrlShortenerType)destination);
|
2013-11-03 23:53:49 +13:00
|
|
|
|
}
|
|
|
|
|
|
2014-07-13 18:33:52 +12:00
|
|
|
|
/*
|
2014-07-11 13:52:53 +12:00
|
|
|
|
if (destination is URLSharingServices)
|
2013-11-03 23:53:49 +13:00
|
|
|
|
{
|
2014-07-12 05:41:39 +12:00
|
|
|
|
return IsValid((URLSharingServices)destination);
|
2013-11-03 23:53:49 +13:00
|
|
|
|
}
|
2014-07-13 18:33:52 +12:00
|
|
|
|
*/
|
2013-11-03 23:53:49 +13:00
|
|
|
|
|
|
|
|
|
return true;
|
|
|
|
|
}
|
|
|
|
|
|
2014-07-12 05:41:39 +12:00
|
|
|
|
public bool IsValid(ImageDestination destination)
|
2013-11-03 23:53:49 +13:00
|
|
|
|
{
|
|
|
|
|
switch (destination)
|
|
|
|
|
{
|
2014-06-17 03:24:30 +12:00
|
|
|
|
case ImageDestination.Imgur:
|
|
|
|
|
return ImgurAccountType == AccountType.Anonymous || OAuth2Info.CheckOAuth(ImgurOAuth2Info);
|
2013-11-03 23:53:49 +13:00
|
|
|
|
case ImageDestination.ImageShack:
|
2014-06-17 00:44:22 +12:00
|
|
|
|
return ImageShackSettings != null && !string.IsNullOrEmpty(ImageShackSettings.Auth_token);
|
2013-11-03 23:53:49 +13:00
|
|
|
|
case ImageDestination.TinyPic:
|
|
|
|
|
return TinyPicAccountType == AccountType.Anonymous || !string.IsNullOrEmpty(TinyPicRegistrationCode);
|
|
|
|
|
case ImageDestination.Flickr:
|
|
|
|
|
return !string.IsNullOrEmpty(FlickrAuthInfo.Token);
|
|
|
|
|
case ImageDestination.Photobucket:
|
|
|
|
|
return PhotobucketAccountInfo != null && OAuthInfo.CheckOAuth(PhotobucketOAuthInfo);
|
|
|
|
|
case ImageDestination.Picasa:
|
|
|
|
|
return OAuth2Info.CheckOAuth(PicasaOAuth2Info);
|
2014-06-15 22:29:09 +12:00
|
|
|
|
case ImageDestination.Twitter:
|
2014-06-17 03:24:30 +12:00
|
|
|
|
return TwitterOAuthInfoList != null && TwitterOAuthInfoList.IsValidIndex(TwitterSelectedAccount) && OAuthInfo.CheckOAuth(TwitterOAuthInfoList[TwitterSelectedAccount]);
|
2013-11-03 23:53:49 +13:00
|
|
|
|
case ImageDestination.CustomImageUploader:
|
|
|
|
|
return CustomUploadersList != null && CustomUploadersList.IsValidIndex(CustomImageUploaderSelected);
|
|
|
|
|
}
|
2014-06-17 03:24:30 +12:00
|
|
|
|
|
|
|
|
|
return true;
|
2013-11-03 23:53:49 +13:00
|
|
|
|
}
|
|
|
|
|
|
2014-07-12 05:41:39 +12:00
|
|
|
|
public bool IsValid(TextDestination destination)
|
2013-11-03 23:53:49 +13:00
|
|
|
|
{
|
|
|
|
|
switch (destination)
|
|
|
|
|
{
|
|
|
|
|
case TextDestination.CustomTextUploader:
|
|
|
|
|
return CustomUploadersList != null && CustomUploadersList.IsValidIndex(CustomTextUploaderSelected);
|
|
|
|
|
}
|
2014-06-17 03:24:30 +12:00
|
|
|
|
|
|
|
|
|
return true;
|
2013-11-03 23:53:49 +13:00
|
|
|
|
}
|
|
|
|
|
|
2014-07-12 05:41:39 +12:00
|
|
|
|
public bool IsValid(FileDestination destination)
|
2013-11-03 23:53:49 +13:00
|
|
|
|
{
|
|
|
|
|
switch (destination)
|
|
|
|
|
{
|
|
|
|
|
case FileDestination.Dropbox:
|
2014-06-09 07:11:44 +12:00
|
|
|
|
return OAuth2Info.CheckOAuth(DropboxOAuth2Info);
|
2014-06-06 06:19:45 +12:00
|
|
|
|
case FileDestination.Copy:
|
|
|
|
|
return OAuthInfo.CheckOAuth(CopyOAuthInfo);
|
2013-11-03 23:53:49 +13:00
|
|
|
|
case FileDestination.GoogleDrive:
|
|
|
|
|
return OAuth2Info.CheckOAuth(GoogleDriveOAuth2Info);
|
|
|
|
|
case FileDestination.RapidShare:
|
|
|
|
|
return !string.IsNullOrEmpty(RapidShareUsername) && !string.IsNullOrEmpty(RapidSharePassword);
|
|
|
|
|
case FileDestination.SendSpace:
|
|
|
|
|
return SendSpaceAccountType == AccountType.Anonymous || (!string.IsNullOrEmpty(SendSpaceUsername) && !string.IsNullOrEmpty(SendSpacePassword));
|
|
|
|
|
case FileDestination.Minus:
|
|
|
|
|
return MinusConfig != null && MinusConfig.MinusUser != null;
|
|
|
|
|
case FileDestination.Box:
|
2014-04-17 04:18:25 +12:00
|
|
|
|
return OAuth2Info.CheckOAuth(BoxOAuth2Info);
|
2013-11-03 23:53:49 +13:00
|
|
|
|
case FileDestination.Ge_tt:
|
|
|
|
|
return Ge_ttLogin != null && !string.IsNullOrEmpty(Ge_ttLogin.AccessToken);
|
|
|
|
|
case FileDestination.Localhostr:
|
|
|
|
|
return !string.IsNullOrEmpty(LocalhostrEmail) && !string.IsNullOrEmpty(LocalhostrPassword);
|
|
|
|
|
case FileDestination.CustomFileUploader:
|
|
|
|
|
return CustomUploadersList != null && CustomUploadersList.IsValidIndex(CustomFileUploaderSelected);
|
|
|
|
|
case FileDestination.FTP:
|
|
|
|
|
return FTPAccountList != null && FTPAccountList.IsValidIndex(FTPSelectedFile);
|
|
|
|
|
case FileDestination.SharedFolder:
|
|
|
|
|
return LocalhostAccountList != null && LocalhostAccountList.IsValidIndex(LocalhostSelectedFiles);
|
|
|
|
|
case FileDestination.Email:
|
|
|
|
|
return !string.IsNullOrEmpty(EmailSmtpServer) && EmailSmtpPort > 0 && !string.IsNullOrEmpty(EmailFrom) && !string.IsNullOrEmpty(EmailPassword);
|
|
|
|
|
case FileDestination.Jira:
|
|
|
|
|
return OAuthInfo.CheckOAuth(JiraOAuthInfo);
|
|
|
|
|
case FileDestination.Mega:
|
2014-03-26 12:03:52 +13:00
|
|
|
|
return MegaAuthInfos != null && MegaAuthInfos.Email != null && MegaAuthInfos.Hash != null && MegaAuthInfos.PasswordAesKey != null;
|
2014-03-30 22:16:20 +13:00
|
|
|
|
case FileDestination.Pushbullet:
|
2014-03-30 23:28:34 +13:00
|
|
|
|
return PushbulletSettings != null && !string.IsNullOrEmpty(PushbulletSettings.UserAPIKey) && PushbulletSettings.DeviceList != null &&
|
2014-03-31 00:37:38 +13:00
|
|
|
|
PushbulletSettings.DeviceList.IsValidIndex(PushbulletSettings.SelectedDevice);
|
2014-07-12 05:41:39 +12:00
|
|
|
|
case FileDestination.OwnCloud:
|
|
|
|
|
return !string.IsNullOrEmpty(OwnCloudHost) && !string.IsNullOrEmpty(OwnCloudUsername) && !string.IsNullOrEmpty(OwnCloudPassword);
|
2014-07-23 10:32:14 +12:00
|
|
|
|
case FileDestination.MediaFire:
|
|
|
|
|
return !string.IsNullOrEmpty(MediaFireUsername) && !string.IsNullOrEmpty(MediaFirePassword);
|
2013-11-03 23:53:49 +13:00
|
|
|
|
}
|
2014-06-17 03:24:30 +12:00
|
|
|
|
|
|
|
|
|
return true;
|
2013-11-03 23:53:49 +13:00
|
|
|
|
}
|
|
|
|
|
|
2014-07-12 05:41:39 +12:00
|
|
|
|
public bool IsValid(UrlShortenerType destination)
|
2013-11-03 23:53:49 +13:00
|
|
|
|
{
|
|
|
|
|
switch (destination)
|
|
|
|
|
{
|
|
|
|
|
case UrlShortenerType.Google:
|
|
|
|
|
return GoogleURLShortenerAccountType == AccountType.Anonymous || OAuth2Info.CheckOAuth(GoogleURLShortenerOAuth2Info);
|
2013-12-21 04:59:26 +13:00
|
|
|
|
case UrlShortenerType.BITLY:
|
|
|
|
|
return OAuth2Info.CheckOAuth(BitlyOAuth2Info);
|
2014-01-20 15:49:14 +13:00
|
|
|
|
case UrlShortenerType.YOURLS:
|
|
|
|
|
return !string.IsNullOrEmpty(YourlsAPIURL) && (!string.IsNullOrEmpty(YourlsSignature) || (!string.IsNullOrEmpty(YourlsUsername) && !string.IsNullOrEmpty(YourlsPassword)));
|
2014-07-14 07:56:31 +12:00
|
|
|
|
case UrlShortenerType.AdFly:
|
|
|
|
|
return !string.IsNullOrEmpty(AdFlyAPIKEY) && !string.IsNullOrEmpty(AdFlyAPIUID);
|
2013-11-03 23:53:49 +13:00
|
|
|
|
case UrlShortenerType.CustomURLShortener:
|
|
|
|
|
return CustomUploadersList != null && CustomUploadersList.IsValidIndex(CustomURLShortenerSelected);
|
|
|
|
|
}
|
2014-06-17 03:24:30 +12:00
|
|
|
|
|
|
|
|
|
return true;
|
2013-11-03 23:53:49 +13:00
|
|
|
|
}
|
|
|
|
|
|
2014-07-12 05:41:39 +12:00
|
|
|
|
public bool IsValid(URLSharingServices destination)
|
2013-11-03 23:53:49 +13:00
|
|
|
|
{
|
|
|
|
|
switch (destination)
|
|
|
|
|
{
|
2014-07-12 05:41:39 +12:00
|
|
|
|
case URLSharingServices.Email:
|
|
|
|
|
return !string.IsNullOrEmpty(EmailSmtpServer) && EmailSmtpPort > 0 && !string.IsNullOrEmpty(EmailFrom) && !string.IsNullOrEmpty(EmailPassword);
|
2014-07-11 13:52:53 +12:00
|
|
|
|
case URLSharingServices.Twitter:
|
2014-06-17 03:24:30 +12:00
|
|
|
|
return TwitterOAuthInfoList != null && TwitterOAuthInfoList.IsValidIndex(TwitterSelectedAccount) && OAuthInfo.CheckOAuth(TwitterOAuthInfoList[TwitterSelectedAccount]);
|
2014-09-04 23:11:42 +12:00
|
|
|
|
case URLSharingServices.Pushbullet:
|
|
|
|
|
return PushbulletSettings != null && !string.IsNullOrEmpty(PushbulletSettings.UserAPIKey) && PushbulletSettings.DeviceList != null &&
|
|
|
|
|
PushbulletSettings.DeviceList.IsValidIndex(PushbulletSettings.SelectedDevice);
|
2013-11-03 23:53:49 +13:00
|
|
|
|
}
|
2014-06-17 03:24:30 +12:00
|
|
|
|
|
|
|
|
|
return true;
|
2013-11-03 23:53:49 +13:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int GetFTPIndex(EDataType dataType)
|
|
|
|
|
{
|
|
|
|
|
switch (dataType)
|
|
|
|
|
{
|
|
|
|
|
case EDataType.Image:
|
|
|
|
|
return FTPSelectedImage;
|
|
|
|
|
case EDataType.Text:
|
|
|
|
|
return FTPSelectedText;
|
2014-07-12 05:41:39 +12:00
|
|
|
|
default:
|
|
|
|
|
case EDataType.File:
|
|
|
|
|
return FTPSelectedFile;
|
2013-11-03 23:53:49 +13:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int GetLocalhostIndex(EDataType dataType)
|
|
|
|
|
{
|
|
|
|
|
switch (dataType)
|
|
|
|
|
{
|
|
|
|
|
case EDataType.Image:
|
|
|
|
|
return LocalhostSelectedImages;
|
|
|
|
|
case EDataType.Text:
|
|
|
|
|
return LocalhostSelectedText;
|
2014-07-12 05:41:39 +12:00
|
|
|
|
default:
|
|
|
|
|
case EDataType.File:
|
|
|
|
|
return LocalhostSelectedFiles;
|
2013-11-03 23:53:49 +13:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#endregion Helper Methods
|
|
|
|
|
}
|
|
|
|
|
}
|