ShareX/ShareX.UploadersLib/Forms/UploadersConfigForm.cs

3252 lines
111 KiB
C#
Raw Normal View History

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;
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
{
public partial class UploadersConfigForm : Form
2015-06-08 01:34:33 +12: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
{
Config = config;
2019-06-24 00:00:04 +12:00
2015-06-08 01:34:33 +12:00
InitializeComponent();
ShareXResources.ApplyTheme(this, true);
2019-06-24 00:00:04 +12:00
InitializeControls();
2015-06-08 01:34:33 +12:00
}
public static UploadersConfigForm GetFormInstance(UploadersConfig config)
2016-04-30 20:30:03 +12: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)
{
LoadSettings();
2015-06-08 01:34:33 +12:00
}
private void UploadersConfigForm_Resize(object sender, EventArgs e)
{
Refresh();
}
private void InitializeControls()
2015-06-08 01:34:33 +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
tttvMain.ImageList = uploadersImageList;
tttvMain.MainTabControl = tcUploaders;
2015-06-08 01:34:33 +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);
CodeMenu.Create<CodeMenuEntryFilename>(txtB2UploadPath, CodeMenuEntryFilename.n, CodeMenuEntryFilename.t, CodeMenuEntryFilename.pn);
CodeMenu.Create<CodeMenuEntryFilename>(txtB2CustomUrl, CodeMenuEntryFilename.n, CodeMenuEntryFilename.t, CodeMenuEntryFilename.pn);
// FTP
cbFTPURLPathProtocol.Items.AddRange(Helpers.GetEnumDescriptions<BrowserProtocol>());
cbFTPSEncryption.Items.AddRange(Enum.GetNames(typeof(FTPSEncryption)));
eiFTP.ObjectType = typeof(FTPAccount);
// Backblaze B2
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
}
public void NavigateToTabPage(TabPage tp)
{
if (tp != null)
{
tttvMain.NavigateToTabPage(tp);
}
}
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();
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
cbGooglePhotosIsPublic.Checked = Config.GooglePhotosIsPublic;
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
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();
cbPastebinPrivacy.Items.AddRange(Helpers.GetLocalizedEnumDescriptions<PastebinPrivacy>());
2015-06-08 01:34:33 +12:00
cbPastebinPrivacy.SelectedIndex = (int)Config.PastebinSettings.Exposure;
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;
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;
}
cbGistPublishPublic.Checked = Config.GistPublishPublic;
cbGistUseRawURL.Checked = Config.GistRawURL;
txtGistCustomURL.Text = Config.GistCustomURL;
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;
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
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
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
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;
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);
//btnGoogleDriveRefreshFolders.Enabled = oauth2GoogleDrive.Connected;
2015-06-08 01:34:33 +12:00
cbGoogleDriveIsPublic.Checked = Config.GoogleDriveIsPublic;
cbGoogleDriveDirectLink.Checked = Config.GoogleDriveDirectLink;
/*
cbGoogleDriveSharedDrive.Items.Clear();
cbGoogleDriveSharedDrive.Items.Add(GoogleDrive.MyDrive);
if (Config.GoogleDriveSelectedDrive?.id != GoogleDrive.MyDrive.id)
{
cbGoogleDriveSharedDrive.Items.Add(Config.GoogleDriveSelectedDrive);
}
*/
2015-06-08 01:34:33 +12:00
cbGoogleDriveUseFolder.Checked = Config.GoogleDriveUseFolder;
txtGoogleDriveFolderID.Enabled = Config.GoogleDriveUseFolder;
btnGoogleDriveFolderIDHelp.Enabled = Config.GoogleDriveUseFolder;
2015-06-08 01:34:33 +12:00
txtGoogleDriveFolderID.Text = Config.GoogleDriveFolderID;
//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;
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;
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;
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;
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);
}
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());
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))
{
cbAmazonS3Endpoints.SelectedIndex = i;
break;
}
}
2017-03-21 00:26:44 +13:00
txtAmazonS3Endpoint.Text = Config.AmazonS3Settings.Endpoint;
txtAmazonS3Region.Text = Config.AmazonS3Settings.Region;
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>());
cbAmazonS3StorageClass.SelectedIndex = (int)Config.AmazonS3Settings.StorageClass;
cbAmazonS3PublicACL.Checked = Config.AmazonS3Settings.SetPublicACL;
2018-12-05 05:10:01 +13:00
cbAmazonS3SignedPayload.Checked = Config.AmazonS3Settings.SignedPayload;
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
#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;
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;
cbOwnCloud81Compatibility.Checked = Config.OwnCloud81Compatibility;
cbOwnCloudUsePreviewLinks.Checked = Config.OwnCloudUsePreviewLinks;
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;
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
#region LobFile
txtLithiioApiKey.Text = Config.LithiioSettings.UserAPIKey;
#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 19:44:51 +13:00
cbSeafileAPIURL.Text = Config.SeafileAPIURL;
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;
cbSeafileCreateShareableURL.Checked = Config.SeafileCreateShareableURL;
cbSeafileCreateShareableURLRaw.Checked = Config.SeafileCreateShareableURLRaw;
cbSeafileCreateShareableURLRaw.Enabled = cbSeafileCreateShareableURL.Checked;
cbSeafileIgnoreInvalidCert.Checked = Config.SeafileIgnoreInvalidCert;
nudSeafileExpireDays.SetValue(Config.SeafileShareDaysToExpire);
txtSeafileSharePassword.Text = Config.SeafileSharePassword;
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;
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
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-01-27 00:41:49 +13:00
txtAzureStorageAccountName.Text = Config.AzureStorageAccountName;
txtAzureStorageAccessKey.Text = Config.AzureStorageAccountAccessKey;
txtAzureStorageContainer.Text = Config.AzureStorageContainer;
cbAzureStorageEnvironment.Text = Config.AzureStorageEnvironment;
2017-07-07 12:58:14 +12:00
txtAzureStorageCustomDomain.Text = Config.AzureStorageCustomDomain;
txtAzureStorageUploadPath.Text = Config.AzureStorageUploadPath;
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
#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;
txtB2CustomUrl.Enabled = cbB2CustomUrl.Checked;
txtB2CustomUrl.Text = Config.B2CustomUrl;
B2UpdateCustomDomainPreview();
#endregion Backblaze B2
2017-10-06 09:54:06 +13:00
#region Plik
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;
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);
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;
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
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-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;
txtKuttDomain.Text = Config.KuttSettings.Domain;
2018-10-02 12:11:53 +13:00
cbKuttReuse.Checked = Config.KuttSettings.Reuse;
#endregion Kutt
#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
lbTwitterAccounts.Items.Clear();
2015-06-08 01:34:33 +12:00
foreach (OAuthInfo twitterOAuth in Config.TwitterOAuthInfoList)
{
lbTwitterAccounts.Items.Add(twitterOAuth.Description);
2015-06-08 01:34:33 +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()
{
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)
{
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()
{
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
private void oauth2GooglePhotos_ConnectButtonClicked()
2015-06-08 01:34:33 +12:00
{
OAuth2Info oauth = new OAuth2Info(APIKeys.GoogleClientID, APIKeys.GoogleClientSecret);
IOAuth2Loopback oauthLoopback = new GooglePhotos(oauth).OAuth2;
2015-06-08 01:34:33 +12:00
using (OAuthListenerForm form = new OAuthListenerForm(oauthLoopback))
{
form.ShowDialog();
Config.GooglePhotosOAuth2Info = form.OAuth2Info;
Config.GooglePhotosUserInfo = form.UserInfo;
}
2022-12-11 02:10:35 +13:00
oauth2GooglePhotos.UpdateStatus(Config.GooglePhotosOAuth2Info, Config.GooglePhotosUserInfo);
btnPicasaRefreshAlbumList.Enabled = oauth2GooglePhotos.Connected;
2022-12-11 02:10:35 +13:00
this.ForceActivate();
2015-06-08 01:34:33 +12:00
}
private void oauth2GooglePhotos_DisconnectButtonClicked()
2015-06-08 01:34:33 +12:00
{
Config.GooglePhotosOAuth2Info = null;
Config.GooglePhotosUserInfo = null;
2015-06-08 01:34:33 +12:00
}
private void txtPicasaAlbumID_TextChanged(object sender, EventArgs e)
{
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;
}
}
}
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)
{
Config.CheveretoUploader.UploadURL = txtCheveretoUploadURL.Text;
2015-06-08 01:34:33 +12:00
}
private void txtCheveretoAPIKey_TextChanged(object sender, EventArgs e)
{
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;
}
private void cbPastebinRaw_CheckedChanged(object sender, EventArgs e)
{
Config.PastebinSettings.RawURL = cbPastebinRaw.Checked;
}
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()
{
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)
{
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
{
Config.GistPublishPublic = cbGistPublishPublic.Checked;
}
private void cbGistUseRawURL_CheckedChanged(object sender, EventArgs e)
{
Config.GistRawURL = cbGistUseRawURL.Checked;
2015-06-08 01:34:33 +12: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;
}
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
#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
{
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
{
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
{
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;
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();
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;
}
}
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
{
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()
{
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)
{
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;
cbDropboxUseDirectLink.Enabled = Config.DropboxAutoCreateShareableLink;
2015-06-08 01:34:33 +12:00
}
private void cbDropboxUseDirectLink_CheckedChanged(object sender, EventArgs e)
2015-06-08 01:34:33 +12:00
{
Config.DropboxUseDirectLink = cbDropboxUseDirectLink.Checked;
2015-06-08 01:34:33 +12:00
}
#endregion Dropbox
#region OneDrive
private void oAuth2OneDrive_OpenButtonClicked()
{
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)
{
tvOneDrive.Enabled = OAuth2Complete(new OneDrive(Config.OneDriveV2OAuth2Info), code, oAuth2OneDrive);
2015-06-08 01:34:33 +12:00
}
private void oAuth2OneDrive_RefreshButtonClicked()
{
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
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);
IOAuth2Loopback oauthLoopback = new GoogleDrive(oauth).OAuth2;
2015-06-08 01:34:33 +12: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);
//btnGoogleDriveRefreshFolders.Enabled = oauth2GoogleDrive.Connected;
2022-12-11 02:10:35 +13:00
this.ForceActivate();
2015-06-08 01:34:33 +12:00
}
private void oauth2GoogleDrive_DisconnectButtonClicked()
2015-06-08 01:34:33 +12:00
{
Config.GoogleDriveOAuth2Info = null;
Config.GoogleDriveUserInfo = null;
2015-06-08 01:34:33 +12:00
}
private void cbGoogleDriveIsPublic_CheckedChanged(object sender, EventArgs e)
{
Config.GoogleDriveIsPublic = cbGoogleDriveIsPublic.Checked;
}
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;
btnGoogleDriveFolderIDHelp.Enabled = Config.GoogleDriveUseFolder;
2015-06-08 01:34:33 +12:00
}
private void txtGoogleDriveFolderID_TextChanged(object sender, EventArgs e)
{
Config.GoogleDriveFolderID = txtGoogleDriveFolderID.Text;
}
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();
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;
}
}
}
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
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;
}
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;
}
else
{
txtPuushPassword.BackColor = SystemColors.Window;
}
2016-06-12 08:19:29 +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()
{
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)
{
btnBoxRefreshFolders.Enabled = OAuth2Complete(new Box(Config.BoxOAuth2Info), code, oauth2Box);
2015-06-08 01:34:33 +12:00
}
private void oauth2Box_RefreshButtonClicked()
{
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;
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;
}
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)
{
2021-06-10 10:14:01 +12:00
if (cbAmazonS3Endpoints.SelectedItem is AmazonS3Endpoint endpoint)
{
txtAmazonS3Region.Text = endpoint.Region;
txtAmazonS3Endpoint.Text = endpoint.Endpoint;
}
}
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;
UpdateAmazonS3Status();
}
2017-03-21 00:26:44 +13:00
private void txtAmazonS3Region_TextChanged(object sender, EventArgs e)
{
2017-03-21 00:26:44 +13:00
Config.AmazonS3Settings.Region = txtAmazonS3Region.Text;
UpdateAmazonS3Status();
2015-06-08 01:34:33 +12: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();
}
private void cbAmazonS3StorageClass_SelectedIndexChanged(object sender, EventArgs e)
2015-06-08 01:34:33 +12: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
}
private void cbAmazonS3PublicACL_CheckedChanged(object sender, EventArgs e)
{
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;
}
private void cbAmazonS3StripExtensionImage_CheckedChanged(object sender, EventArgs e)
{
Config.AmazonS3Settings.RemoveExtensionImage = cbAmazonS3StripExtensionImage.Checked;
UpdateAmazonS3Status();
}
private void cbAmazonS3StripExtensionVideo_CheckedChanged(object sender, EventArgs e)
{
Config.AmazonS3Settings.RemoveExtensionVideo = cbAmazonS3StripExtensionVideo.Checked;
UpdateAmazonS3Status();
}
private void cbAmazonS3StripExtensionText_CheckedChanged(object sender, EventArgs e)
{
Config.AmazonS3Settings.RemoveExtensionText = cbAmazonS3StripExtensionText.Checked;
UpdateAmazonS3Status();
}
2015-06-08 01:34:33 +12:00
#endregion Amazon S3
#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)
{
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-12-29 02:35:47 +13:00
Config.OwnCloudAppendFileNameToURL = cbOwnCloudAppendFileNameToURL.Checked;
}
private void cbOwnCloud81Compatibility_CheckedChanged(object sender, EventArgs e)
{
Config.OwnCloud81Compatibility = cbOwnCloud81Compatibility.Checked;
}
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;
}
#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;
}
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)
{
2021-06-10 10:14:01 +12:00
Config.LambdaSettings.UploadURL = url;
}
}
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
#region Seafile
2015-10-13 19:44:51 +13:00
private void cbSeafileAPIURL_TextChanged(object sender, EventArgs e)
{
2015-10-13 19:44:51 +13:00
Config.SeafileAPIURL = cbSeafileAPIURL.Text;
}
private void btnSeafileCheckAPIURL_Click(object sender, EventArgs e)
{
2015-10-13 19:44:51 +13:00
if (string.IsNullOrEmpty(cbSeafileAPIURL.Text))
{
return;
}
2015-10-13 19:44:51 +13:00
Seafile sf = new Seafile(cbSeafileAPIURL.Text, null, null);
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))
{
return;
}
2015-10-13 19:44:51 +13:00
Seafile sf = new Seafile(cbSeafileAPIURL.Text, txtSeafileAuthToken.Text, null);
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);
}
}
private void txtSeafilePassword_KeyUp(object sender, KeyEventArgs e)
{
if (e.KeyCode == Keys.Return)
{
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);
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();
}
}
}
private void cbSeafileCreateShareableURL_CheckedChanged(object sender, EventArgs e)
{
Config.SeafileCreateShareableURL = cbSeafileCreateShareableURL.Checked;
cbSeafileCreateShareableURLRaw.Enabled = cbSeafileCreateShareableURL.Checked;
}
private void cbSeafileCreateShareableURLRaw_CheckedChanged(object sender, EventArgs e)
{
Config.SeafileCreateShareableURLRaw = cbSeafileCreateShareableURLRaw.Checked;
}
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))
{
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();
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();
}
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))
{
return;
}
lvSeafileLibraries.Items.Clear();
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();
2016-09-17 19:07:02 +12:00
foreach (SeafileLibraryObj SeafileLibrary in SeafileLibraries)
{
if (SeafileLibrary.permission == "rw")
{
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());
if (SeafileLibrary.encrypted)
{
2015-10-13 19:44:51 +13:00
libraryItem.SubItems.Add("\u221A");
}
if (SeafileLibrary.id == Config.SeafileRepoID)
{
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;
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);
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);
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);
}
}
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;
}
#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;
}
private void cbStreamableUseDirectURL_CheckedChanged(object sender, EventArgs e)
{
Config.StreamableUseDirectURL = cbStreamableUseDirectURL.Checked;
}
2015-12-02 07:15:52 +13:00
#endregion Streamable
#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
#region LobFile
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;
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;
}
}
private void btnLithiioGetAPIKey_Click(object sender, EventArgs e)
{
URLHelpers.OpenURL("https://lobfile.com/my-account");
}
#endregion
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
}
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
}
private void txtAzureStorageUploadPath_TextChanged(object sender, EventArgs e)
{
Config.AzureStorageUploadPath = txtAzureStorageUploadPath.Text;
2018-06-20 07:16:11 +12:00
UpdateAzureStorageStatus();
}
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
}
private void txtAzureStorageCacheControl_TextChanged(object sender, EventArgs e)
{
Config.AzureStorageCacheControl = txtAzureStorageCacheControl.Text;
UpdateAzureStorageStatus();
}
2017-01-27 00:41:49 +13:00
#endregion Azure Storage
#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;
txtB2CustomUrl.Enabled = cbB2CustomUrl.Checked;
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)
{
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)
{
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;
}
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
private void oauth2GoogleCloudStorage_ConnectButtonClicked()
2018-04-21 04:13:34 +12:00
{
OAuth2Info oauth = new OAuth2Info(APIKeys.GoogleClientID, APIKeys.GoogleClientSecret);
IOAuth2Loopback oauthLoopback = new GoogleCloudStorage(oauth).OAuth2;
2018-04-21 04:13:34 +12: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);
this.ForceActivate();
2018-04-21 04:13:34 +12:00
}
private void oauth2GoogleCloudStorage_DisconnectButtonClicked()
2018-04-21 04:13:34 +12: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
}
private void cbGoogleCloudStorageStripExtensionImage_CheckedChanged(object sender, EventArgs e)
{
Config.GoogleCloudStorageRemoveExtensionImage = cbGoogleCloudStorageStripExtensionImage.Checked;
UpdateGoogleCloudStorageStatus();
}
private void cbGoogleCloudStorageStripExtensionVideo_CheckedChanged(object sender, EventArgs e)
{
Config.GoogleCloudStorageRemoveExtensionVideo = cbGoogleCloudStorageStripExtensionVideo.Checked;
UpdateGoogleCloudStorageStatus();
}
private void cbGoogleCloudStorageStripExtensionText_CheckedChanged(object sender, EventArgs e)
{
Config.GoogleCloudStorageRemoveExtensionText = cbGoogleCloudStorageStripExtensionText.Checked;
UpdateGoogleCloudStorageStatus();
}
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()
{
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)
{
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;
}
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
#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);
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)
{
int selected = lbTwitterAccounts.SelectedIndex;
2015-06-08 01:34:33 +12:00
if (selected > -1)
{
lbTwitterAccounts.Items.RemoveAt(selected);
2015-06-08 01:34:33 +12:00
Config.TwitterOAuthInfoList.RemoveAt(selected);
if (lbTwitterAccounts.Items.Count > 0)
2015-06-08 01:34:33 +12:00
{
lbTwitterAccounts.SelectedIndex = selected >= lbTwitterAccounts.Items.Count ? lbTwitterAccounts.Items.Count - 1 : selected;
2015-06-08 01:34:33 +12:00
}
}
TwitterUpdateSelected();
}
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
}
}