Example #1
0
        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.CustomURLShortener:
                return(CustomUploadersList != null && CustomUploadersList.IsValidIndex(CustomURLShortenerSelected));
            }

            return(true);
        }
Example #2
0
        public bool IsValid(ImageDestination destination)
        {
            ImageUploaderService service = UploaderFactory.GetImageUploaderServiceByEnum(destination);

            if (service != null)
            {
                return(service.CheckConfig(this));
            }

            switch (destination)
            {
            case ImageDestination.ImageShack:
                return(ImageShackSettings != null && !string.IsNullOrEmpty(ImageShackSettings.Auth_token));

            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));

            case ImageDestination.Twitter:
                return(TwitterOAuthInfoList != null && TwitterOAuthInfoList.IsValidIndex(TwitterSelectedAccount) && OAuthInfo.CheckOAuth(TwitterOAuthInfoList[TwitterSelectedAccount]));

            case ImageDestination.Chevereto:
                return(CheveretoUploader != null && !string.IsNullOrEmpty(CheveretoUploader.UploadURL) && !string.IsNullOrEmpty(CheveretoUploader.APIKey));

            case ImageDestination.CustomImageUploader:
                return(CustomUploadersList != null && CustomUploadersList.IsValidIndex(CustomImageUploaderSelected));
            }

            return(true);
        }
        private void ImgurAuthOpen()
        {
            try
            {
                OAuth2Info oauth = new OAuth2Info(APIKeys.ImgurClientID, APIKeys.ImgurClientSecret);

                string url = new Imgur(oauth).GetAuthorizationURL();

                if (!string.IsNullOrEmpty(url))
                {
                    Config.ImgurOAuth2Info = oauth;
                    URLHelpers.OpenURL(url);
                    DebugHelper.WriteLine("ImgurAuthOpen - Authorization URL is opened: " + url);
                }
                else
                {
                    DebugHelper.WriteLine("ImgurAuthOpen - Authorization URL is empty.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), Resources.UploadersConfigForm_Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #4
0
        public bool IsValid(FileDestination destination)
        {
            switch (destination)
            {
            case FileDestination.Dropbox:
                return(OAuth2Info.CheckOAuth(DropboxOAuth2Info));

            case FileDestination.Copy:
                return(OAuthInfo.CheckOAuth(CopyOAuthInfo));

            case FileDestination.GoogleDrive:
                return(OAuth2Info.CheckOAuth(GoogleDriveOAuth2Info));

            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:
                return(OAuth2Info.CheckOAuth(BoxOAuth2Info));

            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:
                return(MegaAuthInfos != null && MegaAuthInfos.Email != null && MegaAuthInfos.Hash != null && MegaAuthInfos.PasswordAesKey != null);

            case FileDestination.Pushbullet:
                return(PushbulletSettings != null && !string.IsNullOrEmpty(PushbulletSettings.UserAPIKey) && PushbulletSettings.DeviceList != null &&
                       PushbulletSettings.DeviceList.IsValidIndex(PushbulletSettings.SelectedDevice));

            case FileDestination.OwnCloud:
                return(!string.IsNullOrEmpty(OwnCloudHost) && !string.IsNullOrEmpty(OwnCloudUsername) && !string.IsNullOrEmpty(OwnCloudPassword));

            case FileDestination.MediaFire:
                return(!string.IsNullOrEmpty(MediaFireUsername) && !string.IsNullOrEmpty(MediaFirePassword));

            case FileDestination.Lambda:
                return(LambdaSettings != null && !string.IsNullOrEmpty(LambdaSettings.UserAPIKey));
            }

            return(true);
        }
Example #5
0
 public GoogleOAuth2(OAuth2Info oauth, Uploader uploader)
 {
     AuthInfo       = oauth;
     GoogleUploader = uploader;
 }
        public void GistAuthOpen()
        {
            try
            {
                OAuth2Info oauth = new OAuth2Info(APIKeys.GitHubID, APIKeys.GitHubSecret);
                string url = new GitHubGist(oauth).GetAuthorizationURL();

                if (!string.IsNullOrEmpty(url))
                {
                    Config.GistOAuth2Info = oauth;
                    URLHelpers.OpenURL(url);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), Resources.UploadersConfigForm_Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        public void DropboxAuthOpen()
        {
            try
            {
                OAuth2Info oauth = new OAuth2Info(APIKeys.DropboxConsumerKey, APIKeys.DropboxConsumerSecret);

                string url = new Dropbox(oauth).GetAuthorizationURL();

                if (!string.IsNullOrEmpty(url))
                {
                    Config.DropboxOAuth2Info = oauth;
                    URLHelpers.OpenURL(url);
                    DebugHelper.WriteLine("DropboxAuthOpen - Authorization URL is opened: " + url);
                }
                else
                {
                    DebugHelper.WriteLine("DropboxAuthOpen - Authorization URL is empty.");
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString(), Resources.UploadersConfigForm_Error, MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Example #8
0
 public static bool CheckOAuth(OAuth2Info oauth)
 {
     return(oauth != null && !string.IsNullOrEmpty(oauth.Client_ID) && !string.IsNullOrEmpty(oauth.Client_Secret) &&
            oauth.Token != null && !string.IsNullOrEmpty(oauth.Token.access_token));
 }
Example #9
0
        public bool IsValid(FileDestination destination)
        {
            FileUploaderService service = UploaderFactory.GetFileUploaderServiceByEnum(destination);

            if (service != null)
            {
                return(service.CheckConfig(this));
            }

            switch (destination)
            {
            case FileDestination.FTP:
                return(FTPAccountList != null && FTPAccountList.IsValidIndex(FTPSelectedFile));

            case FileDestination.OneDrive:
                return(OAuth2Info.CheckOAuth(OneDriveOAuth2Info));

            case FileDestination.GoogleDrive:
                return(OAuth2Info.CheckOAuth(GoogleDriveOAuth2Info));

            case FileDestination.Box:
                return(OAuth2Info.CheckOAuth(BoxOAuth2Info));

            case FileDestination.Mega:
                return(MegaAuthInfos != null && MegaAuthInfos.Email != null && MegaAuthInfos.Hash != null && MegaAuthInfos.PasswordAesKey != null);

            case FileDestination.AmazonS3:
                return(AmazonS3Settings != null && !string.IsNullOrEmpty(AmazonS3Settings.AccessKeyID) && !string.IsNullOrEmpty(AmazonS3Settings.SecretAccessKey) &&
                       !string.IsNullOrEmpty(AmazonS3Settings.Bucket) && AmazonS3.GetCurrentRegion(AmazonS3Settings) != AmazonS3.UnknownEndpoint);

            case FileDestination.OwnCloud:
                return(!string.IsNullOrEmpty(OwnCloudHost) && !string.IsNullOrEmpty(OwnCloudUsername) && !string.IsNullOrEmpty(OwnCloudPassword));

            case FileDestination.MediaFire:
                return(!string.IsNullOrEmpty(MediaFireUsername) && !string.IsNullOrEmpty(MediaFirePassword));

            case FileDestination.Pushbullet:
                return(PushbulletSettings != null && !string.IsNullOrEmpty(PushbulletSettings.UserAPIKey) && PushbulletSettings.DeviceList != null &&
                       PushbulletSettings.DeviceList.IsValidIndex(PushbulletSettings.SelectedDevice));

            case FileDestination.SendSpace:
                return(SendSpaceAccountType == AccountType.Anonymous || (!string.IsNullOrEmpty(SendSpaceUsername) && !string.IsNullOrEmpty(SendSpacePassword)));

            case FileDestination.Minus:
                return(MinusConfig != null && MinusConfig.MinusUser != null);

            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.Jira:
                return(OAuthInfo.CheckOAuth(JiraOAuthInfo));

            case FileDestination.Lambda:
                return(LambdaSettings != null && !string.IsNullOrEmpty(LambdaSettings.UserAPIKey));

            case FileDestination.Pomf:
                return(PomfUploader != null && !string.IsNullOrEmpty(PomfUploader.UploadURL));

            case FileDestination.Sul:
                return(!string.IsNullOrEmpty(SulAPIKey));

            case FileDestination.Seafile:
                return(!string.IsNullOrEmpty(SeafileAPIURL) && !string.IsNullOrEmpty(SeafileAuthToken) && !string.IsNullOrEmpty(SeafileRepoID));

            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.CustomFileUploader:
                return(CustomUploadersList != null && CustomUploadersList.IsValidIndex(CustomFileUploaderSelected));
            }

            return(true);
        }