2015-06-08 01:34:33 +12:00
#region License Information ( GPL v3 )
/ *
ShareX - A program that allows you to take screenshots and share any file type
2024-01-03 12:57:14 +13:00
Copyright ( c ) 2007 - 2024 ShareX Team
2015-06-08 01:34:33 +12: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 ;
using ShareX.HelpersLib ;
using ShareX.UploadersLib.FileUploaders ;
using ShareX.UploadersLib.ImageUploaders ;
using ShareX.UploadersLib.Properties ;
using ShareX.UploadersLib.TextUploaders ;
2018-05-17 13:14:17 +12:00
using ShareX.UploadersLib.URLShorteners ;
2016-02-15 19:53:30 +13:00
using System ;
using System.Collections.Generic ;
using System.Drawing ;
using System.Linq ;
using System.Windows.Forms ;
2015-06-08 01:34:33 +12:00
namespace ShareX.UploadersLib
{
2015-12-06 15:43:15 +13:00
public partial class UploadersConfigForm : Form
2015-06-08 01:34:33 +12:00
{
2017-01-17 06:57:40 +13:00
public static bool IsInstanceActive = > instance ! = null & & ! instance . IsDisposed ;
2016-04-30 20:30:03 +12:00
private static UploadersConfigForm instance ;
2015-06-08 01:34:33 +12:00
public UploadersConfig Config { get ; private set ; }
private ImageList uploadersImageList ;
2016-04-30 20:30:03 +12:00
private UploadersConfigForm ( UploadersConfig config )
2015-06-08 01:34:33 +12:00
{
2016-03-24 07:47:59 +13:00
Config = config ;
2019-06-24 00:00:04 +12:00
2015-06-08 01:34:33 +12:00
InitializeComponent ( ) ;
2024-01-17 20:12:48 +13:00
ShareXResources . ApplyTheme ( this , true ) ;
2019-06-24 00:00:04 +12:00
2016-04-30 10:26:49 +12:00
InitializeControls ( ) ;
2015-06-08 01:34:33 +12:00
}
2017-01-17 06:57:40 +13:00
public static UploadersConfigForm GetFormInstance ( UploadersConfig config )
2016-04-30 20:30:03 +12:00
{
2017-01-17 06:57:40 +13:00
if ( ! IsInstanceActive )
2016-04-30 20:30:03 +12:00
{
instance = new UploadersConfigForm ( config ) ;
}
return instance ;
}
2015-06-08 01:34:33 +12:00
private void UploadersConfigForm_Shown ( object sender , EventArgs e )
{
2015-09-03 02:54:24 +12:00
LoadSettings ( ) ;
2015-06-08 01:34:33 +12:00
}
private void UploadersConfigForm_Resize ( object sender , EventArgs e )
{
Refresh ( ) ;
}
2016-04-30 10:26:49 +12:00
private void InitializeControls ( )
2015-06-08 01:34:33 +12:00
{
2016-04-30 10:26:49 +12:00
if ( ! string . IsNullOrEmpty ( Config . FilePath ) )
{
Text + = " - " + Config . FilePath ;
}
2016-06-28 05:20:55 +12:00
AddIconToTabs ( ) ;
2015-06-08 01:34:33 +12:00
2020-02-05 00:46:52 +13:00
tttvMain . ImageList = uploadersImageList ;
tttvMain . MainTabControl = tcUploaders ;
2015-06-08 01:34:33 +12:00
2016-07-29 13:31:46 +12:00
CodeMenu . Create < CodeMenuEntryFilename > ( txtDropboxPath , CodeMenuEntryFilename . n , CodeMenuEntryFilename . t , CodeMenuEntryFilename . pn ) ;
CodeMenu . Create < CodeMenuEntryFilename > ( txtAmazonS3ObjectPrefix , CodeMenuEntryFilename . n , CodeMenuEntryFilename . t , CodeMenuEntryFilename . pn ) ;
CodeMenu . Create < CodeMenuEntryFilename > ( txtMediaFirePath , CodeMenuEntryFilename . n , CodeMenuEntryFilename . t , CodeMenuEntryFilename . pn ) ;
2018-04-21 09:16:46 +12:00
CodeMenu . Create < CodeMenuEntryFilename > ( txtGoogleCloudStorageObjectPrefix , CodeMenuEntryFilename . n , CodeMenuEntryFilename . t , CodeMenuEntryFilename . pn ) ;
2018-10-02 03:39:16 +13:00
CodeMenu . Create < CodeMenuEntryFilename > ( txtB2UploadPath , CodeMenuEntryFilename . n , CodeMenuEntryFilename . t , CodeMenuEntryFilename . pn ) ;
CodeMenu . Create < CodeMenuEntryFilename > ( txtB2CustomUrl , CodeMenuEntryFilename . n , CodeMenuEntryFilename . t , CodeMenuEntryFilename . pn ) ;
2017-08-19 07:50:47 +12:00
2019-01-09 10:31:11 +13:00
// FTP
cbFTPURLPathProtocol . Items . AddRange ( Helpers . GetEnumDescriptions < BrowserProtocol > ( ) ) ;
cbFTPSEncryption . Items . AddRange ( Enum . GetNames ( typeof ( FTPSEncryption ) ) ) ;
eiFTP . ObjectType = typeof ( FTPAccount ) ;
2018-10-02 03:39:16 +13:00
// Backblaze B2
2019-04-27 07:26:43 +12:00
txtB2Bucket . HandleCreated + = ( sender , e ) = > txtB2Bucket . SetWatermark ( Resources . txtB2BucketWatermark , true ) ;
2015-06-08 01:34:33 +12:00
}
2016-06-28 05:20:55 +12:00
private void AddIconToTabs ( )
2015-06-08 01:34:33 +12:00
{
2016-06-28 07:02:07 +12:00
uploadersImageList = new ImageList ( ) ;
uploadersImageList . ColorDepth = ColorDepth . Depth32Bit ;
2020-02-05 01:26:42 +13:00
uploadersImageList . Images . Add ( Resources . navigation_270_button_white ) ;
2016-06-28 05:20:55 +12:00
foreach ( IUploaderService uploaderService in UploaderFactory . AllServices )
{
TabPage tp = uploaderService . GetUploadersConfigTabPage ( this ) ;
2016-06-28 07:02:07 +12:00
if ( tp ! = null & & string . IsNullOrEmpty ( tp . ImageKey ) )
2016-06-28 05:20:55 +12:00
{
Icon icon = uploaderService . ServiceIcon ;
if ( icon ! = null )
{
uploadersImageList . Images . Add ( tp . Name , icon ) ;
tp . ImageKey = tp . Name ;
}
else
{
Image img = uploaderService . ServiceImage ;
if ( img ! = null )
{
uploadersImageList . Images . Add ( tp . Name , img ) ;
tp . ImageKey = tp . Name ;
}
}
}
}
2015-06-08 01:34:33 +12:00
}
2016-04-30 10:26:49 +12:00
public void NavigateToTabPage ( TabPage tp )
{
if ( tp ! = null )
{
2020-02-09 05:20:27 +13:00
tttvMain . NavigateToTabPage ( tp ) ;
2016-04-30 10:26:49 +12:00
}
}
2018-10-03 07:25:55 +13:00
private void LoadSettings ( )
2015-06-08 01:34:33 +12:00
{
2018-10-03 07:25:55 +13:00
LoadImageUploaderSettings ( ) ;
LoadTextUploaderSettings ( ) ;
LoadFileUploaderSettings ( ) ;
LoadURLShortenerSettings ( ) ;
LoadOtherUploaderSettings ( ) ;
}
2015-06-08 01:34:33 +12:00
2018-10-03 07:25:55 +13:00
private void LoadImageUploaderSettings ( )
{
2017-10-06 09:54:06 +13:00
#region Imgur
2015-06-08 01:34:33 +12:00
oauth2Imgur . Enabled = Config . ImgurAccountType = = AccountType . User ;
if ( OAuth2Info . CheckOAuth ( Config . ImgurOAuth2Info ) )
{
oauth2Imgur . Status = OAuthLoginStatus . LoginSuccessful ;
btnImgurRefreshAlbumList . Enabled = true ;
}
atcImgurAccountType . SelectedAccountType = Config . ImgurAccountType ;
cbImgurDirectLink . Checked = Config . ImgurDirectLink ;
cbImgurThumbnailType . Items . Clear ( ) ;
2017-10-01 18:05:53 +13:00
cbImgurThumbnailType . Items . AddRange ( Helpers . GetLocalizedEnumDescriptions < ImgurThumbnailType > ( ) ) ;
2015-06-08 01:34:33 +12:00
cbImgurThumbnailType . SelectedIndex = ( int ) Config . ImgurThumbnailType ;
2015-08-08 23:38:37 +12:00
cbImgurUseGIFV . Checked = Config . ImgurUseGIFV ;
2015-06-08 01:34:33 +12:00
cbImgurUploadSelectedAlbum . Checked = Config . ImgurUploadSelectedAlbum ;
ImgurFillAlbumList ( ) ;
2018-03-01 11:52:11 +13:00
#endregion Imgur
2017-10-06 09:54:06 +13:00
#region ImageShack
2015-06-08 01:34:33 +12:00
txtImageShackUsername . Text = Config . ImageShackSettings . Username ;
txtImageShackPassword . Text = Config . ImageShackSettings . Password ;
cbImageShackIsPublic . Checked = Config . ImageShackSettings . IsPublic ;
2018-03-01 11:52:11 +13:00
#endregion ImageShack
2017-10-06 09:54:06 +13:00
#region Flickr
2015-06-08 01:34:33 +12:00
2017-10-04 14:29:39 +13:00
if ( OAuthInfo . CheckOAuth ( Config . FlickrOAuthInfo ) )
{
oauthFlickr . Status = OAuthLoginStatus . LoginSuccessful ;
}
2017-10-09 20:14:02 +13:00
cbFlickrDirectLink . Checked = Config . FlickrSettings . DirectLink ;
2018-03-01 11:52:11 +13:00
#endregion Flickr
2017-10-06 09:54:06 +13:00
#region Photobucket
2015-06-08 01:34:33 +12:00
if ( OAuthInfo . CheckOAuth ( Config . PhotobucketOAuthInfo ) )
{
lblPhotobucketAccountStatus . Text = Resources . UploadersConfigForm_Login_successful ;
}
if ( Config . PhotobucketAccountInfo ! = null )
{
2019-09-20 19:48:45 +12:00
txtPhotobucketDefaultAlbumName . Text = Config . PhotobucketAccountInfo . AlbumID ;
lblPhotobucketParentAlbumPath . Text = Resources . UploadersConfigForm_LoadSettings_Parent_album_path_e_g_ + " " +
Config . PhotobucketAccountInfo . AlbumID + "/Personal/" + DateTime . Now . Year ;
2021-08-30 22:01:36 +12:00
cbPhotobucketAlbumPaths . Items . Clear ( ) ;
2015-06-08 01:34:33 +12:00
if ( Config . PhotobucketAccountInfo . AlbumList . Count > 0 )
{
2021-08-30 22:01:36 +12:00
cbPhotobucketAlbumPaths . Items . AddRange ( Config . PhotobucketAccountInfo . AlbumList . ToArray ( ) ) ;
cbPhotobucketAlbumPaths . SelectedIndex = Config . PhotobucketAccountInfo . ActiveAlbumID .
2015-06-08 01:34:33 +12:00
BetweenOrDefault ( 0 , Config . PhotobucketAccountInfo . AlbumList . Count - 1 ) ;
}
}
2018-03-01 11:52:11 +13:00
#endregion Photobucket
2017-10-06 09:54:06 +13:00
#region Google Photos
2015-06-08 01:34:33 +12:00
2022-12-11 02:10:35 +13:00
oauth2GooglePhotos . UpdateStatus ( Config . GooglePhotosOAuth2Info , Config . GooglePhotosUserInfo ) ;
btnPicasaRefreshAlbumList . Enabled = oauth2GooglePhotos . Connected ;
2015-06-08 01:34:33 +12:00
2019-01-22 20:57:43 +13:00
cbGooglePhotosIsPublic . Checked = Config . GooglePhotosIsPublic ;
2022-12-10 22:51:49 +13:00
txtPicasaAlbumID . Text = Config . GooglePhotosAlbumID ;
2015-06-08 01:34:33 +12:00
2018-03-01 11:52:11 +13:00
#endregion Google Photos
2017-10-06 09:54:06 +13:00
#region Chevereto
2015-06-08 01:34:33 +12:00
2016-02-18 23:10:30 +13:00
if ( Config . CheveretoUploader = = null ) Config . CheveretoUploader = new CheveretoUploader ( ) ;
txtCheveretoUploadURL . Text = Config . CheveretoUploader . UploadURL ;
txtCheveretoAPIKey . Text = Config . CheveretoUploader . APIKey ;
2015-06-08 01:34:33 +12:00
cbCheveretoDirectURL . Checked = Config . CheveretoDirectURL ;
2018-03-01 11:52:11 +13:00
#endregion Chevereto
2017-10-06 09:54:06 +13:00
#region vgy . me
2016-02-14 13:28:41 +13:00
txtVgymeUserKey . Text = Config . VgymeUserKey ;
2018-03-01 11:52:11 +13:00
#endregion vgy . me
2018-10-03 07:25:55 +13:00
}
2017-10-06 09:54:06 +13:00
2018-10-03 07:25:55 +13:00
private void LoadTextUploaderSettings ( )
{
2017-10-06 09:54:06 +13:00
#region Pastebin
2015-06-08 01:34:33 +12:00
txtPastebinUsername . Text = Config . PastebinSettings . Username ;
txtPastebinPassword . Text = Config . PastebinSettings . Password ;
UpdatePastebinStatus ( ) ;
2017-10-01 18:05:53 +13:00
cbPastebinPrivacy . Items . AddRange ( Helpers . GetLocalizedEnumDescriptions < PastebinPrivacy > ( ) ) ;
2015-06-08 01:34:33 +12:00
cbPastebinPrivacy . SelectedIndex = ( int ) Config . PastebinSettings . Exposure ;
2017-10-01 18:05:53 +13:00
cbPastebinExpiration . Items . AddRange ( Helpers . GetLocalizedEnumDescriptions < PastebinExpiration > ( ) ) ;
2015-06-08 01:34:33 +12:00
cbPastebinExpiration . SelectedIndex = ( int ) Config . PastebinSettings . Expiration ;
cbPastebinSyntax . Items . AddRange ( Pastebin . GetSyntaxList ( ) . ToArray ( ) ) ;
cbPastebinSyntax . SelectedIndex = 0 ;
for ( int i = 0 ; i < cbPastebinSyntax . Items . Count ; i + + )
{
PastebinSyntaxInfo pastebinSyntaxInfo = ( PastebinSyntaxInfo ) cbPastebinSyntax . Items [ i ] ;
2022-10-15 12:10:59 +13:00
if ( pastebinSyntaxInfo . Value . Equals ( Config . PastebinSettings . TextFormat , StringComparison . OrdinalIgnoreCase ) )
2015-06-08 01:34:33 +12:00
{
cbPastebinSyntax . SelectedIndex = i ;
break ;
}
}
txtPastebinTitle . Text = Config . PastebinSettings . Title ;
2016-03-19 01:08:24 +13:00
cbPastebinRaw . Checked = Config . PastebinSettings . RawURL ;
2015-06-08 01:34:33 +12:00
2018-03-01 11:52:11 +13:00
#endregion Pastebin
2017-10-06 09:54:06 +13:00
#region Paste . ee
2015-06-08 01:34:33 +12:00
2017-10-03 06:15:54 +13:00
txtPaste_eeUserAPIKey . Text = Config . Paste_eeUserKey ;
2015-06-08 01:34:33 +12:00
2018-03-01 11:52:11 +13:00
#endregion Paste . ee
2017-10-06 09:54:06 +13:00
#region Gist
2015-06-08 01:34:33 +12:00
if ( OAuth2Info . CheckOAuth ( Config . GistOAuth2Info ) )
{
oAuth2Gist . Status = OAuthLoginStatus . LoginSuccessful ;
}
2016-03-19 01:08:24 +13:00
cbGistPublishPublic . Checked = Config . GistPublishPublic ;
cbGistUseRawURL . Checked = Config . GistRawURL ;
2017-03-06 02:05:59 +13:00
txtGistCustomURL . Text = Config . GistCustomURL ;
2016-03-19 01:08:24 +13:00
2018-03-01 11:52:11 +13:00
#endregion Gist
2017-10-06 09:54:06 +13:00
#region Upaste
2015-06-08 01:34:33 +12:00
txtUpasteUserKey . Text = Config . UpasteUserKey ;
cbUpasteIsPublic . Checked = Config . UpasteIsPublic ;
2018-03-01 11:52:11 +13:00
#endregion Upaste
2017-10-06 09:54:06 +13:00
#region Hastebin
2015-06-08 01:34:33 +12:00
txtHastebinCustomDomain . Text = Config . HastebinCustomDomain ;
txtHastebinSyntaxHighlighting . Text = Config . HastebinSyntaxHighlighting ;
2016-07-04 17:07:49 +12:00
cbHastebinUseFileExtension . Checked = Config . HastebinUseFileExtension ;
2015-06-08 01:34:33 +12:00
2018-03-01 11:52:11 +13:00
#endregion Hastebin
2017-10-06 09:54:06 +13:00
#region OneTimeSecret
2015-08-08 22:11:19 +12:00
txtOneTimeSecretEmail . Text = Config . OneTimeSecretAPIUsername ;
txtOneTimeSecretAPIKey . Text = Config . OneTimeSecretAPIKey ;
2018-03-01 11:52:11 +13:00
#endregion OneTimeSecret
2017-10-06 09:54:06 +13:00
#region Pastie
2016-12-08 12:58:45 +13:00
cbPastieIsPublic . Checked = Config . PastieIsPublic ;
2018-03-01 11:52:11 +13:00
#endregion Pastie
2018-10-03 07:25:55 +13:00
}
2017-10-06 09:54:06 +13:00
2018-10-03 07:25:55 +13:00
private void LoadFileUploaderSettings ( )
{
2017-10-06 09:54:06 +13:00
#region FTP
2016-06-12 08:19:29 +12:00
2017-09-14 04:21:24 +12:00
if ( Config . FTPAccountList = = null )
{
Config . FTPAccountList = new List < FTPAccount > ( ) ;
}
FTPUpdateControls ( ) ;
if ( Config . FTPAccountList . Count = = 0 )
2016-06-12 08:19:29 +12:00
{
2017-04-21 04:38:20 +12:00
FTPClearFields ( ) ;
2016-06-12 08:19:29 +12:00
}
else
{
2017-04-21 04:38:20 +12:00
cbFTPAccounts . SelectedIndex = cbFTPImage . SelectedIndex ;
FTPUpdateEnabledStates ( ) ;
2016-06-12 08:19:29 +12:00
}
2018-03-01 11:52:11 +13:00
#endregion FTP
2017-10-06 09:54:06 +13:00
#region Dropbox
2015-06-08 01:34:33 +12:00
if ( OAuth2Info . CheckOAuth ( Config . DropboxOAuth2Info ) )
{
oauth2Dropbox . Status = OAuthLoginStatus . LoginSuccessful ;
}
txtDropboxPath . Text = Config . DropboxUploadPath ;
cbDropboxAutoCreateShareableLink . Checked = Config . DropboxAutoCreateShareableLink ;
2017-03-19 19:52:03 +13:00
cbDropboxUseDirectLink . Enabled = Config . DropboxAutoCreateShareableLink ;
cbDropboxUseDirectLink . Checked = Config . DropboxUseDirectLink ;
2015-06-08 01:34:33 +12:00
2018-03-01 11:52:11 +13:00
#endregion Dropbox
2017-10-06 09:54:06 +13:00
#region OneDrive
2016-06-12 08:19:29 +12:00
tvOneDrive . Nodes . Clear ( ) ;
OneDriveAddFolder ( OneDrive . RootFolder , null ) ;
2018-04-14 03:10:58 +12:00
if ( OAuth2Info . CheckOAuth ( Config . OneDriveV2OAuth2Info ) )
2016-06-12 08:19:29 +12:00
{
oAuth2OneDrive . Status = OAuthLoginStatus . LoginSuccessful ;
2018-04-10 12:56:03 +12:00
tvOneDrive . Enabled = true ;
2016-06-12 08:19:29 +12:00
}
cbOneDriveCreateShareableLink . Checked = Config . OneDriveAutoCreateShareableLink ;
2023-10-13 00:33:23 +13:00
cbOneDriveUseDirectLink . Checked = Config . OneDriveUseDirectLink ;
cbOneDriveUseDirectLink . Enabled = Config . OneDriveAutoCreateShareableLink ;
2018-04-14 03:10:58 +12:00
lblOneDriveFolderID . Text = Resources . UploadersConfigForm_LoadSettings_Selected_folder_ + " " + Config . OneDriveV2SelectedFolder . name ;
2016-06-12 08:19:29 +12:00
tvOneDrive . CollapseAll ( ) ;
2018-03-01 11:52:11 +13:00
#endregion OneDrive
2017-10-06 09:54:06 +13:00
#region Google Drive
2015-06-08 01:34:33 +12:00
2022-12-11 02:10:35 +13:00
oauth2GoogleDrive . UpdateStatus ( Config . GoogleDriveOAuth2Info , Config . GoogleDriveUserInfo ) ;
2024-04-22 18:00:17 +12:00
//btnGoogleDriveRefreshFolders.Enabled = oauth2GoogleDrive.Connected;
2015-06-08 01:34:33 +12:00
cbGoogleDriveIsPublic . Checked = Config . GoogleDriveIsPublic ;
2016-06-11 22:11:58 +12:00
cbGoogleDriveDirectLink . Checked = Config . GoogleDriveDirectLink ;
2022-12-11 00:19:34 +13:00
2024-04-22 18:00:17 +12:00
/ *
2022-12-11 00:19:34 +13:00
cbGoogleDriveSharedDrive . Items . Clear ( ) ;
cbGoogleDriveSharedDrive . Items . Add ( GoogleDrive . MyDrive ) ;
if ( Config . GoogleDriveSelectedDrive ? . id ! = GoogleDrive . MyDrive . id )
{
cbGoogleDriveSharedDrive . Items . Add ( Config . GoogleDriveSelectedDrive ) ;
}
2024-04-22 18:00:17 +12:00
* /
2022-12-11 00:19:34 +13:00
2015-06-08 01:34:33 +12:00
cbGoogleDriveUseFolder . Checked = Config . GoogleDriveUseFolder ;
txtGoogleDriveFolderID . Enabled = Config . GoogleDriveUseFolder ;
2024-04-22 18:00:17 +12:00
btnGoogleDriveFolderIDHelp . Enabled = Config . GoogleDriveUseFolder ;
2015-06-08 01:34:33 +12:00
txtGoogleDriveFolderID . Text = Config . GoogleDriveFolderID ;
2024-04-22 18:00:17 +12:00
//GoogleDriveSelectConfigDrive();
2015-06-08 01:34:33 +12:00
2018-03-01 11:52:11 +13:00
#endregion Google Drive
2017-10-06 09:54:06 +13:00
#region puush
2015-06-08 01:34:33 +12:00
2016-06-12 08:19:29 +12:00
txtPuushAPIKey . Text = Config . PuushAPIKey ;
2015-06-08 01:34:33 +12:00
2018-03-01 11:52:11 +13:00
#endregion puush
2017-10-06 09:54:06 +13:00
#region Box
2015-06-08 01:34:33 +12:00
if ( OAuth2Info . CheckOAuth ( Config . BoxOAuth2Info ) )
{
oauth2Box . Status = OAuthLoginStatus . LoginSuccessful ;
btnBoxRefreshFolders . Enabled = true ;
}
cbBoxShare . Checked = Config . BoxShare ;
2020-05-16 08:46:47 +12:00
cbBoxShareAccessLevel . Items . Clear ( ) ;
cbBoxShareAccessLevel . Items . AddRange ( Helpers . GetEnumDescriptions < BoxShareAccessLevel > ( ) ) ;
cbBoxShareAccessLevel . SelectedIndex = ( int ) Config . BoxShareAccessLevel ;
cbBoxShareAccessLevel . Enabled = Config . BoxShare ;
lblBoxShareAccessLevel . Enabled = Config . BoxShare ;
2015-06-08 01:34:33 +12:00
lblBoxFolderID . Text = Resources . UploadersConfigForm_LoadSettings_Selected_folder_ + " " + Config . BoxSelectedFolder . name ;
2018-03-01 11:52:11 +13:00
#endregion Box
2017-10-06 09:54:06 +13:00
#region Localhostr
2015-06-08 01:34:33 +12:00
txtLocalhostrEmail . Text = Config . LocalhostrEmail ;
txtLocalhostrPassword . Text = Config . LocalhostrPassword ;
cbLocalhostrDirectURL . Checked = Config . LocalhostrDirectURL ;
2018-03-01 11:52:11 +13:00
#endregion Localhostr
2017-10-06 09:54:06 +13:00
#region Email
2015-06-08 01:34:33 +12:00
txtEmailSmtpServer . Text = Config . EmailSmtpServer ;
2016-03-01 10:09:22 +13:00
nudEmailSmtpPort . SetValue ( Config . EmailSmtpPort ) ;
2015-06-08 01:34:33 +12:00
txtEmailFrom . Text = Config . EmailFrom ;
txtEmailPassword . Text = Config . EmailPassword ;
cbEmailRememberLastTo . Checked = Config . EmailRememberLastTo ;
txtEmailDefaultSubject . Text = Config . EmailDefaultSubject ;
txtEmailDefaultBody . Text = Config . EmailDefaultBody ;
2016-05-25 06:50:26 +12:00
cbEmailAutomaticSend . Checked = Config . EmailAutomaticSend ;
txtEmailAutomaticSendTo . Enabled = Config . EmailAutomaticSend ;
txtEmailAutomaticSendTo . Text = Config . EmailAutomaticSendTo ;
2015-06-08 01:34:33 +12:00
2018-03-01 11:52:11 +13:00
#endregion Email
2017-10-06 09:54:06 +13:00
#region SendSpace
2015-06-08 01:34:33 +12:00
atcSendSpaceAccountType . SelectedAccountType = Config . SendSpaceAccountType ;
txtSendSpacePassword . Text = Config . SendSpacePassword ;
txtSendSpaceUserName . Text = Config . SendSpaceUsername ;
2018-03-01 11:52:11 +13:00
#endregion SendSpace
2017-10-06 09:54:06 +13:00
2018-04-22 21:10:23 +12:00
#region Shared folder
2015-06-08 01:34:33 +12:00
2018-04-22 21:10:23 +12:00
if ( Config . LocalhostAccountList = = null )
2015-06-08 01:34:33 +12:00
{
2018-04-22 21:10:23 +12:00
Config . LocalhostAccountList = new List < LocalhostAccount > ( ) ;
2015-06-08 01:34:33 +12:00
}
2018-04-22 21:10:23 +12:00
SharedFolderUpdateControls ( ) ;
#endregion Shared folder
2017-10-06 09:54:06 +13:00
#region Jira
2015-06-08 01:34:33 +12:00
txtJiraHost . Text = Config . JiraHost ;
txtJiraIssuePrefix . Text = Config . JiraIssuePrefix ;
2015-07-31 06:24:46 +12:00
try
{
2016-03-30 10:14:49 +13:00
txtJiraConfigHelp . Text = string . Format ( @ "How to configure your Jira server:
2015-06-08 01:34:33 +12:00
- Go to ' Administration ' - > ' Add - ons '
- Select ' Application Links '
- Add a new ' Application Link ' with following settings :
- Server URL : { 0 }
- Application Name : { 1 }
- Application Type : Generic Application
- Now , you have to configure Incoming Authentication
- Consumer Key : { 2 }
- Consumer Name : { 1 }
- Public Key ( without quotes ) : ' { 3 } '
2022-05-15 09:32:09 +12:00
- You can now authenticate to Jira ", Links.Website, " ShareX ", APIKeys.JiraConsumerKey, Jira.PublicKey);
2015-07-31 06:24:46 +12:00
}
catch ( Exception e )
{
DebugHelper . WriteException ( e ) ;
}
2015-06-08 01:34:33 +12:00
if ( OAuthInfo . CheckOAuth ( Config . JiraOAuthInfo ) )
{
oAuthJira . Status = OAuthLoginStatus . LoginSuccessful ;
}
2018-03-01 11:52:11 +13:00
#endregion Jira
2017-10-06 09:54:06 +13:00
#region Mega
2015-06-08 01:34:33 +12:00
MegaConfigureTab ( false ) ;
2018-03-01 11:52:11 +13:00
#endregion Mega
2017-10-06 09:54:06 +13:00
#region Pushbullet
2015-06-08 01:34:33 +12:00
txtPushbulletUserKey . Text = Config . PushbulletSettings . UserAPIKey ;
if ( Config . PushbulletSettings . DeviceList . Count > 0 )
{
2021-08-30 22:01:36 +12:00
Config . PushbulletSettings . DeviceList . ForEach ( x = > cbPushbulletDevices . Items . Add ( x . Name ? ? Resources . UploadersConfigForm_LoadSettings_Invalid_device_name ) ) ;
2015-06-08 01:34:33 +12:00
if ( Config . PushbulletSettings . DeviceList . IsValidIndex ( Config . PushbulletSettings . SelectedDevice ) )
{
2021-08-30 22:01:36 +12:00
cbPushbulletDevices . SelectedIndex = Config . PushbulletSettings . SelectedDevice ;
2015-06-08 01:34:33 +12:00
}
else
{
2021-08-30 22:01:36 +12:00
cbPushbulletDevices . SelectedIndex = 0 ;
2015-06-08 01:34:33 +12:00
}
}
2018-03-01 11:52:11 +13:00
#endregion Pushbullet
2017-10-06 09:54:06 +13:00
#region Amazon S3
2015-06-08 01:34:33 +12:00
txtAmazonS3AccessKey . Text = Config . AmazonS3Settings . AccessKeyID ;
txtAmazonS3SecretKey . Text = Config . AmazonS3Settings . SecretAccessKey ;
2017-03-21 00:26:44 +13:00
cbAmazonS3Endpoints . Items . AddRange ( AmazonS3 . Endpoints . ToArray ( ) ) ;
2017-03-21 19:31:47 +13:00
for ( int i = 0 ; i < cbAmazonS3Endpoints . Items . Count ; i + + )
{
2022-10-15 12:10:59 +13:00
if ( ( ( AmazonS3Endpoint ) cbAmazonS3Endpoints . Items [ i ] ) . Endpoint . Equals ( Config . AmazonS3Settings . Endpoint , StringComparison . OrdinalIgnoreCase ) )
2017-03-21 19:31:47 +13:00
{
cbAmazonS3Endpoints . SelectedIndex = i ;
break ;
}
}
2017-03-21 00:26:44 +13:00
txtAmazonS3Endpoint . Text = Config . AmazonS3Settings . Endpoint ;
txtAmazonS3Region . Text = Config . AmazonS3Settings . Region ;
2017-03-21 00:56:11 +13:00
cbAmazonS3UsePathStyle . Checked = Config . AmazonS3Settings . UsePathStyle ;
2015-06-08 01:34:33 +12:00
txtAmazonS3BucketName . Text = Config . AmazonS3Settings . Bucket ;
txtAmazonS3ObjectPrefix . Text = Config . AmazonS3Settings . ObjectPrefix ;
cbAmazonS3CustomCNAME . Checked = Config . AmazonS3Settings . UseCustomCNAME ;
txtAmazonS3CustomDomain . Enabled = Config . AmazonS3Settings . UseCustomCNAME ;
txtAmazonS3CustomDomain . Text = Config . AmazonS3Settings . CustomDomain ;
2021-08-30 04:09:02 +12:00
cbAmazonS3StorageClass . Items . AddRange ( Helpers . GetEnumDescriptions < AmazonS3StorageClass > ( ) ) ;
2017-09-29 04:25:41 +13:00
cbAmazonS3StorageClass . SelectedIndex = ( int ) Config . AmazonS3Settings . StorageClass ;
2017-12-20 06:55:11 +13:00
cbAmazonS3PublicACL . Checked = Config . AmazonS3Settings . SetPublicACL ;
2018-12-05 05:10:01 +13:00
cbAmazonS3SignedPayload . Checked = Config . AmazonS3Settings . SignedPayload ;
2018-02-02 08:55:23 +13:00
cbAmazonS3StripExtensionImage . Checked = Config . AmazonS3Settings . RemoveExtensionImage ;
cbAmazonS3StripExtensionVideo . Checked = Config . AmazonS3Settings . RemoveExtensionVideo ;
cbAmazonS3StripExtensionText . Checked = Config . AmazonS3Settings . RemoveExtensionText ;
2015-06-08 01:34:33 +12:00
UpdateAmazonS3Status ( ) ;
2018-03-01 11:52:11 +13:00
#endregion Amazon S3
2017-10-06 09:54:06 +13:00
2018-01-29 21:44:06 +13:00
#region ownCloud / Nextcloud
2015-06-08 01:34:33 +12:00
txtOwnCloudHost . Text = Config . OwnCloudHost ;
txtOwnCloudUsername . Text = Config . OwnCloudUsername ;
txtOwnCloudPassword . Text = Config . OwnCloudPassword ;
txtOwnCloudPath . Text = Config . OwnCloudPath ;
2018-09-11 09:14:32 +12:00
txtOwnCloudExpiryTime . Value = Config . OwnCloudExpiryTime ;
2015-06-08 01:34:33 +12:00
cbOwnCloudCreateShare . Checked = Config . OwnCloudCreateShare ;
cbOwnCloudDirectLink . Checked = Config . OwnCloudDirectLink ;
2021-12-29 02:35:47 +13:00
cbOwnCloudAppendFileNameToURL . Checked = Config . OwnCloudAppendFileNameToURL ;
2015-07-22 09:52:00 +12:00
cbOwnCloud81Compatibility . Checked = Config . OwnCloud81Compatibility ;
2018-03-25 11:04:56 +13:00
cbOwnCloudUsePreviewLinks . Checked = Config . OwnCloudUsePreviewLinks ;
2018-09-29 21:43:30 +12:00
cbOwnCloudAutoExpire . Checked = Config . OwnCloudAutoExpire ;
2015-06-08 01:34:33 +12:00
2018-03-01 11:52:11 +13:00
#endregion ownCloud / Nextcloud
2017-10-06 09:54:06 +13:00
#region MediaFire
2015-06-08 01:34:33 +12:00
txtMediaFireEmail . Text = Config . MediaFireUsername ;
txtMediaFirePassword . Text = Config . MediaFirePassword ;
txtMediaFirePath . Text = Config . MediaFirePath ;
cbMediaFireUseLongLink . Checked = Config . MediaFireUseLongLink ;
2018-03-01 11:52:11 +13:00
#endregion MediaFire
2017-10-06 09:54:06 +13:00
#region Lambda
2015-06-08 01:34:33 +12:00
txtLambdaApiKey . Text = Config . LambdaSettings . UserAPIKey ;
2015-10-15 16:43:32 +13:00
cbLambdaUploadURL . Items . AddRange ( Lambda . UploadURLs ) ;
cbLambdaUploadURL . SelectedItem = Config . LambdaSettings . UploadURL ;
2015-06-08 01:34:33 +12:00
2018-03-01 11:52:11 +13:00
#endregion Lambda
2017-10-06 09:54:06 +13:00
2022-02-04 00:09:16 +13:00
#region LobFile
2016-05-15 23:57:30 +12:00
txtLithiioApiKey . Text = Config . LithiioSettings . UserAPIKey ;
2022-02-04 00:09:16 +13:00
#endregion
2017-10-06 09:54:06 +13:00
#region Pomf
2015-10-06 13:09:16 +13:00
if ( Config . PomfUploader = = null ) Config . PomfUploader = new PomfUploader ( ) ;
txtPomfUploadURL . Text = Config . PomfUploader . UploadURL ;
txtPomfResultURL . Text = Config . PomfUploader . ResultURL ;
2018-03-01 11:52:11 +13:00
#endregion Pomf
2017-10-06 09:54:06 +13:00
#region Seafile
2015-10-13 14:24:49 +13:00
2015-10-13 19:44:51 +13:00
cbSeafileAPIURL . Text = Config . SeafileAPIURL ;
2015-10-13 14:24:49 +13:00
txtSeafileAuthToken . Text = Config . SeafileAuthToken ;
txtSeafileDirectoryPath . Text = Config . SeafilePath ;
txtSeafileLibraryPassword . Text = Config . SeafileEncryptedLibraryPassword ;
2015-10-13 19:44:51 +13:00
txtSeafileLibraryPassword . ReadOnly = Config . SeafileIsLibraryEncrypted ;
btnSeafileLibraryPasswordValidate . Enabled = ! Config . SeafileIsLibraryEncrypted ;
2015-10-13 14:24:49 +13:00
cbSeafileCreateShareableURL . Checked = Config . SeafileCreateShareableURL ;
2020-05-03 09:22:09 +12:00
cbSeafileCreateShareableURLRaw . Checked = Config . SeafileCreateShareableURLRaw ;
cbSeafileCreateShareableURLRaw . Enabled = cbSeafileCreateShareableURL . Checked ;
2015-10-13 14:24:49 +13:00
cbSeafileIgnoreInvalidCert . Checked = Config . SeafileIgnoreInvalidCert ;
2016-03-01 10:09:22 +13:00
nudSeafileExpireDays . SetValue ( Config . SeafileShareDaysToExpire ) ;
2015-10-13 16:54:19 +13:00
txtSeafileSharePassword . Text = Config . SeafileSharePassword ;
2015-10-13 14:24:49 +13:00
txtSeafileAccInfoEmail . Text = Config . SeafileAccInfoEmail ;
txtSeafileAccInfoUsage . Text = Config . SeafileAccInfoUsage ;
2018-03-01 11:52:11 +13:00
#endregion Seafile
2017-10-06 09:54:06 +13:00
#region Streamable
2015-12-02 07:15:52 +13:00
txtStreamablePassword . Text = Config . StreamablePassword ;
txtStreamableUsername . Text = Config . StreamableUsername ;
2016-04-08 02:50:41 +12:00
cbStreamableUseDirectURL . Checked = Config . StreamableUseDirectURL ;
2015-12-02 07:15:52 +13:00
2018-03-01 11:52:11 +13:00
#endregion Streamable
2017-10-06 09:54:06 +13:00
#region s - ul
2017-06-20 10:25:17 +12:00
txtSulAPIKey . Text = Config . SulAPIKey ;
2018-03-01 11:52:11 +13:00
#endregion s - ul
2017-10-06 09:54:06 +13:00
#region Azure Storage
2017-03-17 13:15:19 +13:00
2017-01-27 00:41:49 +13:00
txtAzureStorageAccountName . Text = Config . AzureStorageAccountName ;
txtAzureStorageAccessKey . Text = Config . AzureStorageAccountAccessKey ;
txtAzureStorageContainer . Text = Config . AzureStorageContainer ;
2017-05-23 08:03:29 +12:00
cbAzureStorageEnvironment . Text = Config . AzureStorageEnvironment ;
2017-07-07 12:58:14 +12:00
txtAzureStorageCustomDomain . Text = Config . AzureStorageCustomDomain ;
2018-06-06 12:39:50 +12:00
txtAzureStorageUploadPath . Text = Config . AzureStorageUploadPath ;
2023-03-08 05:51:04 +13:00
txtAzureStorageCacheControl . Text = Config . AzureStorageCacheControl ;
2018-06-20 07:16:11 +12:00
UpdateAzureStorageStatus ( ) ;
2017-01-27 00:41:49 +13:00
2018-03-01 11:52:11 +13:00
#endregion Azure Storage
2017-10-06 09:54:06 +13:00
2018-09-27 17:49:42 +12:00
#region Backblaze B2
txtB2ApplicationKeyId . Text = Config . B2ApplicationKeyId ;
txtB2ApplicationKey . Text = Config . B2ApplicationKey ;
txtB2Bucket . Text = Config . B2BucketName ;
txtB2UploadPath . Text = Config . B2UploadPath ;
cbB2CustomUrl . Checked = Config . B2UseCustomUrl ;
txtB2CustomUrl . ReadOnly = ! cbB2CustomUrl . Checked ;
2018-10-02 06:51:50 +13:00
txtB2CustomUrl . Enabled = cbB2CustomUrl . Checked ;
2018-09-27 17:49:42 +12:00
txtB2CustomUrl . Text = Config . B2CustomUrl ;
B2UpdateCustomDomainPreview ( ) ;
#endregion Backblaze B2
2017-10-06 09:54:06 +13:00
#region Plik
2017-03-17 13:15:19 +13:00
2017-02-27 08:27:40 +13:00
txtPlikAPIKey . Text = Config . PlikSettings . APIKey ;
txtPlikURL . Text = Config . PlikSettings . URL ;
txtPlikPassword . Text = Config . PlikSettings . Password ;
txtPlikLogin . Text = Config . PlikSettings . Login ;
txtPlikComment . Text = Config . PlikSettings . Comment ;
2017-02-27 09:44:47 +13:00
cbPlikComment . Checked = Config . PlikSettings . HasComment ;
cbPlikIsSecured . Checked = Config . PlikSettings . IsSecured ;
2017-02-27 08:27:40 +13:00
cbPlikRemovable . Checked = Config . PlikSettings . Removable ;
cbPlikOneShot . Checked = Config . PlikSettings . OneShot ;
nudPlikTTL . Value = Config . PlikSettings . TTL ;
2021-09-08 11:53:11 +12:00
cbPlikTTLUnit . SelectedIndex = Config . PlikSettings . TTLUnit ;
2017-02-27 05:17:02 +13:00
txtPlikComment . ReadOnly = ! cbPlikComment . Checked ;
txtPlikLogin . ReadOnly = ! cbPlikIsSecured . Checked ;
txtPlikPassword . ReadOnly = ! cbPlikIsSecured . Checked ;
2018-03-01 11:52:11 +13:00
#endregion Plik
2017-10-06 09:54:06 +13:00
2018-04-10 12:49:40 +12:00
#region YouTube
2022-12-11 02:10:35 +13:00
oauth2YouTube . UpdateStatus ( Config . YouTubeOAuth2Info , Config . YouTubeUserInfo ) ;
2022-12-10 22:51:49 +13:00
2018-04-10 12:49:40 +12:00
cbYouTubePrivacyType . Items . Clear ( ) ;
cbYouTubePrivacyType . Items . AddRange ( Helpers . GetLocalizedEnumDescriptions < YouTubeVideoPrivacy > ( ) ) ;
cbYouTubePrivacyType . SelectedIndex = ( int ) Config . YouTubePrivacyType ;
2018-04-12 22:09:35 +12:00
cbYouTubeUseShortenedLink . Checked = Config . YouTubeUseShortenedLink ;
2021-11-20 14:35:47 +13:00
cbYouTubeShowDialog . Checked = Config . YouTubeShowDialog ;
2018-04-10 12:49:40 +12:00
#endregion YouTube
2018-04-21 04:13:34 +12:00
#region Google Cloud Storage
2022-12-11 02:10:35 +13:00
oauth2GoogleCloudStorage . UpdateStatus ( Config . GoogleCloudStorageOAuth2Info , Config . GoogleCloudStorageUserInfo ) ;
2018-04-21 04:13:34 +12:00
2018-04-21 08:39:14 +12:00
txtGoogleCloudStorageBucket . Text = Config . GoogleCloudStorageBucket ;
txtGoogleCloudStorageDomain . Text = Config . GoogleCloudStorageDomain ;
2018-04-21 09:16:46 +12:00
txtGoogleCloudStorageObjectPrefix . Text = Config . GoogleCloudStorageObjectPrefix ;
2018-04-21 08:39:14 +12:00
2018-10-11 09:00:50 +13:00
cbGoogleCloudStorageStripExtensionImage . Checked = Config . GoogleCloudStorageRemoveExtensionImage ;
cbGoogleCloudStorageStripExtensionVideo . Checked = Config . GoogleCloudStorageRemoveExtensionVideo ;
cbGoogleCloudStorageStripExtensionText . Checked = Config . GoogleCloudStorageRemoveExtensionText ;
2019-04-08 08:42:47 +12:00
cbGoogleCloudStorageSetPublicACL . Checked = Config . GoogleCloudStorageSetPublicACL ;
2018-10-11 09:00:50 +13:00
2018-04-21 04:13:34 +12:00
#endregion Google Cloud Storage
2018-10-03 07:25:55 +13:00
}
2018-04-21 04:13:34 +12:00
2018-10-03 07:25:55 +13:00
private void LoadURLShortenerSettings ( )
{
2017-10-06 09:54:06 +13:00
#region bit . ly
2015-06-08 01:34:33 +12:00
if ( OAuth2Info . CheckOAuth ( Config . BitlyOAuth2Info ) )
{
oauth2Bitly . Status = OAuthLoginStatus . LoginSuccessful ;
}
txtBitlyDomain . Text = Config . BitlyDomain ;
2018-03-01 11:52:11 +13:00
#endregion bit . ly
2017-10-06 09:54:06 +13:00
#region yourls . org
2015-06-08 01:34:33 +12:00
txtYourlsAPIURL . Text = Config . YourlsAPIURL ;
txtYourlsSignature . Text = Config . YourlsSignature ;
txtYourlsUsername . Enabled = txtYourlsPassword . Enabled = string . IsNullOrEmpty ( Config . YourlsSignature ) ;
txtYourlsUsername . Text = Config . YourlsUsername ;
txtYourlsPassword . Text = Config . YourlsPassword ;
2018-03-01 11:52:11 +13:00
#endregion yourls . org
2017-10-06 09:54:06 +13:00
#region adf . ly
2015-06-08 01:34:33 +12:00
txtAdflyAPIKEY . Text = Config . AdFlyAPIKEY ;
txtAdflyAPIUID . Text = Config . AdFlyAPIUID ;
2018-03-01 11:52:11 +13:00
#endregion adf . ly
2017-10-06 09:54:06 +13:00
#region Polr
2015-08-10 07:21:20 +12:00
txtPolrAPIHostname . Text = Config . PolrAPIHostname ;
txtPolrAPIKey . Text = Config . PolrAPIKey ;
2016-12-30 02:01:03 +13:00
cbPolrIsSecret . Checked = Config . PolrIsSecret ;
cbPolrUseAPIv1 . Checked = Config . PolrUseAPIv1 ;
2015-08-10 07:21:20 +12:00
2018-03-01 11:52:11 +13:00
#endregion Polr
2017-10-06 09:54:06 +13:00
2018-04-04 14:42:05 +12:00
#region Firebase Dynamic Links
txtFirebaseWebAPIKey . Text = Config . FirebaseWebAPIKey ;
txtFirebaseDomain . Text = Config . FirebaseDynamicLinkDomain ;
cbFirebaseIsShort . Checked = Config . FirebaseIsShort ;
#endregion Firebase Dynamic Links
2018-10-02 12:11:53 +13:00
#region Kutt
txtKuttHost . Text = Config . KuttSettings . Host ;
txtKuttAPIKey . Text = Config . KuttSettings . APIKey ;
txtKuttPassword . Text = Config . KuttSettings . Password ;
2020-07-30 02:52:32 +12:00
txtKuttDomain . Text = Config . KuttSettings . Domain ;
2018-10-02 12:11:53 +13:00
cbKuttReuse . Checked = Config . KuttSettings . Reuse ;
#endregion Kutt
2021-03-11 05:20:50 +13:00
#region Zero Width Shortener
txtZWSURL . Text = Config . ZeroWidthShortenerURL ;
txtZWSToken . Text = Config . ZeroWidthShortenerToken ;
#endregion
2018-10-03 07:25:55 +13:00
}
2018-10-02 12:11:53 +13:00
2018-10-03 07:25:55 +13:00
private void LoadOtherUploaderSettings ( )
{
2017-10-06 09:54:06 +13:00
#region Twitter
2015-06-08 01:34:33 +12:00
2015-09-03 03:41:02 +12:00
lbTwitterAccounts . Items . Clear ( ) ;
2015-06-08 01:34:33 +12:00
foreach ( OAuthInfo twitterOAuth in Config . TwitterOAuthInfoList )
{
2015-09-03 03:41:02 +12:00
lbTwitterAccounts . Items . Add ( twitterOAuth . Description ) ;
2015-06-08 01:34:33 +12:00
}
2015-09-06 12:39:39 +12:00
if ( CheckTwitterAccounts ( ) )
{
lbTwitterAccounts . SelectedIndex = Config . TwitterSelectedAccount ;
}
2015-06-08 01:34:33 +12:00
TwitterUpdateSelected ( ) ;
cbTwitterSkipMessageBox . Checked = Config . TwitterSkipMessageBox ;
txtTwitterDefaultMessage . Text = Config . TwitterDefaultMessage ;
2018-03-01 11:52:11 +13:00
#endregion Twitter
2015-06-08 01:34:33 +12:00
}
2017-10-06 09:54:06 +13:00
#region Image uploaders
2015-06-08 01:34:33 +12:00
#region Imgur
private void atcImgurAccountType_AccountTypeChanged ( AccountType accountType )
{
Config . ImgurAccountType = accountType ;
oauth2Imgur . Enabled = Config . ImgurAccountType = = AccountType . User ;
}
private void oauth2Imgur_OpenButtonClicked ( )
{
2018-05-17 13:14:17 +12:00
OAuth2Info oauth = new OAuth2Info ( APIKeys . ImgurClientID , APIKeys . ImgurClientSecret ) ;
Config . ImgurOAuth2Info = OAuth2Open ( new Imgur ( oauth ) ) ;
2015-06-08 01:34:33 +12:00
}
private void oauth2Imgur_CompleteButtonClicked ( string code )
{
2018-05-17 13:14:17 +12:00
btnImgurRefreshAlbumList . Enabled = OAuth2Complete ( new Imgur ( Config . ImgurOAuth2Info ) , code , oauth2Imgur ) ;
2015-06-08 01:34:33 +12:00
}
private void oauth2Imgur_ClearButtonClicked ( )
{
Config . ImgurOAuth2Info = null ;
}
private void oauth2Imgur_RefreshButtonClicked ( )
{
2018-05-17 13:14:17 +12:00
btnImgurRefreshAlbumList . Enabled = OAuth2Refresh ( new Imgur ( Config . ImgurOAuth2Info ) , oauth2Imgur ) ;
2015-06-08 01:34:33 +12:00
}
private void cbImgurDirectLink_CheckedChanged ( object sender , EventArgs e )
{
Config . ImgurDirectLink = cbImgurDirectLink . Checked ;
}
private void cbImgurThumbnailType_SelectedIndexChanged ( object sender , EventArgs e )
{
Config . ImgurThumbnailType = ( ImgurThumbnailType ) cbImgurThumbnailType . SelectedIndex ;
}
2015-08-08 23:38:37 +12:00
private void cbImgurUseGIFV_CheckedChanged ( object sender , EventArgs e )
{
Config . ImgurUseGIFV = cbImgurUseGIFV . Checked ;
}
2015-06-08 01:34:33 +12:00
private void cbImgurUploadSelectedAlbum_CheckedChanged ( object sender , EventArgs e )
{
Config . ImgurUploadSelectedAlbum = cbImgurUploadSelectedAlbum . Checked ;
}
private void btnImgurRefreshAlbumList_Click ( object sender , EventArgs e )
{
ImgurRefreshAlbumList ( ) ;
}
private void lvImgurAlbumList_SelectedIndexChanged ( object sender , EventArgs e )
{
if ( lvImgurAlbumList . SelectedItems . Count > 0 )
{
ListViewItem lvi = lvImgurAlbumList . SelectedItems [ 0 ] ;
2021-06-10 10:14:01 +12:00
if ( lvi . Tag is ImgurAlbumData albumData )
2015-06-08 01:34:33 +12:00
{
2021-06-10 10:14:01 +12:00
Config . ImgurSelectedAlbum = albumData ;
2015-06-08 01:34:33 +12:00
}
}
else
{
Config . ImgurSelectedAlbum = null ;
}
}
#endregion Imgur
#region ImageShack
private void txtImageShackUsername_TextChanged ( object sender , EventArgs e )
{
Config . ImageShackSettings . Username = txtImageShackUsername . Text ;
}
private void txtImageShackPassword_TextChanged ( object sender , EventArgs e )
{
Config . ImageShackSettings . Password = txtImageShackPassword . Text ;
}
private void btnImageShackLogin_Click ( object sender , EventArgs e )
{
ImageShackUploader imageShackUploader = new ImageShackUploader ( APIKeys . ImageShackKey , Config . ImageShackSettings ) ;
try
{
if ( imageShackUploader . GetAccessToken ( ) )
{
MessageBox . Show ( Resources . UploadersConfigForm_Login_successful , "ShareX" , MessageBoxButtons . OK , MessageBoxIcon . Information ) ;
}
else
{
MessageBox . Show ( Resources . UploadersConfigForm_Login_failed , "ShareX" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
}
}
catch ( Exception ex )
{
DebugHelper . WriteException ( ex ) ;
2017-04-22 08:42:52 +12:00
ex . ShowError ( ) ;
2015-06-08 01:34:33 +12:00
}
}
private void cbImageShackIsPublic_CheckedChanged ( object sender , EventArgs e )
{
Config . ImageShackSettings . IsPublic = cbImageShackIsPublic . Checked ;
}
private void btnImageShackOpenPublicProfile_Click ( object sender , EventArgs e )
{
if ( ! string . IsNullOrEmpty ( Config . ImageShackSettings . Username ) )
{
URLHelpers . OpenURL ( "https://imageshack.com/user/" + Config . ImageShackSettings . Username ) ;
}
else
{
txtImageShackUsername . Focus ( ) ;
}
}
private void btnImageShackOpenMyImages_Click ( object sender , EventArgs e )
{
URLHelpers . OpenURL ( "https://imageshack.com/my/images" ) ;
}
#endregion ImageShack
#region Flickr
2017-10-04 14:29:39 +13:00
private void oauthFlickr_OpenButtonClicked ( )
2015-06-08 01:34:33 +12:00
{
FlickrAuthOpen ( ) ;
}
2017-10-04 14:29:39 +13:00
private void oauthFlickr_CompleteButtonClicked ( string code )
2015-06-08 01:34:33 +12:00
{
2017-10-04 14:29:39 +13:00
FlickrAuthComplete ( code ) ;
2015-06-08 01:34:33 +12:00
}
2017-10-04 14:29:39 +13:00
private void oauthFlickr_ClearButtonClicked ( )
2015-06-08 01:34:33 +12:00
{
2017-10-04 14:29:39 +13:00
Config . FlickrOAuthInfo = null ;
2015-06-08 01:34:33 +12:00
}
2017-10-09 20:14:02 +13:00
private void cbFlickrDirectLink_CheckedChanged ( object sender , EventArgs e )
{
Config . FlickrSettings . DirectLink = cbFlickrDirectLink . Checked ;
}
2015-06-08 01:34:33 +12:00
#endregion Flickr
#region Photobucket
private void btnPhotobucketAuthOpen_Click ( object sender , EventArgs e )
{
PhotobucketAuthOpen ( ) ;
}
private void btnPhotobucketAuthComplete_Click ( object sender , EventArgs e )
{
PhotobucketAuthComplete ( ) ;
}
private void btnPhotobucketCreateAlbum_Click ( object sender , EventArgs e )
{
PhotobucketCreateAlbum ( ) ;
}
2021-08-30 22:01:36 +12:00
private void cbPhotobucketAlbumPaths_SelectedIndexChanged ( object sender , EventArgs e )
2015-06-08 01:34:33 +12:00
{
if ( Config . PhotobucketAccountInfo ! = null )
{
2021-08-30 22:01:36 +12:00
Config . PhotobucketAccountInfo . ActiveAlbumID = cbPhotobucketAlbumPaths . SelectedIndex ;
2015-06-08 01:34:33 +12:00
}
}
private void btnPhotobucketAddAlbum_Click ( object sender , EventArgs e )
{
2021-08-30 22:01:36 +12:00
string albumPath = cbPhotobucketAlbumPaths . Text ;
2015-06-08 01:34:33 +12:00
if ( ! Config . PhotobucketAccountInfo . AlbumList . Contains ( albumPath ) )
{
Config . PhotobucketAccountInfo . AlbumList . Add ( albumPath ) ;
2021-08-30 22:01:36 +12:00
cbPhotobucketAlbumPaths . Items . Add ( albumPath ) ;
2015-06-08 01:34:33 +12:00
}
}
private void btnPhotobucketRemoveAlbum_Click ( object sender , EventArgs e )
{
2021-08-30 22:01:36 +12:00
if ( cbPhotobucketAlbumPaths . Items . Count > 1 )
2015-06-08 01:34:33 +12:00
{
2021-08-30 22:01:36 +12:00
cbPhotobucketAlbumPaths . Items . RemoveAt ( cbPhotobucketAlbumPaths . SelectedIndex ) ;
cbPhotobucketAlbumPaths . SelectedIndex = cbPhotobucketAlbumPaths . Items . Count - 1 ;
2015-06-08 01:34:33 +12:00
}
}
#endregion Photobucket
2017-10-06 09:54:06 +13:00
#region Google Photos
2015-06-08 01:34:33 +12:00
2022-12-10 22:51:49 +13:00
private void oauth2GooglePhotos_ConnectButtonClicked ( )
2015-06-08 01:34:33 +12:00
{
2018-05-17 13:14:17 +12:00
OAuth2Info oauth = new OAuth2Info ( APIKeys . GoogleClientID , APIKeys . GoogleClientSecret ) ;
2022-12-10 22:51:49 +13:00
IOAuth2Loopback oauthLoopback = new GooglePhotos ( oauth ) . OAuth2 ;
2015-06-08 01:34:33 +12:00
2022-12-10 22:51:49 +13:00
using ( OAuthListenerForm form = new OAuthListenerForm ( oauthLoopback ) )
2020-04-17 02:06:25 +12:00
{
2022-12-10 22:51:49 +13:00
form . ShowDialog ( ) ;
Config . GooglePhotosOAuth2Info = form . OAuth2Info ;
Config . GooglePhotosUserInfo = form . UserInfo ;
2020-04-17 02:06:25 +12:00
}
2022-12-10 22:51:49 +13:00
2022-12-11 02:10:35 +13:00
oauth2GooglePhotos . UpdateStatus ( Config . GooglePhotosOAuth2Info , Config . GooglePhotosUserInfo ) ;
2022-12-10 22:51:49 +13:00
btnPicasaRefreshAlbumList . Enabled = oauth2GooglePhotos . Connected ;
2022-12-11 02:10:35 +13:00
2022-12-10 22:51:49 +13:00
this . ForceActivate ( ) ;
2015-06-08 01:34:33 +12:00
}
2022-12-10 22:51:49 +13:00
private void oauth2GooglePhotos_DisconnectButtonClicked ( )
2015-06-08 01:34:33 +12:00
{
2019-01-22 21:16:12 +13:00
Config . GooglePhotosOAuth2Info = null ;
2020-04-17 02:06:25 +12:00
Config . GooglePhotosUserInfo = null ;
2015-06-08 01:34:33 +12:00
}
private void txtPicasaAlbumID_TextChanged ( object sender , EventArgs e )
{
2019-01-22 21:16:12 +13:00
Config . GooglePhotosAlbumID = txtPicasaAlbumID . Text ;
2015-06-08 01:34:33 +12:00
}
private void btnPicasaRefreshAlbumList_Click ( object sender , EventArgs e )
{
2017-10-06 09:54:06 +13:00
GooglePhotosRefreshAlbumList ( ) ;
2015-06-08 01:34:33 +12:00
}
private void lvPicasaAlbumList_SelectedIndexChanged ( object sender , EventArgs e )
{
if ( lvPicasaAlbumList . SelectedItems . Count > 0 )
{
ListViewItem lvi = lvPicasaAlbumList . SelectedItems [ 0 ] ;
2021-06-10 10:14:01 +12:00
if ( lvi . Tag is GooglePhotosAlbumInfo album )
2015-06-08 01:34:33 +12:00
{
txtPicasaAlbumID . Text = album . ID ;
}
}
}
2019-01-22 20:57:43 +13:00
private void cbGooglePhotosIsPublic_CheckedChanged ( object sender , EventArgs e )
{
Config . GooglePhotosIsPublic = cbGooglePhotosIsPublic . Checked ;
}
private void btnGooglePhotosCreateAlbum_Click ( object sender , EventArgs e )
{
GooglePhotosCreateAlbum ( txtGooglePhotosCreateAlbumName . Text ) ;
GooglePhotosRefreshAlbumList ( ) ;
}
2017-10-06 09:54:06 +13:00
#endregion Google Photos
2015-06-08 01:34:33 +12:00
#region Chevereto
private void txtCheveretoWebsite_TextChanged ( object sender , EventArgs e )
{
2016-02-18 23:10:30 +13:00
Config . CheveretoUploader . UploadURL = txtCheveretoUploadURL . Text ;
2015-06-08 01:34:33 +12:00
}
private void txtCheveretoAPIKey_TextChanged ( object sender , EventArgs e )
{
2016-02-18 23:10:30 +13:00
Config . CheveretoUploader . APIKey = txtCheveretoAPIKey . Text ;
2015-06-08 01:34:33 +12:00
}
private void cbCheveretoDirectURL_CheckedChanged ( object sender , EventArgs e )
{
Config . CheveretoDirectURL = cbCheveretoDirectURL . Checked ;
}
#endregion Chevereto
2016-02-14 13:28:41 +13:00
#region vgy . me
private void txtVgymeUserKey_TextChanged ( object sender , EventArgs e )
{
Config . VgymeUserKey = txtVgymeUserKey . Text ;
}
private void llVgymeAccountDetailsPage_LinkClicked ( object sender , LinkLabelLinkClickedEventArgs e )
{
URLHelpers . OpenURL ( "http://vgy.me/account/details" ) ;
}
#endregion vgy . me
2017-10-06 09:54:06 +13:00
#endregion Image uploaders
2015-06-08 01:34:33 +12:00
2017-10-06 09:54:06 +13:00
#region Text uploaders
2015-06-08 01:34:33 +12:00
#region Pastebin
private void txtPastebinUsername_TextChanged ( object sender , EventArgs e )
{
Config . PastebinSettings . Username = txtPastebinUsername . Text ;
}
private void txtPastebinPassword_TextChanged ( object sender , EventArgs e )
{
Config . PastebinSettings . Password = txtPastebinPassword . Text ;
}
private void btnPastebinRegister_Click ( object sender , EventArgs e )
{
URLHelpers . OpenURL ( "http://pastebin.com/signup" ) ;
}
private void btnPastebinLogin_Click ( object sender , EventArgs e )
{
PastebinLogin ( ) ;
}
private void cbPastebinPrivacy_SelectedIndexChanged ( object sender , EventArgs e )
{
Config . PastebinSettings . Exposure = ( PastebinPrivacy ) cbPastebinPrivacy . SelectedIndex ;
}
private void cbPastebinExpiration_SelectedIndexChanged ( object sender , EventArgs e )
{
Config . PastebinSettings . Expiration = ( PastebinExpiration ) cbPastebinExpiration . SelectedIndex ;
}
private void cbPastebinSyntax_SelectedIndexChanged ( object sender , EventArgs e )
{
Config . PastebinSettings . TextFormat = ( ( PastebinSyntaxInfo ) cbPastebinSyntax . SelectedItem ) . Value ;
}
private void txtPastebinTitle_TextChanged ( object sender , EventArgs e )
{
Config . PastebinSettings . Title = txtPastebinTitle . Text ;
}
2016-03-18 23:46:55 +13:00
private void cbPastebinRaw_CheckedChanged ( object sender , EventArgs e )
{
2016-03-19 01:08:24 +13:00
Config . PastebinSettings . RawURL = cbPastebinRaw . Checked ;
2016-03-18 23:46:55 +13:00
}
2015-06-08 01:34:33 +12:00
#endregion Pastebin
#region Paste . ee
2017-10-03 06:15:54 +13:00
private void btnPaste_eeGetUserKey_Click ( object sender , EventArgs e )
{
URLHelpers . OpenURL ( $"https://paste.ee/account/api/authorize/{APIKeys.Paste_eeApplicationKey}" ) ;
}
2015-06-08 01:34:33 +12:00
private void txtPaste_eeUserAPIKey_TextChanged ( object sender , EventArgs e )
{
2017-10-03 06:15:54 +13:00
Config . Paste_eeUserKey = txtPaste_eeUserAPIKey . Text ;
2015-06-08 01:34:33 +12:00
}
#endregion Paste . ee
#region Gist
private void oAuth2Gist_OpenButtonClicked ( )
{
2018-05-17 13:14:17 +12:00
OAuth2Info oauth = new OAuth2Info ( APIKeys . GitHubID , APIKeys . GitHubSecret ) ;
Config . GistOAuth2Info = OAuth2Open ( new GitHubGist ( oauth ) ) ;
2015-06-08 01:34:33 +12:00
}
private void oAuth2Gist_CompleteButtonClicked ( string code )
{
2018-05-17 13:14:17 +12:00
OAuth2Complete ( new GitHubGist ( Config . GistOAuth2Info ) , code , oAuth2Gist ) ;
2015-06-08 01:34:33 +12:00
}
private void oAuth2Gist_ClearButtonClicked ( )
{
Config . GistOAuth2Info = null ;
}
2021-08-30 20:12:24 +12:00
private void cbGistPublishPublic_CheckedChanged ( object sender , EventArgs e )
2015-06-08 01:34:33 +12:00
{
2016-03-19 01:08:24 +13:00
Config . GistPublishPublic = cbGistPublishPublic . Checked ;
}
private void cbGistUseRawURL_CheckedChanged ( object sender , EventArgs e )
{
Config . GistRawURL = cbGistUseRawURL . Checked ;
2015-06-08 01:34:33 +12:00
}
2017-03-06 02:05:59 +13:00
private void txtGistCustomURL_TextChanged ( object sender , EventArgs e )
{
Config . GistCustomURL = txtGistCustomURL . Text ;
}
2015-06-08 01:34:33 +12:00
#endregion Gist
#region uPaste
private void txtUpasteUserKey_TextChanged ( object sender , EventArgs e )
{
Config . UpasteUserKey = txtUpasteUserKey . Text ;
}
private void cbUpasteIsPublic_CheckedChanged ( object sender , EventArgs e )
{
Config . UpasteIsPublic = cbUpasteIsPublic . Checked ;
}
#endregion uPaste
#region Hastebin
private void txtHastebinCustomDomain_TextChanged ( object sender , EventArgs e )
{
Config . HastebinCustomDomain = txtHastebinCustomDomain . Text ;
}
private void txtHastebinSyntaxHighlighting_TextChanged ( object sender , EventArgs e )
{
Config . HastebinSyntaxHighlighting = txtHastebinSyntaxHighlighting . Text ;
}
2016-07-04 17:07:49 +12:00
private void cbHastebinUseFileExtension_CheckedChanged ( object sender , EventArgs e )
{
Config . HastebinUseFileExtension = cbHastebinUseFileExtension . Checked ;
}
2015-06-08 01:34:33 +12:00
#endregion Hastebin
2015-08-04 00:59:33 +12:00
#region OneTimeSecret
private void txtOneTimeSecretEmail_TextChanged ( object sender , EventArgs e )
{
Config . OneTimeSecretAPIUsername = txtOneTimeSecretEmail . Text ;
}
private void txtOneTimeSecretAPIKey_TextChanged ( object sender , EventArgs e )
{
Config . OneTimeSecretAPIKey = txtOneTimeSecretAPIKey . Text ;
}
#endregion OneTimeSecret
2016-12-08 12:58:45 +13:00
#region Pastie
private void cbPastieIsPublic_CheckedChanged ( object sender , EventArgs e )
{
Config . PastieIsPublic = cbPastieIsPublic . Checked ;
}
#endregion Pastie
2017-10-06 09:54:06 +13:00
#endregion Text uploaders
2015-06-08 01:34:33 +12:00
2017-10-06 09:54:06 +13:00
#region File uploaders
2015-06-08 01:34:33 +12:00
2016-06-12 08:19:29 +12:00
#region FTP
2017-04-21 01:56:16 +12:00
private void cbFTPImage_SelectedIndexChanged ( object sender , EventArgs e )
2016-06-12 08:19:29 +12:00
{
2017-04-20 22:30:08 +12:00
Config . FTPSelectedImage = cbFTPImage . SelectedIndex ;
2016-06-12 08:19:29 +12:00
}
2017-04-21 01:56:16 +12:00
private void cbFTPText_SelectedIndexChanged ( object sender , EventArgs e )
2016-06-12 08:19:29 +12:00
{
2017-04-20 22:30:08 +12:00
Config . FTPSelectedText = cbFTPText . SelectedIndex ;
2016-06-12 08:19:29 +12:00
}
2017-04-21 01:56:16 +12:00
private void cbFTPFile_SelectedIndexChanged ( object sender , EventArgs e )
2016-06-12 08:19:29 +12:00
{
2017-04-20 22:30:08 +12:00
Config . FTPSelectedFile = cbFTPFile . SelectedIndex ;
2016-06-12 08:19:29 +12:00
}
2017-04-21 01:56:16 +12:00
private void cbFTPAccounts_SelectedIndexChanged ( object sender , EventArgs e )
2016-06-12 08:19:29 +12:00
{
2017-04-21 01:56:16 +12:00
FTPLoadSelectedAccount ( ) ;
2016-06-12 08:19:29 +12:00
}
2017-04-21 01:56:16 +12:00
private void btnFTPAdd_Click ( object sender , EventArgs e )
2016-06-12 08:19:29 +12:00
{
2017-04-21 01:56:16 +12:00
FTPAddAccount ( new FTPAccount ( ) ) ;
2016-06-12 08:19:29 +12:00
2017-04-21 01:56:16 +12:00
cbFTPAccounts . SelectedIndex = cbFTPAccounts . Items . Count - 1 ;
2017-04-24 06:09:58 +12:00
txtFTPName . Focus ( ) ;
2016-06-12 08:19:29 +12:00
}
2017-04-21 01:56:16 +12:00
private void btnFTPRemove_Click ( object sender , EventArgs e )
2016-06-12 08:19:29 +12:00
{
2017-04-21 01:56:16 +12:00
int selected = cbFTPAccounts . SelectedIndex ;
2017-04-21 04:38:20 +12:00
if ( selected > - 1 )
2016-06-12 08:19:29 +12:00
{
2017-04-21 04:38:20 +12:00
cbFTPAccounts . Items . RemoveAt ( selected ) ;
Config . FTPAccountList . RemoveAt ( selected ) ;
if ( cbFTPAccounts . Items . Count > 0 )
{
cbFTPAccounts . SelectedIndex = selected = = cbFTPAccounts . Items . Count ? cbFTPAccounts . Items . Count - 1 : selected ;
}
else
{
FTPClearFields ( ) ;
2017-04-24 06:09:58 +12:00
btnFTPAdd . Focus ( ) ;
2017-04-21 04:38:20 +12:00
}
2016-06-12 08:19:29 +12:00
2017-04-21 04:38:20 +12:00
FTPUpdateControls ( ) ;
}
2017-04-21 01:56:16 +12:00
}
2016-06-12 08:19:29 +12:00
2017-04-21 01:56:16 +12:00
private void btnFTPDuplicate_Click ( object sender , EventArgs e )
{
FTPAccount account = FTPGetSelectedAccount ( ) ;
if ( account ! = null )
{
FTPAccount clone = account . Clone ( ) ;
FTPAddAccount ( clone ) ;
2016-06-12 08:19:29 +12:00
2017-04-21 01:56:16 +12:00
cbFTPAccounts . SelectedIndex = cbFTPAccounts . Items . Count - 1 ;
2016-06-12 08:19:29 +12:00
}
}
2017-04-21 04:38:20 +12:00
private void txtFTPName_TextChanged ( object sender , EventArgs e )
{
FTPAccount account = FTPGetSelectedAccount ( ) ;
if ( account ! = null )
{
account . Name = txtFTPName . Text ;
2017-04-21 08:50:31 +12:00
FTPRefreshNames ( ) ;
2017-04-21 04:38:20 +12:00
}
}
private void rbFTPProtocolFTP_CheckedChanged ( object sender , EventArgs e )
{
FTPAccount account = FTPGetSelectedAccount ( ) ;
if ( account ! = null )
{
account . Protocol = FTPProtocol . FTP ;
2017-04-21 07:44:50 +12:00
FTPUpdateEnabledStates ( ) ;
2017-04-21 04:38:20 +12:00
}
}
private void rbFTPProtocolFTPS_CheckedChanged ( object sender , EventArgs e )
{
FTPAccount account = FTPGetSelectedAccount ( ) ;
if ( account ! = null )
{
account . Protocol = FTPProtocol . FTPS ;
2017-04-21 07:44:50 +12:00
FTPUpdateEnabledStates ( ) ;
2017-04-21 04:38:20 +12:00
}
}
private void rbFTPProtocolSFTP_CheckedChanged ( object sender , EventArgs e )
{
FTPAccount account = FTPGetSelectedAccount ( ) ;
if ( account ! = null )
{
account . Protocol = FTPProtocol . SFTP ;
2017-04-21 07:44:50 +12:00
FTPUpdateEnabledStates ( ) ;
2017-04-21 04:38:20 +12:00
}
}
private void txtFTPHost_TextChanged ( object sender , EventArgs e )
{
FTPAccount account = FTPGetSelectedAccount ( ) ;
if ( account ! = null )
{
account . Host = txtFTPHost . Text ;
FTPUpdateURLPreview ( ) ;
2017-05-03 02:03:28 +12:00
FTPRefreshNames ( ) ;
2017-04-21 04:38:20 +12:00
}
}
private void nudFTPPort_ValueChanged ( object sender , EventArgs e )
{
FTPAccount account = FTPGetSelectedAccount ( ) ;
if ( account ! = null )
{
account . Port = ( int ) nudFTPPort . Value ;
FTPUpdateURLPreview ( ) ;
}
}
private void txtFTPUsername_TextChanged ( object sender , EventArgs e )
{
FTPAccount account = FTPGetSelectedAccount ( ) ;
if ( account ! = null )
{
account . Username = txtFTPUsername . Text ;
}
}
private void txtFTPPassword_TextChanged ( object sender , EventArgs e )
{
FTPAccount account = FTPGetSelectedAccount ( ) ;
if ( account ! = null )
{
account . Password = txtFTPPassword . Text ;
}
}
private void rbFTPTransferModePassive_CheckedChanged ( object sender , EventArgs e )
{
FTPAccount account = FTPGetSelectedAccount ( ) ;
if ( account ! = null )
{
account . IsActive = false ;
}
}
private void rbFTPTransferModeActive_CheckedChanged ( object sender , EventArgs e )
{
FTPAccount account = FTPGetSelectedAccount ( ) ;
if ( account ! = null )
{
account . IsActive = true ;
}
}
private void txtFTPRemoteDirectory_TextChanged ( object sender , EventArgs e )
{
FTPAccount account = FTPGetSelectedAccount ( ) ;
if ( account ! = null )
{
account . SubFolderPath = txtFTPRemoteDirectory . Text ;
FTPUpdateURLPreview ( ) ;
}
}
private void cbFTPURLPathProtocol_SelectedIndexChanged ( object sender , EventArgs e )
{
FTPAccount account = FTPGetSelectedAccount ( ) ;
if ( account ! = null )
{
account . BrowserProtocol = ( BrowserProtocol ) cbFTPURLPathProtocol . SelectedIndex ;
FTPUpdateURLPreview ( ) ;
}
}
private void txtFTPURLPath_TextChanged ( object sender , EventArgs e )
{
FTPAccount account = FTPGetSelectedAccount ( ) ;
if ( account ! = null )
{
account . HttpHomePath = txtFTPURLPath . Text ;
FTPUpdateURLPreview ( ) ;
}
}
private void cbFTPAppendRemoteDirectory_CheckedChanged ( object sender , EventArgs e )
{
FTPAccount account = FTPGetSelectedAccount ( ) ;
if ( account ! = null )
{
account . HttpHomePathAutoAddSubFolderPath = cbFTPAppendRemoteDirectory . Checked ;
FTPUpdateURLPreview ( ) ;
}
}
private void cbFTPRemoveFileExtension_CheckedChanged ( object sender , EventArgs e )
{
FTPAccount account = FTPGetSelectedAccount ( ) ;
if ( account ! = null )
{
account . HttpHomePathNoExtension = cbFTPRemoveFileExtension . Checked ;
FTPUpdateURLPreview ( ) ;
}
}
2017-04-21 07:44:50 +12:00
private void cbFTPSEncryption_SelectedIndexChanged ( object sender , EventArgs e )
{
FTPAccount account = FTPGetSelectedAccount ( ) ;
if ( account ! = null )
{
account . FTPSEncryption = ( FTPSEncryption ) cbFTPSEncryption . SelectedIndex ;
}
}
private void txtFTPSCertificateLocation_TextChanged ( object sender , EventArgs e )
{
FTPAccount account = FTPGetSelectedAccount ( ) ;
if ( account ! = null )
{
account . FTPSCertificateLocation = txtFTPSCertificateLocation . Text ;
}
}
private void btnFTPSCertificateLocationBrowse_Click ( object sender , EventArgs e )
{
FTPAccount account = FTPGetSelectedAccount ( ) ;
if ( account ! = null )
{
using ( OpenFileDialog dlg = new OpenFileDialog ( ) )
{
dlg . Title = Resources . CertFileNameEditor_EditValue_Browse_for_a_certificate_file___ ;
dlg . Filter = "Certificate file (*.cer)|*.cer" ;
if ( dlg . ShowDialog ( ) = = DialogResult . OK )
{
txtFTPSCertificateLocation . Text = dlg . FileName ;
}
}
}
}
private void txtSFTPKeyLocation_TextChanged ( object sender , EventArgs e )
{
FTPAccount account = FTPGetSelectedAccount ( ) ;
if ( account ! = null )
{
account . Keypath = txtSFTPKeyLocation . Text ;
}
}
private void btnSFTPKeyLocationBrowse_Click ( object sender , EventArgs e )
{
FTPAccount account = FTPGetSelectedAccount ( ) ;
if ( account ! = null )
{
using ( OpenFileDialog dlg = new OpenFileDialog ( ) )
{
dlg . Title = Resources . KeyFileNameEditor_EditValue_Browse_for_a_key_file___ ;
dlg . Filter = "Key file (*.*)|*.*" ;
if ( dlg . ShowDialog ( ) = = DialogResult . OK )
{
txtSFTPKeyLocation . Text = dlg . FileName ;
}
}
}
}
private void txtSFTPKeyPassphrase_TextChanged ( object sender , EventArgs e )
{
FTPAccount account = FTPGetSelectedAccount ( ) ;
if ( account ! = null )
{
account . Passphrase = txtSFTPKeyPassphrase . Text ;
}
}
2018-08-04 01:38:18 +12:00
private async void btnFTPTest_Click ( object sender , EventArgs e )
2016-06-12 08:19:29 +12:00
{
2017-04-21 01:56:16 +12:00
FTPAccount account = FTPGetSelectedAccount ( ) ;
2016-06-12 08:19:29 +12:00
2017-04-21 01:56:16 +12:00
if ( account ! = null )
2016-06-12 08:19:29 +12:00
{
2018-08-04 01:38:18 +12:00
await FTPTestAccountAsync ( account ) ;
2017-04-21 01:56:16 +12:00
}
else
{
MessageBox . Show ( Resources . UploadersConfigForm_FTPOpenClient_Unable_to_find_valid_FTP_account_ , "ShareX" , MessageBoxButtons . OK , MessageBoxIcon . Information ) ;
}
2016-06-12 08:19:29 +12:00
}
2017-04-21 01:56:16 +12:00
private object eiFTP_ExportRequested ( )
2016-06-12 08:19:29 +12:00
{
2017-04-21 01:56:16 +12:00
return FTPGetSelectedAccount ( ) ;
2016-06-12 08:19:29 +12:00
}
2017-04-21 01:56:16 +12:00
private void eiFTP_ImportRequested ( object obj )
2016-06-12 08:19:29 +12:00
{
2017-04-21 01:56:16 +12:00
FTPAddAccount ( obj as FTPAccount ) ;
2016-06-12 08:19:29 +12:00
}
#endregion FTP
2015-06-08 01:34:33 +12:00
#region Dropbox
private void oauth2Dropbox_OpenButtonClicked ( )
{
2018-05-17 13:14:17 +12:00
OAuth2Info oauth = new OAuth2Info ( APIKeys . DropboxConsumerKey , APIKeys . DropboxConsumerSecret ) ;
Config . DropboxOAuth2Info = OAuth2Open ( new Dropbox ( oauth ) ) ;
2015-06-08 01:34:33 +12:00
}
private void oauth2Dropbox_CompleteButtonClicked ( string code )
{
2018-05-17 13:14:17 +12:00
OAuth2Complete ( new Dropbox ( Config . DropboxOAuth2Info ) , code , oauth2Dropbox ) ;
2015-06-08 01:34:33 +12:00
}
private void oauth2Dropbox_ClearButtonClicked ( )
{
Config . DropboxOAuth2Info = null ;
}
private void txtDropboxPath_TextChanged ( object sender , EventArgs e )
{
Config . DropboxUploadPath = txtDropboxPath . Text ;
}
private void cbDropboxAutoCreateShareableLink_CheckedChanged ( object sender , EventArgs e )
{
Config . DropboxAutoCreateShareableLink = cbDropboxAutoCreateShareableLink . Checked ;
2017-03-19 19:52:03 +13:00
cbDropboxUseDirectLink . Enabled = Config . DropboxAutoCreateShareableLink ;
2015-06-08 01:34:33 +12:00
}
2017-03-19 19:52:03 +13:00
private void cbDropboxUseDirectLink_CheckedChanged ( object sender , EventArgs e )
2015-06-08 01:34:33 +12:00
{
2017-03-19 19:52:03 +13:00
Config . DropboxUseDirectLink = cbDropboxUseDirectLink . Checked ;
2015-06-08 01:34:33 +12:00
}
#endregion Dropbox
#region OneDrive
private void oAuth2OneDrive_OpenButtonClicked ( )
{
2018-05-17 13:14:17 +12:00
OAuth2Info oauth = new OAuth2Info ( APIKeys . OneDriveClientID , APIKeys . OneDriveClientSecret ) ;
oauth . Proof = new OAuth2ProofKey ( OAuth2ChallengeMethod . SHA256 ) ;
Config . OneDriveV2OAuth2Info = OAuth2Open ( new OneDrive ( oauth ) ) ;
2015-06-08 01:34:33 +12:00
}
private void oAuth2OneDrive_CompleteButtonClicked ( string code )
{
2018-05-17 13:14:17 +12:00
tvOneDrive . Enabled = OAuth2Complete ( new OneDrive ( Config . OneDriveV2OAuth2Info ) , code , oAuth2OneDrive ) ;
2015-06-08 01:34:33 +12:00
}
private void oAuth2OneDrive_RefreshButtonClicked ( )
{
2018-05-17 13:14:17 +12:00
tvOneDrive . Enabled = OAuth2Refresh ( new OneDrive ( Config . OneDriveV2OAuth2Info ) , oAuth2OneDrive ) ;
2015-06-08 01:34:33 +12:00
}
private void oAuth2OneDrive_ClearButtonClicked ( )
{
2018-04-14 03:10:58 +12:00
Config . OneDriveV2OAuth2Info = null ;
2015-06-08 01:34:33 +12:00
}
private void cbOneDriveCreateShareableLink_CheckedChanged ( object sender , EventArgs e )
{
Config . OneDriveAutoCreateShareableLink = cbOneDriveCreateShareableLink . Checked ;
2023-10-13 00:33:23 +13:00
cbOneDriveUseDirectLink . Enabled = cbOneDriveCreateShareableLink . Checked ;
}
private void cbOneDriveUseDirectLink_CheckedChanged ( object sender , EventArgs e )
{
Config . OneDriveUseDirectLink = cbOneDriveUseDirectLink . Checked ;
2015-06-08 01:34:33 +12:00
}
private void tvOneDrive_AfterSelect ( object sender , TreeViewEventArgs e )
{
2021-06-10 10:14:01 +12:00
if ( e . Node . Tag is OneDriveFileInfo file )
2015-06-08 01:34:33 +12:00
{
lblOneDriveFolderID . Text = Resources . UploadersConfigForm_LoadSettings_Selected_folder_ + " " + file . name ;
2018-04-14 03:10:58 +12:00
Config . OneDriveV2SelectedFolder = file ;
2015-06-08 01:34:33 +12:00
}
}
private void tvOneDrive_AfterExpand ( object sender , TreeViewEventArgs e )
{
2021-06-10 10:14:01 +12:00
if ( e . Node . Tag is OneDriveFileInfo file )
2015-06-08 01:34:33 +12:00
{
OneDriveListFolders ( file , e . Node ) ;
}
}
#endregion OneDrive
#region Google Drive
2022-12-11 00:19:34 +13:00
private void oauth2GoogleDrive_ConnectButtonClicked ( )
2015-06-08 01:34:33 +12:00
{
2018-05-16 21:40:15 +12:00
OAuth2Info oauth = new OAuth2Info ( APIKeys . GoogleClientID , APIKeys . GoogleClientSecret ) ;
2022-12-11 00:19:34 +13:00
IOAuth2Loopback oauthLoopback = new GoogleDrive ( oauth ) . OAuth2 ;
2015-06-08 01:34:33 +12:00
2022-12-11 00:19:34 +13:00
using ( OAuthListenerForm form = new OAuthListenerForm ( oauthLoopback ) )
{
form . ShowDialog ( ) ;
Config . GoogleDriveOAuth2Info = form . OAuth2Info ;
Config . GoogleDriveUserInfo = form . UserInfo ;
}
2015-06-08 01:34:33 +12:00
2022-12-11 02:10:35 +13:00
oauth2GoogleDrive . UpdateStatus ( Config . GoogleDriveOAuth2Info , Config . GoogleDriveUserInfo ) ;
2024-04-22 18:00:17 +12:00
//btnGoogleDriveRefreshFolders.Enabled = oauth2GoogleDrive.Connected;
2022-12-11 02:10:35 +13:00
2022-12-11 00:19:34 +13:00
this . ForceActivate ( ) ;
2015-06-08 01:34:33 +12:00
}
2022-12-11 00:19:34 +13:00
private void oauth2GoogleDrive_DisconnectButtonClicked ( )
2015-06-08 01:34:33 +12:00
{
Config . GoogleDriveOAuth2Info = null ;
2022-12-11 00:19:34 +13:00
Config . GoogleDriveUserInfo = null ;
2015-06-08 01:34:33 +12:00
}
private void cbGoogleDriveIsPublic_CheckedChanged ( object sender , EventArgs e )
{
Config . GoogleDriveIsPublic = cbGoogleDriveIsPublic . Checked ;
}
2016-06-11 22:11:58 +12:00
private void cbGoogleDriveDirectLink_CheckedChanged ( object sender , EventArgs e )
{
Config . GoogleDriveDirectLink = cbGoogleDriveDirectLink . Checked ;
}
2015-06-08 01:34:33 +12:00
private void cbGoogleDriveUseFolder_CheckedChanged ( object sender , EventArgs e )
{
Config . GoogleDriveUseFolder = cbGoogleDriveUseFolder . Checked ;
txtGoogleDriveFolderID . Enabled = Config . GoogleDriveUseFolder ;
2024-04-22 18:00:17 +12:00
btnGoogleDriveFolderIDHelp . Enabled = Config . GoogleDriveUseFolder ;
2015-06-08 01:34:33 +12:00
}
private void txtGoogleDriveFolderID_TextChanged ( object sender , EventArgs e )
{
Config . GoogleDriveFolderID = txtGoogleDriveFolderID . Text ;
}
2024-04-22 18:00:17 +12:00
private void btnGoogleDriveFolderIDHelp_Click ( object sender , EventArgs e )
{
MessageBox . Show ( @ "Unfortunately, Google has forced us to use a more restrictive API scope, which does not allow us to see files or folders anymore. Because of this, we cannot provide folder listing and selection anymore.
However , there is a workaround . You can navigate to the Google Drive website in your browser , open the folder you want to upload to , and then copy the folder ID from the browser ' s address bar to here . ",
"ShareX - Google Drive" , MessageBoxButtons . OK , MessageBoxIcon . Question ) ;
}
2015-06-08 01:34:33 +12:00
private void btnGoogleDriveRefreshFolders_Click ( object sender , EventArgs e )
{
GoogleDriveRefreshFolders ( ) ;
2020-06-08 15:56:14 +12:00
GoogleDriveRefreshDrives ( ) ;
2015-06-08 01:34:33 +12:00
}
private void lvGoogleDriveFoldersList_SelectedIndexChanged ( object sender , EventArgs e )
{
if ( lvGoogleDriveFoldersList . SelectedItems . Count > 0 )
{
ListViewItem lvi = lvGoogleDriveFoldersList . SelectedItems [ 0 ] ;
2021-06-10 10:14:01 +12:00
if ( lvi . Tag is GoogleDriveFile folder )
2015-06-08 01:34:33 +12:00
{
txtGoogleDriveFolderID . Text = folder . id ;
}
}
}
2020-06-08 15:56:14 +12:00
private void cbGoogleDriveSharedDrive_SelectedIndexChanged ( object sender , EventArgs e )
{
GoogleDriveSharedDrive selectedDrive = cbGoogleDriveSharedDrive . SelectedItem as GoogleDriveSharedDrive ;
Config . GoogleDriveSelectedDrive = selectedDrive ;
}
2015-06-08 01:34:33 +12:00
#endregion Google Drive
2016-06-12 08:19:29 +12:00
#region puush
2016-06-23 20:43:45 +12:00
private bool PuushValidationCheck ( )
2016-06-12 08:19:29 +12:00
{
bool result = true ;
if ( string . IsNullOrEmpty ( txtPuushEmail . Text ) )
{
txtPuushEmail . BackColor = Color . FromArgb ( 255 , 200 , 200 ) ;
result = false ;
}
2016-06-23 20:43:45 +12:00
else
{
txtPuushEmail . BackColor = SystemColors . Window ;
}
2016-06-12 08:19:29 +12:00
if ( string . IsNullOrEmpty ( txtPuushPassword . Text ) )
{
txtPuushPassword . BackColor = Color . FromArgb ( 255 , 200 , 200 ) ;
result = false ;
}
2016-06-23 20:43:45 +12:00
else
{
txtPuushPassword . BackColor = SystemColors . Window ;
}
2016-06-12 08:19:29 +12:00
2016-06-23 20:43:45 +12:00
return result ;
}
private void llPuushForgottenPassword_LinkClicked ( object sender , LinkLabelLinkClickedEventArgs e )
{
URLHelpers . OpenURL ( Puush . PuushResetPasswordURL ) ;
}
private void btnPuushLogin_Click ( object sender , EventArgs e )
{
if ( PuushValidationCheck ( ) )
2016-06-12 08:19:29 +12:00
{
txtPuushAPIKey . Text = "" ;
string apiKey = new Puush ( ) . Login ( txtPuushEmail . Text , txtPuushPassword . Text ) ;
if ( ! string . IsNullOrEmpty ( apiKey ) )
{
txtPuushAPIKey . Text = apiKey ;
}
else
{
MessageBox . Show ( "Login failed." , "Authentication failure" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
}
}
}
private void txtPuushAPIKey_TextChanged ( object sender , EventArgs e )
{
Config . PuushAPIKey = txtPuushAPIKey . Text ;
}
#endregion puush
2015-06-08 01:34:33 +12:00
#region Box
private void oauth2Box_OpenButtonClicked ( )
{
2018-05-17 13:14:17 +12:00
OAuth2Info oauth = new OAuth2Info ( APIKeys . BoxClientID , APIKeys . BoxClientSecret ) ;
Config . BoxOAuth2Info = OAuth2Open ( new Box ( oauth ) ) ;
2015-06-08 01:34:33 +12:00
}
private void oauth2Box_CompleteButtonClicked ( string code )
{
2018-05-17 13:14:17 +12:00
btnBoxRefreshFolders . Enabled = OAuth2Complete ( new Box ( Config . BoxOAuth2Info ) , code , oauth2Box ) ;
2015-06-08 01:34:33 +12:00
}
private void oauth2Box_RefreshButtonClicked ( )
{
2018-05-17 13:14:17 +12:00
btnBoxRefreshFolders . Enabled = OAuth2Refresh ( new Box ( Config . BoxOAuth2Info ) , oauth2Box ) ;
2015-06-08 01:34:33 +12:00
}
private void oauth2Box_ClearButtonClicked ( )
{
Config . BoxOAuth2Info = null ;
}
private void cbBoxShare_CheckedChanged ( object sender , EventArgs e )
{
Config . BoxShare = cbBoxShare . Checked ;
2020-05-16 08:46:47 +12:00
cbBoxShareAccessLevel . Enabled = Config . BoxShare ;
lblBoxShareAccessLevel . Enabled = Config . BoxShare ;
}
private void cbBoxShareAccessLevel_SelectedIndexChanged ( object sender , EventArgs e )
{
Config . BoxShareAccessLevel = ( BoxShareAccessLevel ) cbBoxShareAccessLevel . SelectedIndex ;
2015-06-08 01:34:33 +12:00
}
private void btnBoxRefreshFolders_Click ( object sender , EventArgs e )
{
BoxListFolders ( ) ;
}
private void lvBoxFolders_SelectedIndexChanged ( object sender , EventArgs e )
{
if ( lvBoxFolders . SelectedItems . Count > 0 )
{
ListViewItem lvi = lvBoxFolders . SelectedItems [ 0 ] ;
2021-06-10 10:14:01 +12:00
if ( lvi . Tag is BoxFileEntry file )
2015-06-08 01:34:33 +12:00
{
lblBoxFolderID . Text = Resources . UploadersConfigForm_LoadSettings_Selected_folder_ + " " + file . name ;
Config . BoxSelectedFolder = file ;
}
}
}
private void lvBoxFolders_MouseDoubleClick ( object sender , MouseEventArgs e )
{
if ( e . Button = = MouseButtons . Left & & lvBoxFolders . SelectedItems . Count > 0 )
{
ListViewItem lvi = lvBoxFolders . SelectedItems [ 0 ] ;
2021-06-10 10:14:01 +12:00
if ( lvi . Tag is BoxFileEntry file )
2015-06-08 01:34:33 +12:00
{
lvBoxFolders . Items . Clear ( ) ;
BoxListFolders ( file ) ;
}
}
}
#endregion Box
#region Email
private void txtSmtpServer_TextChanged ( object sender , EventArgs e )
{
Config . EmailSmtpServer = txtEmailSmtpServer . Text ;
}
private void nudSmtpPort_ValueChanged ( object sender , EventArgs e )
{
Config . EmailSmtpPort = ( int ) nudEmailSmtpPort . Value ;
}
private void txtEmail_TextChanged ( object sender , EventArgs e )
{
Config . EmailFrom = txtEmailFrom . Text ;
}
private void txtPassword_TextChanged ( object sender , EventArgs e )
{
Config . EmailPassword = txtEmailPassword . Text ;
}
private void cbRememberLastToEmail_CheckedChanged ( object sender , EventArgs e )
{
Config . EmailRememberLastTo = cbEmailRememberLastTo . Checked ;
}
private void txtDefaultSubject_TextChanged ( object sender , EventArgs e )
{
Config . EmailDefaultSubject = txtEmailDefaultSubject . Text ;
}
private void txtDefaultBody_TextChanged ( object sender , EventArgs e )
{
Config . EmailDefaultBody = txtEmailDefaultBody . Text ;
}
2016-05-25 06:50:26 +12:00
private void cbEmailAutomaticSend_CheckedChanged ( object sender , EventArgs e )
{
Config . EmailAutomaticSend = cbEmailAutomaticSend . Checked ;
txtEmailAutomaticSendTo . Enabled = Config . EmailAutomaticSend ;
}
private void txtEmailAutomaticSendTo_TextChanged ( object sender , EventArgs e )
{
Config . EmailAutomaticSendTo = txtEmailAutomaticSendTo . Text ;
}
2015-06-08 01:34:33 +12:00
#endregion Email
#region SendSpace
private void atcSendSpaceAccountType_AccountTypeChanged ( AccountType accountType )
{
Config . SendSpaceAccountType = accountType ;
}
private void btnSendSpaceRegister_Click ( object sender , EventArgs e )
{
using ( UserPassBox upb = SendSpaceRegister ( ) )
{
if ( upb . Success )
{
txtSendSpaceUserName . Text = upb . UserName ;
txtSendSpacePassword . Text = upb . Password ;
atcSendSpaceAccountType . SelectedAccountType = AccountType . User ;
}
}
}
private void txtSendSpaceUserName_TextChanged ( object sender , EventArgs e )
{
Config . SendSpaceUsername = txtSendSpaceUserName . Text ;
}
private void txtSendSpacePassword_TextChanged ( object sender , EventArgs e )
{
Config . SendSpacePassword = txtSendSpacePassword . Text ;
}
#endregion SendSpace
#region Localhostr
private void txtLocalhostrEmail_TextChanged ( object sender , EventArgs e )
{
Config . LocalhostrEmail = txtLocalhostrEmail . Text ;
}
private void txtLocalhostrPassword_TextChanged ( object sender , EventArgs e )
{
Config . LocalhostrPassword = txtLocalhostrPassword . Text ;
}
private void cbLocalhostrDirectURL_CheckedChanged ( object sender , EventArgs e )
{
Config . LocalhostrDirectURL = cbLocalhostrDirectURL . Checked ;
}
#endregion Localhostr
#region Jira
private void txtJiraHost_TextChanged ( object sender , EventArgs e )
{
Config . JiraHost = txtJiraHost . Text ;
}
private void txtJiraIssuePrefix_TextChanged ( object sender , EventArgs e )
{
Config . JiraIssuePrefix = txtJiraIssuePrefix . Text ;
}
private void oAuthJira_OpenButtonClicked ( )
{
JiraAuthOpen ( ) ;
}
private void oAuthJira_CompleteButtonClicked ( string code )
{
JiraAuthComplete ( code ) ;
}
private void oAuthJira_ClearButtonClicked ( )
{
Config . JiraOAuthInfo = null ;
}
private void oAuthJira_RefreshButtonClicked ( )
{
MessageBox . Show ( Resources . UploadersConfigForm_oAuthJira_RefreshButtonClicked_Refresh_authorization_is_not_supported_ , "ShareX" , MessageBoxButtons . OK , MessageBoxIcon . Information ) ;
}
#endregion Jira
#region Mega
private void MegaConfigureTab ( bool tryLogin )
{
Color OkColor = Color . Green ;
Color NokColor = Color . DarkRed ;
tpMega . Enabled = false ;
if ( Config . MegaAuthInfos ! = null )
{
txtMegaEmail . Text = Config . MegaAuthInfos . Email ;
}
if ( Config . MegaAuthInfos = = null )
{
lblMegaStatus . Text = Resources . UploadersConfigForm_MegaConfigureTab_Not_configured ;
lblMegaStatus . ForeColor = NokColor ;
}
else
{
cbMegaFolder . Items . Clear ( ) ;
2020-06-01 13:17:04 +12:00
Mega mega = new Mega ( Config . MegaAuthInfos ? . GetMegaApiClientAuthInfos ( ) ) ;
2015-06-08 01:34:33 +12:00
if ( ! tryLogin | | mega . TryLogin ( ) )
{
lblMegaStatus . Text = Resources . UploadersConfigForm_MegaConfigureTab_Configured ;
lblMegaStatus . ForeColor = OkColor ;
if ( tryLogin )
{
Mega . DisplayNode [ ] nodes = mega . GetDisplayNodes ( ) . ToArray ( ) ;
cbMegaFolder . Items . AddRange ( nodes ) ;
cbMegaFolder . SelectedItem = nodes . FirstOrDefault ( n = > n . Node ! = null & & n . Node . Id = = Config . MegaParentNodeId ) ? ? Mega . DisplayNode . EmptyNode ;
}
else
{
cbMegaFolder . Items . Add ( "[" + Resources . UploadersConfigForm_MegaConfigureTab_Click_refresh_button + "]" ) ;
cbMegaFolder . SelectedIndex = 0 ;
}
}
else
{
lblMegaStatus . Text = Resources . UploadersConfigForm_MegaConfigureTab_Invalid_authentication ;
lblMegaStatus . ForeColor = NokColor ;
}
}
tpMega . Enabled = true ;
}
private void btnMegaLogin_Click ( object sender , EventArgs e )
{
if ( string . IsNullOrEmpty ( txtMegaEmail . Text ) | | string . IsNullOrEmpty ( txtMegaPassword . Text ) )
{
return ;
}
2020-06-01 13:17:04 +12:00
MegaApiClient . AuthInfos megaAuthInfos = new MegaApiClient ( ) . GenerateAuthInfos ( txtMegaEmail . Text , txtMegaPassword . Text ) ;
if ( megaAuthInfos ! = null )
{
Config . MegaAuthInfos = new MegaAuthInfos ( megaAuthInfos ) ;
}
else
{
Config . MegaAuthInfos = null ;
}
2015-06-08 01:34:33 +12:00
MegaConfigureTab ( true ) ;
}
private void cbMegaFolder_SelectedIndexChanged ( object sender , EventArgs e )
{
2021-06-10 10:14:01 +12:00
if ( ( ( ComboBox ) sender ) . SelectedItem is Mega . DisplayNode selectedNode )
2015-06-08 01:34:33 +12:00
{
Config . MegaParentNodeId = selectedNode = = Mega . DisplayNode . EmptyNode ? null : selectedNode . Node . Id ;
}
}
private void btnMegaRegister_Click ( object sender , EventArgs e )
{
URLHelpers . OpenURL ( "https://mega.co.nz/#register" ) ;
}
private void btnMegaRefreshFolders_Click ( object sender , EventArgs e )
{
MegaConfigureTab ( true ) ;
}
#endregion Mega
#region Amazon S3
private void txtAmazonS3AccessKey_TextChanged ( object sender , EventArgs e )
{
Config . AmazonS3Settings . AccessKeyID = txtAmazonS3AccessKey . Text ;
}
private void btnAmazonS3AccessKeyOpen_Click ( object sender , EventArgs e )
{
URLHelpers . OpenURL ( "https://console.aws.amazon.com/iam/home?#security_credential" ) ;
}
private void txtAmazonS3SecretKey_TextChanged ( object sender , EventArgs e )
{
Config . AmazonS3Settings . SecretAccessKey = txtAmazonS3SecretKey . Text ;
}
2017-03-21 00:26:44 +13:00
private void cbAmazonS3Endpoints_SelectedIndexChanged ( object sender , EventArgs e )
2017-03-17 13:15:19 +13:00
{
2021-06-10 10:14:01 +12:00
if ( cbAmazonS3Endpoints . SelectedItem is AmazonS3Endpoint endpoint )
2017-03-17 13:15:19 +13:00
{
2017-03-21 19:31:47 +13:00
txtAmazonS3Region . Text = endpoint . Region ;
txtAmazonS3Endpoint . Text = endpoint . Endpoint ;
2017-03-17 13:15:19 +13:00
}
}
2017-03-21 00:26:44 +13:00
private void txtAmazonS3Endpoint_TextChanged ( object sender , EventArgs e )
2015-06-08 01:34:33 +12:00
{
2017-03-21 00:26:44 +13:00
Config . AmazonS3Settings . Endpoint = txtAmazonS3Endpoint . Text ;
2017-03-17 13:15:19 +13:00
UpdateAmazonS3Status ( ) ;
}
2017-03-21 00:26:44 +13:00
private void txtAmazonS3Region_TextChanged ( object sender , EventArgs e )
2017-03-17 13:15:19 +13:00
{
2017-03-21 00:26:44 +13:00
Config . AmazonS3Settings . Region = txtAmazonS3Region . Text ;
2017-03-17 13:15:19 +13:00
UpdateAmazonS3Status ( ) ;
2015-06-08 01:34:33 +12:00
}
2017-03-21 00:56:11 +13:00
private void cbAmazonS3UsePathStyle_CheckedChanged ( object sender , EventArgs e )
{
Config . AmazonS3Settings . UsePathStyle = cbAmazonS3UsePathStyle . Checked ;
}
2015-06-08 01:34:33 +12:00
private void txtAmazonS3BucketName_TextChanged ( object sender , EventArgs e )
{
Config . AmazonS3Settings . Bucket = txtAmazonS3BucketName . Text ;
UpdateAmazonS3Status ( ) ;
}
private void btnAmazonS3BucketNameOpen_Click ( object sender , EventArgs e )
{
URLHelpers . OpenURL ( "https://console.aws.amazon.com/s3/home" ) ;
}
private void txtAmazonS3ObjectPrefix_TextChanged ( object sender , EventArgs e )
{
Config . AmazonS3Settings . ObjectPrefix = txtAmazonS3ObjectPrefix . Text ;
UpdateAmazonS3Status ( ) ;
}
private void cbAmazonS3CustomCNAME_CheckedChanged ( object sender , EventArgs e )
{
Config . AmazonS3Settings . UseCustomCNAME = cbAmazonS3CustomCNAME . Checked ;
txtAmazonS3CustomDomain . Enabled = Config . AmazonS3Settings . UseCustomCNAME ;
UpdateAmazonS3Status ( ) ;
}
private void txtAmazonS3CustomDomain_TextChanged ( object sender , EventArgs e )
{
Config . AmazonS3Settings . CustomDomain = txtAmazonS3CustomDomain . Text ;
UpdateAmazonS3Status ( ) ;
}
2017-09-29 04:25:41 +13:00
private void cbAmazonS3StorageClass_SelectedIndexChanged ( object sender , EventArgs e )
2015-06-08 01:34:33 +12:00
{
2017-09-29 04:25:41 +13:00
Config . AmazonS3Settings . StorageClass = ( AmazonS3StorageClass ) cbAmazonS3StorageClass . SelectedIndex ;
}
private void btnAmazonS3StorageClassHelp_Click ( object sender , EventArgs e )
{
2018-08-08 00:45:56 +12:00
URLHelpers . OpenURL ( "https://aws.amazon.com/s3/storage-classes/" ) ;
2015-06-08 01:34:33 +12:00
}
2017-12-20 06:57:10 +13:00
private void cbAmazonS3PublicACL_CheckedChanged ( object sender , EventArgs e )
2017-12-20 06:55:11 +13:00
{
Config . AmazonS3Settings . SetPublicACL = cbAmazonS3PublicACL . Checked ;
}
2018-12-05 05:10:01 +13:00
private void cbAmazonS3SignedPayload_CheckedChanged ( object sender , EventArgs e )
{
Config . AmazonS3Settings . SignedPayload = cbAmazonS3SignedPayload . Checked ;
}
2018-02-02 08:55:23 +13:00
private void cbAmazonS3StripExtensionImage_CheckedChanged ( object sender , EventArgs e )
{
Config . AmazonS3Settings . RemoveExtensionImage = cbAmazonS3StripExtensionImage . Checked ;
2019-01-28 07:36:16 +13:00
UpdateAmazonS3Status ( ) ;
2018-02-02 08:55:23 +13:00
}
private void cbAmazonS3StripExtensionVideo_CheckedChanged ( object sender , EventArgs e )
{
Config . AmazonS3Settings . RemoveExtensionVideo = cbAmazonS3StripExtensionVideo . Checked ;
2019-01-28 07:36:16 +13:00
UpdateAmazonS3Status ( ) ;
2018-02-02 08:55:23 +13:00
}
private void cbAmazonS3StripExtensionText_CheckedChanged ( object sender , EventArgs e )
{
Config . AmazonS3Settings . RemoveExtensionText = cbAmazonS3StripExtensionText . Checked ;
2019-01-28 07:36:16 +13:00
UpdateAmazonS3Status ( ) ;
2018-02-02 08:55:23 +13:00
}
2015-06-08 01:34:33 +12:00
#endregion Amazon S3
2018-01-29 21:44:06 +13:00
#region ownCloud / Nextcloud
2015-06-08 01:34:33 +12:00
private void txtOwnCloudHost_TextChanged ( object sender , EventArgs e )
{
Config . OwnCloudHost = txtOwnCloudHost . Text ;
}
private void txtOwnCloudUsername_TextChanged ( object sender , EventArgs e )
{
Config . OwnCloudUsername = txtOwnCloudUsername . Text ;
}
private void txtOwnCloudPassword_TextChanged ( object sender , EventArgs e )
{
Config . OwnCloudPassword = txtOwnCloudPassword . Text ;
}
private void txtOwnCloudPath_TextChanged ( object sender , EventArgs e )
{
Config . OwnCloudPath = txtOwnCloudPath . Text ;
}
2018-09-11 04:55:07 +12:00
private void txtOwnExpiryTime_TextChanged ( object sender , EventArgs e )
{
2018-09-11 09:14:32 +12:00
Config . OwnCloudExpiryTime = Convert . ToInt32 ( txtOwnCloudExpiryTime . Value ) ;
2018-09-11 04:55:07 +12:00
}
2015-06-08 01:34:33 +12:00
private void cbOwnCloudCreateShare_CheckedChanged ( object sender , EventArgs e )
{
Config . OwnCloudCreateShare = cbOwnCloudCreateShare . Checked ;
}
private void cbOwnCloudDirectLink_CheckedChanged ( object sender , EventArgs e )
{
Config . OwnCloudDirectLink = cbOwnCloudDirectLink . Checked ;
}
2021-12-29 02:35:47 +13:00
private void cbOwnCloudAppendFileNameToURL_CheckedChanged ( object sender , EventArgs e )
2021-10-27 01:27:57 +13:00
{
2021-12-29 02:35:47 +13:00
Config . OwnCloudAppendFileNameToURL = cbOwnCloudAppendFileNameToURL . Checked ;
2021-10-27 01:27:57 +13:00
}
2015-07-22 09:52:00 +12:00
private void cbOwnCloud81Compatibility_CheckedChanged ( object sender , EventArgs e )
{
Config . OwnCloud81Compatibility = cbOwnCloud81Compatibility . Checked ;
}
2018-03-25 09:20:15 +13:00
private void cbOwnCloudUsePreviewLinks_CheckedChanged ( object sender , EventArgs e )
{
Config . OwnCloudUsePreviewLinks = cbOwnCloudUsePreviewLinks . Checked ;
}
2018-09-11 04:55:07 +12:00
private void cbOwnCloudAutoExpire_CheckedChanged ( object sender , EventArgs e )
{
Config . OwnCloudAutoExpire = cbOwnCloudAutoExpire . Checked ;
}
2018-01-29 21:44:06 +13:00
#endregion ownCloud / Nextcloud
2015-06-08 01:34:33 +12:00
#region Pushbullet
private void txtPushbulletUserKey_TextChanged ( object sender , EventArgs e )
{
bool enable = ! string . IsNullOrEmpty ( txtPushbulletUserKey . Text . Trim ( ) ) ;
2021-08-30 22:01:36 +12:00
cbPushbulletDevices . Enabled = enable ;
2015-06-08 01:34:33 +12:00
btnPushbulletGetDeviceList . Enabled = enable ;
Config . PushbulletSettings . UserAPIKey = txtPushbulletUserKey . Text ;
}
2021-08-30 22:01:36 +12:00
private void cbPushbulletDevices_SelectedIndexChanged ( object sender , EventArgs e )
2015-06-08 01:34:33 +12:00
{
2021-08-30 22:01:36 +12:00
Config . PushbulletSettings . SelectedDevice = cbPushbulletDevices . SelectedIndex ;
2015-06-08 01:34:33 +12:00
}
private void btnPushbulletGetDeviceList_Click ( object sender , EventArgs e )
{
PushbulletGetDevices ( ) ;
}
#endregion Pushbullet
#region Shared folder
2021-08-30 22:01:36 +12:00
private void cbSharedFolderImages_SelectedIndexChanged ( object sender , EventArgs e )
2015-06-08 01:34:33 +12:00
{
2021-08-30 22:01:36 +12:00
Config . LocalhostSelectedImages = cbSharedFolderImages . SelectedIndex ;
2015-06-08 01:34:33 +12:00
}
2021-08-30 22:01:36 +12:00
private void cbSharedFolderText_SelectedIndexChanged ( object sender , EventArgs e )
2015-06-08 01:34:33 +12:00
{
2021-08-30 22:01:36 +12:00
Config . LocalhostSelectedText = cbSharedFolderText . SelectedIndex ;
2015-06-08 01:34:33 +12:00
}
2021-08-30 22:01:36 +12:00
private void cbSharedFolderFiles_SelectedIndexChanged ( object sender , EventArgs e )
2015-06-08 01:34:33 +12:00
{
2021-08-30 22:01:36 +12:00
Config . LocalhostSelectedFiles = cbSharedFolderFiles . SelectedIndex ;
2015-06-08 01:34:33 +12:00
}
2018-04-22 21:10:23 +12:00
private void btnSharedFolderAdd_Click ( object sender , EventArgs e )
2015-06-08 01:34:33 +12:00
{
2018-04-22 21:10:23 +12:00
LocalhostAccount acc = new LocalhostAccount ( ) ;
SharedFolderAddItem ( acc ) ;
2015-06-08 01:34:33 +12:00
}
2018-04-22 21:10:23 +12:00
private void btnSharedFolderRemove_Click ( object sender , EventArgs e )
2015-06-08 01:34:33 +12:00
{
2018-04-22 21:10:23 +12:00
int index = lbSharedFolderAccounts . SelectedIndex ;
SharedFolderRemoveItem ( index ) ;
2015-06-08 01:34:33 +12:00
}
2018-04-22 21:10:23 +12:00
private void btnSharedFolderDuplicate_Click ( object sender , EventArgs e )
2015-06-08 01:34:33 +12:00
{
2018-04-22 21:10:23 +12:00
LocalhostAccount account = ( LocalhostAccount ) lbSharedFolderAccounts . Items [ lbSharedFolderAccounts . SelectedIndex ] ;
LocalhostAccount clone = account . Clone ( ) ;
SharedFolderAddItem ( clone ) ;
2015-06-08 01:34:33 +12:00
}
2018-04-22 21:10:23 +12:00
private void lbSharedFolderAccounts_SelectedIndexChanged ( object sender , EventArgs e )
2015-06-08 01:34:33 +12:00
{
2018-04-22 21:10:23 +12:00
SharedFolderUpdateEnabledStates ( ) ;
if ( lbSharedFolderAccounts . SelectedIndex > - 1 )
{
pgSharedFolderAccount . SelectedObject = lbSharedFolderAccounts . Items [ lbSharedFolderAccounts . SelectedIndex ] ;
}
2015-06-08 01:34:33 +12:00
}
2018-04-22 21:10:23 +12:00
private void pgSharedFolderAccount_PropertyValueChanged ( object s , PropertyValueChangedEventArgs e )
2015-06-08 01:34:33 +12:00
{
2018-04-22 21:10:23 +12:00
SharedFolderUpdateControls ( ) ;
if ( lbSharedFolderAccounts . SelectedIndex > - 1 )
{
lbSharedFolderAccounts . Items [ lbSharedFolderAccounts . SelectedIndex ] = pgSharedFolderAccount . SelectedObject ;
}
2015-06-08 01:34:33 +12:00
}
#endregion Shared folder
#region MediaFire
private void txtMediaFireUsername_TextChanged ( object sender , EventArgs e )
{
Config . MediaFireUsername = txtMediaFireEmail . Text ;
}
private void txtMediaFirePassword_TextChanged ( object sender , EventArgs e )
{
Config . MediaFirePassword = txtMediaFirePassword . Text ;
}
private void txtMediaFirePath_TextChanged ( object sender , EventArgs e )
{
Config . MediaFirePath = txtMediaFirePath . Text ;
}
private void cbMediaFireUseLongLink_CheckedChanged ( object sender , EventArgs e )
{
Config . MediaFireUseLongLink = cbMediaFireUseLongLink . Checked ;
}
#endregion MediaFire
#region Lambda
private void lambdaInfoLabel_Click ( object sender , EventArgs e )
{
2015-10-15 07:24:11 +13:00
URLHelpers . OpenURL ( "https://lambda.sx/user/manage" ) ;
2015-06-08 01:34:33 +12:00
}
private void txtLambdaApiKey_TextChanged ( object sender , EventArgs e )
{
Config . LambdaSettings . UserAPIKey = txtLambdaApiKey . Text ;
}
2015-10-15 16:43:32 +13:00
private void cbLambdaUploadURL_SelectedIndexChanged ( object sender , EventArgs e )
{
2021-06-10 10:14:01 +12:00
if ( cbLambdaUploadURL . SelectedIndex > - 1 & & cbLambdaUploadURL . SelectedItem is string url )
2015-10-15 16:43:32 +13:00
{
2021-06-10 10:14:01 +12:00
Config . LambdaSettings . UploadURL = url ;
2015-10-15 16:43:32 +13:00
}
}
2015-06-08 01:34:33 +12:00
#endregion Lambda
2015-10-06 13:09:16 +13:00
#region Pomf
private void txtPomfUploadURL_TextChanged ( object sender , EventArgs e )
{
Config . PomfUploader . UploadURL = txtPomfUploadURL . Text ;
}
private void txtPomfResultURL_TextChanged ( object sender , EventArgs e )
{
Config . PomfUploader . ResultURL = txtPomfResultURL . Text ;
}
#endregion Pomf
2015-10-13 14:24:49 +13:00
#region Seafile
2015-10-13 19:44:51 +13:00
private void cbSeafileAPIURL_TextChanged ( object sender , EventArgs e )
2015-10-13 14:24:49 +13:00
{
2015-10-13 19:44:51 +13:00
Config . SeafileAPIURL = cbSeafileAPIURL . Text ;
2015-10-13 14:24:49 +13:00
}
private void btnSeafileCheckAPIURL_Click ( object sender , EventArgs e )
{
2015-10-13 19:44:51 +13:00
if ( string . IsNullOrEmpty ( cbSeafileAPIURL . Text ) )
2015-10-13 14:24:49 +13:00
{
return ;
}
2015-10-13 19:44:51 +13:00
Seafile sf = new Seafile ( cbSeafileAPIURL . Text , null , null ) ;
2015-10-13 14:24:49 +13:00
bool checkReturned = sf . CheckAPIURL ( ) ;
if ( checkReturned )
{
MessageBox . Show ( Resources . UploadersConfigForm_TestFTPAccount_Connected_ , "ShareX" , MessageBoxButtons . OK , MessageBoxIcon . Information ) ;
}
else
{
MessageBox . Show ( Resources . UploadersConfigForm_Error , "ShareX" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
}
}
private void txtSeafileAuthToken_TextChanged ( object sender , EventArgs e )
{
Config . SeafileAuthToken = txtSeafileAuthToken . Text ;
}
private void btnSeafileCheckAuthToken_Click ( object sender , EventArgs e )
{
2015-10-13 19:44:51 +13:00
if ( string . IsNullOrEmpty ( txtSeafileAuthToken . Text ) | | string . IsNullOrEmpty ( cbSeafileAPIURL . Text ) )
2015-10-13 14:24:49 +13:00
{
return ;
}
2015-10-13 19:44:51 +13:00
Seafile sf = new Seafile ( cbSeafileAPIURL . Text , txtSeafileAuthToken . Text , null ) ;
2015-10-13 14:24:49 +13:00
bool checkReturned = sf . CheckAuthToken ( ) ;
if ( checkReturned )
{
MessageBox . Show ( Resources . UploadersConfigForm_Login_successful , "ShareX" , MessageBoxButtons . OK , MessageBoxIcon . Information ) ;
}
else
{
MessageBox . Show ( Resources . UploadersConfigForm_Error , "ShareX" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
}
}
2015-10-13 16:54:19 +13:00
2015-10-13 14:24:49 +13:00
private void txtSeafilePassword_KeyUp ( object sender , KeyEventArgs e )
{
2015-10-13 16:54:19 +13:00
if ( e . KeyCode = = Keys . Return )
{
2015-10-13 14:24:49 +13:00
btnSeafileGetAuthToken . PerformClick ( ) ;
}
}
private void btnSeafileGetAuthToken_Click ( object sender , EventArgs e )
{
string username = txtSeafileUsername . Text ;
string password = txtSeafilePassword . Text ;
if ( ! string . IsNullOrEmpty ( username ) & & ! string . IsNullOrEmpty ( password ) )
{
try
{
2015-10-13 19:44:51 +13:00
Seafile sf = new Seafile ( cbSeafileAPIURL . Text , null , null ) ;
2015-10-13 14:24:49 +13:00
string authToken = sf . GetAuthToken ( username , password ) ;
if ( ! string . IsNullOrEmpty ( authToken ) )
{
txtSeafileUsername . Text = "" ;
txtSeafilePassword . Text = "" ;
Config . SeafileAuthToken = authToken ;
txtSeafileAuthToken . Text = authToken ;
btnRefreshSeafileAccInfo . PerformClick ( ) ;
Config . SeafileRepoID = sf . GetOrMakeDefaultLibrary ( authToken ) ;
txtSeafileUploadLocationRefresh . PerformClick ( ) ;
MessageBox . Show ( Resources . UploadersConfigForm_Login_successful , "ShareX" , MessageBoxButtons . OK , MessageBoxIcon . Information ) ;
}
else
{
MessageBox . Show ( Resources . UploadersConfigForm_Login_failed , "ShareX" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
}
}
catch ( Exception ex )
{
DebugHelper . WriteException ( ex ) ;
2017-04-22 08:42:52 +12:00
ex . ShowError ( ) ;
2015-10-13 14:24:49 +13:00
}
}
}
private void cbSeafileCreateShareableURL_CheckedChanged ( object sender , EventArgs e )
{
Config . SeafileCreateShareableURL = cbSeafileCreateShareableURL . Checked ;
2020-05-03 09:22:09 +12:00
cbSeafileCreateShareableURLRaw . Enabled = cbSeafileCreateShareableURL . Checked ;
2020-05-03 03:35:42 +12:00
}
2020-05-03 09:22:09 +12:00
private void cbSeafileCreateShareableURLRaw_CheckedChanged ( object sender , EventArgs e )
2020-05-03 03:35:42 +12:00
{
2020-05-03 09:22:09 +12:00
Config . SeafileCreateShareableURLRaw = cbSeafileCreateShareableURLRaw . Checked ;
2015-10-13 14:24:49 +13:00
}
private void cbSeafileIgnoreInvalidCert_CheckedChanged ( object sender , EventArgs e )
{
Config . SeafileIgnoreInvalidCert = cbSeafileIgnoreInvalidCert . Checked ;
}
private void btnRefreshSeafileAccInfo_Click ( object sender , EventArgs e )
{
2015-10-13 19:44:51 +13:00
if ( string . IsNullOrEmpty ( txtSeafileAuthToken . Text ) | | string . IsNullOrEmpty ( cbSeafileAPIURL . Text ) )
2015-10-13 14:24:49 +13:00
{
return ;
}
2015-10-13 19:44:51 +13:00
Seafile sf = new Seafile ( cbSeafileAPIURL . Text , txtSeafileAuthToken . Text , null ) ;
2016-09-17 19:07:02 +12:00
SeafileCheckAccInfoResponse SeafileCheckAccInfoResponse = sf . GetAccountInfo ( ) ;
2015-10-13 14:24:49 +13:00
if ( SeafileCheckAccInfoResponse = = null )
{
MessageBox . Show ( Resources . UploadersConfigForm_Login_failed , "ShareX" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
return ;
}
txtSeafileAccInfoEmail . Text = SeafileCheckAccInfoResponse . email ;
2015-10-13 19:44:51 +13:00
txtSeafileAccInfoUsage . Text = SeafileCheckAccInfoResponse . usage . ToSizeString ( ) + " / " + SeafileCheckAccInfoResponse . total . ToSizeString ( ) ;
2015-10-13 14:24:49 +13:00
}
private void txtSeafileUploadLocationRefresh_Click ( object sender , EventArgs e )
{
2015-10-13 19:44:51 +13:00
if ( string . IsNullOrEmpty ( txtSeafileAuthToken . Text ) | | string . IsNullOrEmpty ( cbSeafileAPIURL . Text ) )
2015-10-13 14:24:49 +13:00
{
return ;
}
lvSeafileLibraries . Items . Clear ( ) ;
2015-10-13 16:54:19 +13:00
2015-10-13 19:44:51 +13:00
Seafile sf = new Seafile ( cbSeafileAPIURL . Text , txtSeafileAuthToken . Text , null ) ;
2016-09-17 19:07:02 +12:00
List < SeafileLibraryObj > SeafileLibraries = sf . GetLibraries ( ) ;
2015-10-13 14:24:49 +13:00
2016-09-17 19:07:02 +12:00
foreach ( SeafileLibraryObj SeafileLibrary in SeafileLibraries )
2015-10-13 14:24:49 +13:00
{
2015-10-13 16:54:19 +13:00
if ( SeafileLibrary . permission = = "rw" )
2015-10-13 14:24:49 +13:00
{
ListViewItem libraryItem = lvSeafileLibraries . Items . Add ( SeafileLibrary . name ) ;
libraryItem . Name = SeafileLibrary . id ;
libraryItem . Tag = SeafileLibrary ;
2015-10-13 19:44:51 +13:00
libraryItem . SubItems . Add ( SeafileLibrary . size . ToSizeString ( ) ) ;
2015-10-13 14:24:49 +13:00
if ( SeafileLibrary . encrypted )
{
2015-10-13 19:44:51 +13:00
libraryItem . SubItems . Add ( "\u221A" ) ;
2015-10-13 14:24:49 +13:00
}
2015-10-13 16:54:19 +13:00
if ( SeafileLibrary . id = = Config . SeafileRepoID )
2015-10-13 14:24:49 +13:00
{
libraryItem . Selected = true ;
}
}
}
}
private void lvSeafileLibraries_SelectedIndexChanged ( object sender , EventArgs e )
{
int selIndex = lvSeafileLibraries . SelectedIndex ;
if ( selIndex > - 1 )
{
ListViewItem selectedItem = lvSeafileLibraries . Items [ selIndex ] ;
Config . SeafileRepoID = selectedItem . Name ;
2016-09-17 19:07:02 +12:00
SeafileLibraryObj SealileLibraryInfo = ( SeafileLibraryObj ) selectedItem . Tag ;
2015-10-13 14:24:49 +13:00
if ( SealileLibraryInfo . encrypted )
{
Config . SeafileIsLibraryEncrypted = true ;
txtSeafileLibraryPassword . ReadOnly = false ;
btnSeafileLibraryPasswordValidate . Enabled = true ;
}
else
{
Config . SeafileIsLibraryEncrypted = false ;
txtSeafileLibraryPassword . ReadOnly = true ;
txtSeafileLibraryPassword . Text = "" ;
Config . SeafileEncryptedLibraryPassword = "" ;
btnSeafileLibraryPasswordValidate . Enabled = false ;
}
}
}
private void txtSeafileDirectoryPath_TextChanged ( object sender , EventArgs e )
{
Config . SeafilePath = txtSeafileDirectoryPath . Text ;
}
private void btnSeafilePathValidate_Click ( object sender , EventArgs e )
{
if ( string . IsNullOrEmpty ( Config . SeafilePath ) | | string . IsNullOrEmpty ( Config . SeafileAPIURL ) | | string . IsNullOrEmpty ( Config . SeafileAuthToken ) | | string . IsNullOrEmpty ( Config . SeafileRepoID ) )
{
return ;
}
2015-10-13 19:44:51 +13:00
Seafile sf = new Seafile ( cbSeafileAPIURL . Text , txtSeafileAuthToken . Text , Config . SeafileRepoID ) ;
2015-10-13 14:24:49 +13:00
bool checkReturned = sf . ValidatePath ( txtSeafileDirectoryPath . Text ) ;
if ( checkReturned )
{
MessageBox . Show ( Resources . UploadersConfigForm_TestFTPAccount_Connected_ , "ShareX" , MessageBoxButtons . OK , MessageBoxIcon . Information ) ;
}
else
{
MessageBox . Show ( Resources . UploadersConfigForm_Error , "ShareX" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
}
}
private void txtSeafileLibraryPassword_TextChanged ( object sender , EventArgs e )
{
if ( Config . SeafileIsLibraryEncrypted )
{
Config . SeafileEncryptedLibraryPassword = txtSeafileLibraryPassword . Text ;
}
}
private void btnSeafileLibraryPasswordValidate_Click ( object sender , EventArgs e )
{
if ( string . IsNullOrEmpty ( Config . SeafileEncryptedLibraryPassword ) | | string . IsNullOrEmpty ( Config . SeafileAPIURL ) | | string . IsNullOrEmpty ( Config . SeafileAuthToken ) | | string . IsNullOrEmpty ( Config . SeafileRepoID ) )
{
return ;
}
2015-10-13 19:44:51 +13:00
Seafile sf = new Seafile ( cbSeafileAPIURL . Text , txtSeafileAuthToken . Text , Config . SeafileRepoID ) ;
2015-10-13 14:24:49 +13:00
bool checkReturned = sf . DecryptLibrary ( txtSeafileLibraryPassword . Text ) ;
if ( checkReturned )
{
MessageBox . Show ( Resources . UploadersConfigForm_TestFTPAccount_Connected_ , "ShareX" , MessageBoxButtons . OK , MessageBoxIcon . Information ) ;
}
else
{
MessageBox . Show ( Resources . UploadersConfigForm_Error , "ShareX" , MessageBoxButtons . OK , MessageBoxIcon . Error ) ;
}
}
2015-10-13 16:54:19 +13:00
private void nudSeafileExpireDays_ValueChanged ( object sender , EventArgs e )
{
Config . SeafileShareDaysToExpire = ( int ) nudSeafileExpireDays . Value ;
}
private void txtSeafileSharePassword_TextChanged ( object sender , EventArgs e )
{
Config . SeafileSharePassword = txtSeafileSharePassword . Text ;
}
2015-10-13 14:24:49 +13:00
#endregion Seafile
2015-12-02 07:15:52 +13:00
#region Streamable
private void txtStreamableUsername_TextChanged ( object sender , EventArgs e )
{
Config . StreamableUsername = txtStreamableUsername . Text ;
}
private void txtStreamablePassword_TextChanged ( object sender , EventArgs e )
{
Config . StreamablePassword = txtStreamablePassword . Text ;
}
2016-04-08 02:50:41 +12:00
private void cbStreamableUseDirectURL_CheckedChanged ( object sender , EventArgs e )
{
Config . StreamableUseDirectURL = cbStreamableUseDirectURL . Checked ;
}
2015-12-02 07:15:52 +13:00
#endregion Streamable
2017-11-11 07:18:25 +13:00
#region Sul
private void txtSulAPIKey_TextChanged ( object sender , EventArgs e )
{
Config . SulAPIKey = txtSulAPIKey . Text ;
}
private void btnSulGetAPIKey_Click ( object sender , EventArgs e )
{
URLHelpers . OpenURL ( "https://s-ul.eu/account/info" ) ;
}
#endregion Sul
2022-02-04 00:09:16 +13:00
#region LobFile
2017-11-11 07:18:25 +13:00
private void txtLithiioApiKey_TextChanged ( object sender , EventArgs e )
{
Config . LithiioSettings . UserAPIKey = txtLithiioApiKey . Text ;
}
2017-11-11 11:21:04 +13:00
private void btnLithiioLogin_Click ( object sender , EventArgs e )
{
try
{
Cursor = Cursors . WaitCursor ;
2022-02-04 00:09:16 +13:00
LobFile lobFile = new LobFile ( ) ;
string apiKey = lobFile . FetchAPIKey ( txtLithiioEmail . Text , txtLithiioPassword . Text ) ;
2017-11-11 11:21:04 +13:00
txtLithiioApiKey . Text = apiKey ? ? "" ;
}
catch ( Exception ex )
{
ex . ShowError ( false ) ;
}
finally
{
Cursor = Cursors . Default ;
}
}
2017-11-11 07:18:25 +13:00
private void btnLithiioGetAPIKey_Click ( object sender , EventArgs e )
{
2022-02-04 00:09:16 +13:00
URLHelpers . OpenURL ( "https://lobfile.com/my-account" ) ;
2017-11-11 07:18:25 +13:00
}
2022-02-04 00:09:16 +13:00
#endregion
2017-11-11 07:18:25 +13:00
2017-01-27 00:41:49 +13:00
#region Azure Storage
private void txtAzureStorageAccountName_TextChanged ( object sender , EventArgs e )
{
Config . AzureStorageAccountName = txtAzureStorageAccountName . Text ;
2018-06-20 07:16:11 +12:00
UpdateAzureStorageStatus ( ) ;
}
private void btnAzureStoragePortal_Click ( object sender , EventArgs e )
{
URLHelpers . OpenURL ( "https://portal.azure.com/?feature.customportal=false#blade/HubsExtension/Resources/resourceType/Microsoft.Storage%2FStorageAccounts" ) ;
2017-01-27 00:41:49 +13:00
}
private void txtAzureStorageAccessKey_TextChanged ( object sender , EventArgs e )
{
Config . AzureStorageAccountAccessKey = txtAzureStorageAccessKey . Text ;
}
private void txtAzureStorageContainer_TextChanged ( object sender , EventArgs e )
{
Config . AzureStorageContainer = txtAzureStorageContainer . Text ;
2018-06-20 07:16:11 +12:00
UpdateAzureStorageStatus ( ) ;
2017-01-27 00:41:49 +13:00
}
2017-05-23 08:03:29 +12:00
private void cbAzureStorageEnvironment_SelectedIndexChanged ( object sender , EventArgs e )
{
Config . AzureStorageEnvironment = cbAzureStorageEnvironment . Text ;
2018-06-20 07:16:11 +12:00
UpdateAzureStorageStatus ( ) ;
2017-07-07 12:58:14 +12:00
}
2018-06-06 12:39:50 +12:00
private void txtAzureStorageUploadPath_TextChanged ( object sender , EventArgs e )
{
Config . AzureStorageUploadPath = txtAzureStorageUploadPath . Text ;
2018-06-20 07:16:11 +12:00
UpdateAzureStorageStatus ( ) ;
2018-06-06 12:39:50 +12:00
}
2018-06-20 07:16:11 +12:00
private void txtAzureStorageCustomDomain_TextChanged ( object sender , EventArgs e )
2017-01-27 00:41:49 +13:00
{
2018-06-20 07:16:11 +12:00
Config . AzureStorageCustomDomain = txtAzureStorageCustomDomain . Text ;
UpdateAzureStorageStatus ( ) ;
2017-01-27 00:41:49 +13:00
}
2023-03-08 05:51:04 +13:00
private void txtAzureStorageCacheControl_TextChanged ( object sender , EventArgs e )
{
Config . AzureStorageCacheControl = txtAzureStorageCacheControl . Text ;
UpdateAzureStorageStatus ( ) ;
}
2017-01-27 00:41:49 +13:00
#endregion Azure Storage
2018-09-27 17:49:42 +12:00
#region Backblaze B2
private void txtB2ApplicationKeyId_TextChanged ( object sender , EventArgs e )
{
Config . B2ApplicationKeyId = txtB2ApplicationKeyId . Text . Trim ( ) ;
}
private void txtB2ApplicationKey_TextChanged ( object sender , EventArgs e )
{
Config . B2ApplicationKey = txtB2ApplicationKey . Text . Trim ( ) ;
}
private void cbB2CustomUrl_CheckedChanged ( object sender , EventArgs e )
{
txtB2CustomUrl . ReadOnly = ! cbB2CustomUrl . Checked ;
2018-10-02 06:51:50 +13:00
txtB2CustomUrl . Enabled = cbB2CustomUrl . Checked ;
2018-09-27 17:49:42 +12:00
Config . B2UseCustomUrl = cbB2CustomUrl . Checked ;
B2UpdateCustomDomainPreview ( ) ;
}
private void txtB2CustomUrl_TextChanged ( object sender , EventArgs e )
{
Config . B2CustomUrl = txtB2CustomUrl . Text . Trim ( ) ;
B2UpdateCustomDomainPreview ( ) ;
}
private void lblB2ManageLink_LinkClicked ( object sender , LinkLabelLinkClickedEventArgs e )
{
URLHelpers . OpenURL ( "https://secure.backblaze.com/b2_buckets.htm" ) ;
}
private void txtB2UploadPath_TextChanged ( object sender , EventArgs e )
{
Config . B2UploadPath = txtB2UploadPath . Text . Trim ( ) ;
B2UpdateCustomDomainPreview ( ) ;
}
private void txtB2Bucket_TextChanged ( object sender , EventArgs e )
{
Config . B2BucketName = txtB2Bucket . Text . Trim ( ) ;
B2UpdateCustomDomainPreview ( ) ;
}
#endregion Backblaze B2
2017-02-27 05:17:02 +13:00
#region Plik
private void txtPlikURL_TextChanged ( object sender , EventArgs e )
{
2017-02-27 08:27:40 +13:00
Config . PlikSettings . URL = txtPlikURL . Text ;
2017-02-27 05:17:02 +13:00
}
private void txtPlikAPIKey_TextChanged ( object sender , EventArgs e )
{
2017-02-27 08:27:40 +13:00
Config . PlikSettings . APIKey = txtPlikAPIKey . Text ;
2017-02-27 05:17:02 +13:00
}
private void txtPlikLogin_TextChanged ( object sender , EventArgs e )
{
2017-02-27 08:27:40 +13:00
Config . PlikSettings . Login = txtPlikLogin . Text ;
2017-02-27 05:17:02 +13:00
}
private void txtPlikPassword_TextChanged ( object sender , EventArgs e )
{
2017-02-27 08:27:40 +13:00
Config . PlikSettings . Password = txtPlikPassword . Text ;
2017-02-27 05:17:02 +13:00
}
private void cbPlikIsSecured_CheckedChanged ( object sender , EventArgs e )
{
2017-02-27 09:44:47 +13:00
Config . PlikSettings . IsSecured = cbPlikIsSecured . Checked ;
2017-02-27 05:17:02 +13:00
txtPlikLogin . ReadOnly = ! cbPlikIsSecured . Checked ;
txtPlikPassword . ReadOnly = ! cbPlikIsSecured . Checked ;
}
private void cbPlikRemovable_CheckedChanged ( object sender , EventArgs e )
{
2017-02-27 08:27:40 +13:00
Config . PlikSettings . Removable = cbPlikRemovable . Checked ;
2017-02-27 05:17:02 +13:00
}
private void cbPlikComment_CheckedChanged ( object sender , EventArgs e )
{
2017-02-27 09:44:47 +13:00
Config . PlikSettings . HasComment = cbPlikComment . Checked ;
2017-02-27 05:17:02 +13:00
txtPlikComment . ReadOnly = ! cbPlikComment . Checked ;
}
private void txtPlikComment_TextChanged ( object sender , EventArgs e )
{
2017-02-27 08:27:40 +13:00
Config . PlikSettings . Comment = txtPlikComment . Text ;
2017-02-27 05:17:02 +13:00
}
private void cbPlikOneShot_CheckedChanged ( object sender , EventArgs e )
{
2017-02-27 08:27:40 +13:00
Config . PlikSettings . OneShot = cbPlikOneShot . Checked ;
2017-02-27 05:17:02 +13:00
}
2021-09-08 11:53:11 +12:00
private void cbPlikTTLUnit_SelectedIndexChanged ( object sender , EventArgs e )
2017-02-27 05:17:02 +13:00
{
2021-09-08 11:53:11 +12:00
Plik . CalculateTTLValue ( nudPlikTTL , cbPlikTTLUnit . SelectedIndex , Config . PlikSettings . TTLUnit ) ;
Config . PlikSettings . TTLUnit = cbPlikTTLUnit . SelectedIndex ;
2017-02-27 05:17:02 +13:00
}
private void nudPlikTTL_ValueChanged ( object sender , EventArgs e )
{
2017-02-27 08:27:40 +13:00
Config . PlikSettings . TTL = nudPlikTTL . Value ;
2017-02-27 05:17:02 +13:00
}
#endregion Plik
2018-04-10 12:49:40 +12:00
#region YouTube
2022-12-09 00:21:16 +13:00
private void oauth2YouTube_ConnectButtonClicked ( )
2018-04-10 12:49:40 +12:00
{
OAuth2Info oauth = new OAuth2Info ( APIKeys . GoogleClientID , APIKeys . GoogleClientSecret ) ;
2022-12-08 21:32:58 +13:00
IOAuth2Loopback oauthLoopback = new YouTube ( oauth ) . OAuth2 ;
using ( OAuthListenerForm form = new OAuthListenerForm ( oauthLoopback ) )
{
form . ShowDialog ( ) ;
Config . YouTubeOAuth2Info = form . OAuth2Info ;
2022-12-09 00:48:35 +13:00
Config . YouTubeUserInfo = form . UserInfo ;
2022-12-08 21:32:58 +13:00
}
2022-12-11 02:10:35 +13:00
oauth2YouTube . UpdateStatus ( Config . YouTubeOAuth2Info , Config . YouTubeUserInfo ) ;
2022-12-08 21:32:58 +13:00
this . ForceActivate ( ) ;
2018-04-10 12:49:40 +12:00
}
2022-12-09 00:21:16 +13:00
private void oauth2YouTube_DisconnectButtonClicked ( )
2018-04-10 12:49:40 +12:00
{
Config . YouTubeOAuth2Info = null ;
2022-12-09 00:48:35 +13:00
Config . YouTubeUserInfo = null ;
2018-04-10 12:49:40 +12:00
}
2021-11-20 18:38:34 +13:00
private void llYouTubePermissionsLink_LinkClicked ( object sender , LinkLabelLinkClickedEventArgs e )
{
2023-01-09 07:52:48 +13:00
URLHelpers . OpenURL ( "https://myaccount.google.com/permissions" ) ;
2021-11-20 18:38:34 +13:00
}
2018-04-10 12:49:40 +12:00
private void cbYouTubePrivacyType_SelectedIndexChanged ( object sender , EventArgs e )
{
Config . YouTubePrivacyType = ( YouTubeVideoPrivacy ) cbYouTubePrivacyType . SelectedIndex ;
}
2018-04-12 22:09:35 +12:00
private void cbYouTubeUseShortenedLink_CheckedChanged ( object sender , EventArgs e )
{
Config . YouTubeUseShortenedLink = cbYouTubeUseShortenedLink . Checked ;
}
2021-11-20 14:35:47 +13:00
private void cbYouTubeShowDialog_CheckedChanged ( object sender , EventArgs e )
{
Config . YouTubeShowDialog = cbYouTubeShowDialog . Checked ;
}
2018-04-10 12:49:40 +12:00
#endregion YouTube
2018-04-21 04:13:34 +12:00
#region Google Cloud Storage
2022-12-11 01:38:41 +13:00
private void oauth2GoogleCloudStorage_ConnectButtonClicked ( )
2018-04-21 04:13:34 +12:00
{
2022-12-11 01:38:41 +13:00
OAuth2Info oauth = new OAuth2Info ( APIKeys . GoogleClientID , APIKeys . GoogleClientSecret ) ;
IOAuth2Loopback oauthLoopback = new GoogleCloudStorage ( oauth ) . OAuth2 ;
2018-04-21 04:13:34 +12:00
2022-12-11 01:38:41 +13:00
using ( OAuthListenerForm form = new OAuthListenerForm ( oauthLoopback ) )
{
form . ShowDialog ( ) ;
Config . GoogleCloudStorageOAuth2Info = form . OAuth2Info ;
Config . GoogleCloudStorageUserInfo = form . UserInfo ;
}
2018-04-21 04:13:34 +12:00
2022-12-11 02:10:35 +13:00
oauth2GoogleCloudStorage . UpdateStatus ( Config . GoogleCloudStorageOAuth2Info , Config . GoogleCloudStorageUserInfo ) ;
2022-12-11 01:38:41 +13:00
this . ForceActivate ( ) ;
2018-04-21 04:13:34 +12:00
}
2022-12-11 01:38:41 +13:00
private void oauth2GoogleCloudStorage_DisconnectButtonClicked ( )
2018-04-21 04:13:34 +12:00
{
2022-12-11 01:38:41 +13:00
Config . GoogleCloudStorageOAuth2Info = null ;
Config . GoogleCloudStorageUserInfo = null ;
2018-04-21 04:13:34 +12:00
}
2018-04-21 08:39:14 +12:00
private void txtGoogleCloudStorageBucket_TextChanged ( object sender , EventArgs e )
{
Config . GoogleCloudStorageBucket = txtGoogleCloudStorageBucket . Text ;
2018-04-26 16:41:11 +12:00
UpdateGoogleCloudStorageStatus ( ) ;
2018-04-21 08:39:14 +12:00
}
private void txtGoogleCloudStorageDomain_TextChanged ( object sender , EventArgs e )
{
Config . GoogleCloudStorageDomain = txtGoogleCloudStorageDomain . Text ;
2018-04-26 16:41:11 +12:00
UpdateGoogleCloudStorageStatus ( ) ;
2018-04-21 08:39:14 +12:00
}
2018-04-21 09:16:46 +12:00
private void txtGoogleCloudStorageObjectPrefix_TextChanged ( object sender , EventArgs e )
{
Config . GoogleCloudStorageObjectPrefix = txtGoogleCloudStorageObjectPrefix . Text ;
2018-04-26 16:41:11 +12:00
UpdateGoogleCloudStorageStatus ( ) ;
2018-04-21 09:16:46 +12:00
}
2018-10-11 09:00:50 +13:00
private void cbGoogleCloudStorageStripExtensionImage_CheckedChanged ( object sender , EventArgs e )
{
Config . GoogleCloudStorageRemoveExtensionImage = cbGoogleCloudStorageStripExtensionImage . Checked ;
2019-01-25 09:09:00 +13:00
UpdateGoogleCloudStorageStatus ( ) ;
2018-10-11 09:00:50 +13:00
}
private void cbGoogleCloudStorageStripExtensionVideo_CheckedChanged ( object sender , EventArgs e )
{
Config . GoogleCloudStorageRemoveExtensionVideo = cbGoogleCloudStorageStripExtensionVideo . Checked ;
2019-01-25 09:09:00 +13:00
UpdateGoogleCloudStorageStatus ( ) ;
2018-10-11 09:00:50 +13:00
}
private void cbGoogleCloudStorageStripExtensionText_CheckedChanged ( object sender , EventArgs e )
{
Config . GoogleCloudStorageRemoveExtensionText = cbGoogleCloudStorageStripExtensionText . Checked ;
2019-01-25 09:09:00 +13:00
UpdateGoogleCloudStorageStatus ( ) ;
2018-10-11 09:00:50 +13:00
}
2019-04-08 08:42:47 +12:00
private void cbGoogleCloudStorageSetPublicACL_CheckedChanged ( object sender , EventArgs e )
{
Config . GoogleCloudStorageSetPublicACL = cbGoogleCloudStorageSetPublicACL . Checked ;
UpdateGoogleCloudStorageStatus ( ) ;
}
2018-04-21 04:13:34 +12:00
#endregion Google Cloud Storage
2017-10-06 09:54:06 +13:00
#endregion File uploaders
2015-06-08 01:34:33 +12:00
2017-10-06 09:54:06 +13:00
#region URL shorteners
2015-06-08 01:34:33 +12:00
#region bit . ly
private void oauth2Bitly_OpenButtonClicked ( )
{
2018-05-17 13:14:17 +12:00
OAuth2Info oauth = new OAuth2Info ( APIKeys . BitlyClientID , APIKeys . BitlyClientSecret ) ;
Config . BitlyOAuth2Info = OAuth2Open ( new BitlyURLShortener ( oauth ) ) ;
2015-06-08 01:34:33 +12:00
}
private void oauth2Bitly_CompleteButtonClicked ( string code )
{
2018-05-17 13:14:17 +12:00
OAuth2Complete ( new BitlyURLShortener ( Config . BitlyOAuth2Info ) , code , oauth2Bitly ) ;
2015-06-08 01:34:33 +12:00
}
private void oauth2Bitly_ClearButtonClicked ( )
{
Config . BitlyOAuth2Info = null ;
}
private void txtBitlyDomain_TextChanged ( object sender , EventArgs e )
{
Config . BitlyDomain = txtBitlyDomain . Text ;
}
#endregion bit . ly
#region yourls . org
private void txtYourlsAPIURL_TextChanged ( object sender , EventArgs e )
{
Config . YourlsAPIURL = txtYourlsAPIURL . Text ;
}
private void txtYourlsSignature_TextChanged ( object sender , EventArgs e )
{
Config . YourlsSignature = txtYourlsSignature . Text . Trim ( ) ;
txtYourlsUsername . Enabled = txtYourlsPassword . Enabled = string . IsNullOrEmpty ( Config . YourlsSignature ) ;
}
private void txtYourlsUsername_TextChanged ( object sender , EventArgs e )
{
Config . YourlsUsername = txtYourlsUsername . Text ;
}
private void txtYourlsPassword_TextChanged ( object sender , EventArgs e )
{
Config . YourlsPassword = txtYourlsPassword . Text ;
}
#endregion yourls . org
#region adf . ly
private void txtAdflyAPIKEY_TextChanged ( object sender , EventArgs e )
{
Config . AdFlyAPIKEY = txtAdflyAPIKEY . Text ;
}
private void txtAdflyAPIUID_TextChanged ( object sender , EventArgs e )
{
Config . AdFlyAPIUID = txtAdflyAPIUID . Text ;
}
private void llAdflyLink_LinkClicked ( object sender , LinkLabelLinkClickedEventArgs e )
{
URLHelpers . OpenURL ( "https://adf.ly/publisher/tools#tools-api" ) ;
}
#endregion adf . ly
2015-08-05 06:49:07 +12:00
#region Polr
private void txtPolrAPIHostname_TextChanged ( object sender , EventArgs e )
{
Config . PolrAPIHostname = txtPolrAPIHostname . Text ;
}
private void txtPolrAPIKey_TextChanged ( object sender , EventArgs e )
{
Config . PolrAPIKey = txtPolrAPIKey . Text ;
}
2016-12-30 02:01:03 +13:00
private void cbPolrIsSecret_CheckedChanged ( object sender , EventArgs e )
{
Config . PolrIsSecret = cbPolrIsSecret . Checked ;
}
private void cbPolrUseAPIv1_CheckedChanged ( object sender , EventArgs e )
{
Config . PolrUseAPIv1 = cbPolrUseAPIv1 . Checked ;
}
2015-08-05 06:49:07 +12:00
#endregion Polr
2018-04-04 14:42:05 +12:00
#region Firebase Dynamic Links
private void txtFirebaseWebAPIKey_TextChanged ( object sender , EventArgs e )
{
Config . FirebaseWebAPIKey = txtFirebaseWebAPIKey . Text ;
}
private void txtFirebaseDomain_TextChanged ( object sender , EventArgs e )
{
Config . FirebaseDynamicLinkDomain = txtFirebaseDomain . Text ;
}
private void cbFirebaseIsShort_CheckedChanged ( object sender , EventArgs e )
{
Config . FirebaseIsShort = cbFirebaseIsShort . Checked ;
}
#endregion Firebase Dynamic Links
2018-10-02 12:11:53 +13:00
#region Kutt
private void txtKuttHost_TextChanged ( object sender , EventArgs e )
{
Config . KuttSettings . Host = txtKuttHost . Text ;
}
private void txtKuttAPIKey_TextChanged ( object sender , EventArgs e )
{
Config . KuttSettings . APIKey = txtKuttAPIKey . Text ;
}
private void txtKuttPassword_TextChanged ( object sender , EventArgs e )
{
Config . KuttSettings . Password = txtKuttPassword . Text ;
}
2020-07-30 02:52:32 +12:00
private void txtKuttDomain_TextChanged ( object sender , EventArgs e )
{
Config . KuttSettings . Domain = txtKuttDomain . Text ;
}
2018-10-02 12:11:53 +13:00
private void cbKuttReuse_CheckedChanged ( object sender , EventArgs e )
{
Config . KuttSettings . Reuse = cbKuttReuse . Checked ;
}
#endregion Kutt
2021-03-11 05:20:50 +13:00
#region Zero Width Shortener
private void txtZWSURL_TextChanged ( object sender , EventArgs e )
{
Config . ZeroWidthShortenerURL = txtZWSURL . Text ;
}
private void txtZWSToken_TextChanged ( object sender , EventArgs e )
{
Config . ZeroWidthShortenerToken = txtZWSToken . Text ;
}
#endregion
2017-10-06 09:54:06 +13:00
#endregion URL shorteners
2015-06-08 01:34:33 +12:00
2017-10-06 09:54:06 +13:00
#region Other uploaders
2015-06-08 01:34:33 +12:00
2015-07-21 07:01:57 +12:00
#region Twitter
2015-06-08 01:34:33 +12:00
2015-07-21 07:01:57 +12:00
private void btnTwitterAdd_Click ( object sender , EventArgs e )
2015-06-08 01:34:33 +12:00
{
OAuthInfo oauth = new OAuthInfo ( ) ;
Config . TwitterOAuthInfoList . Add ( oauth ) ;
2015-09-03 03:41:02 +12:00
lbTwitterAccounts . Items . Add ( oauth . Description ) ;
lbTwitterAccounts . SelectedIndex = lbTwitterAccounts . Items . Count - 1 ;
2015-06-08 01:34:33 +12:00
TwitterUpdateSelected ( ) ;
}
private void btnTwitterRemove_Click ( object sender , EventArgs e )
{
2015-09-03 03:41:02 +12:00
int selected = lbTwitterAccounts . SelectedIndex ;
2015-06-08 01:34:33 +12:00
if ( selected > - 1 )
{
2015-09-03 03:41:02 +12:00
lbTwitterAccounts . Items . RemoveAt ( selected ) ;
2015-06-08 01:34:33 +12:00
Config . TwitterOAuthInfoList . RemoveAt ( selected ) ;
2015-09-03 03:41:02 +12:00
if ( lbTwitterAccounts . Items . Count > 0 )
2015-06-08 01:34:33 +12:00
{
2015-09-03 03:41:02 +12:00
lbTwitterAccounts . SelectedIndex = selected > = lbTwitterAccounts . Items . Count ? lbTwitterAccounts . Items . Count - 1 : selected ;
2015-06-08 01:34:33 +12:00
}
}
TwitterUpdateSelected ( ) ;
}
2015-09-03 03:41:02 +12:00
private void lbTwitterAccounts_SelectedIndexChanged ( object sender , EventArgs e )
2015-06-08 01:34:33 +12:00
{
TwitterUpdateSelected ( ) ;
}
2015-09-03 06:37:19 +12:00
private void btnTwitterNameUpdate_Click ( object sender , EventArgs e )
2015-06-08 01:34:33 +12:00
{
OAuthInfo oauth = GetSelectedTwitterAccount ( ) ;
if ( oauth ! = null )
{
oauth . Description = txtTwitterDescription . Text ;
2015-09-03 06:37:19 +12:00
lbTwitterAccounts . Items [ lbTwitterAccounts . SelectedIndex ] = oauth . Description ;
2015-06-08 01:34:33 +12:00
}
}
private void oauthTwitter_OpenButtonClicked ( )
{
TwitterAuthOpen ( ) ;
}
private void oauthTwitter_CompleteButtonClicked ( string code )
{
TwitterAuthComplete ( code ) ;
}
private void oauthTwitter_ClearButtonClicked ( )
{
TwitterAuthClear ( ) ;
}
private void cbTwitterSkipMessageBox_CheckedChanged ( object sender , EventArgs e )
{
Config . TwitterSkipMessageBox = cbTwitterSkipMessageBox . Checked ;
}
private void txtTwitterDefaultMessage_TextChanged ( object sender , EventArgs e )
{
Config . TwitterDefaultMessage = txtTwitterDefaultMessage . Text ;
}
#endregion Twitter
2017-10-06 09:54:06 +13:00
#endregion Other uploaders
2015-06-08 01:34:33 +12:00
}
2022-02-04 00:09:16 +13:00
}