From f21f114904f92ec7cd445998109bc78052ddd76b Mon Sep 17 00:00:00 2001 From: Jaex Date: Fri, 6 Dec 2013 21:10:23 +0200 Subject: [PATCH] Added help button to custom uploaders --- HelpersLib/Links.cs | 1 + .../GUI/UploadersConfigForm.Designer.cs | 79 +-- UploadersLib/GUI/UploadersConfigForm.cs | 488 +++++++++--------- UploadersLib/GUI/UploadersConfigForm.resx | 24 - 4 files changed, 266 insertions(+), 326 deletions(-) diff --git a/HelpersLib/Links.cs b/HelpersLib/Links.cs index e4db6f450..9beff55a4 100644 --- a/HelpersLib/Links.cs +++ b/HelpersLib/Links.cs @@ -38,5 +38,6 @@ public static class Links public const string URL_GREGOIRE = "https://github.com/gpailler"; public const string URL_DANA = "https://github.com/dmxt"; public const string URL_DANA_STEAM = "http://steamcommunity.com/profiles/76561198021718265"; + public const string URL_DOCS_CUSTOM_UPLOADER = "http://getsharex.com/docs/#CustomUploader"; } } \ No newline at end of file diff --git a/UploadersLib/GUI/UploadersConfigForm.Designer.cs b/UploadersLib/GUI/UploadersConfigForm.Designer.cs index f86c7810a..63bf14206 100644 --- a/UploadersLib/GUI/UploadersConfigForm.Designer.cs +++ b/UploadersLib/GUI/UploadersConfigForm.Designer.cs @@ -159,7 +159,6 @@ private void InitializeComponent() this.btnFtpClient = new System.Windows.Forms.Button(); this.btnFTPExport = new System.Windows.Forms.Button(); this.btnFTPImport = new System.Windows.Forms.Button(); - this.btnFtpHelp = new System.Windows.Forms.Button(); this.ucFTPAccounts = new UploadersLib.AccountsControl(); this.gbFtpSettings = new System.Windows.Forms.GroupBox(); this.lblFtpFiles = new System.Windows.Forms.Label(); @@ -270,9 +269,7 @@ private void InitializeComponent() this.lblCustomUploaderImageUploader = new System.Windows.Forms.Label(); this.btnCustomUploaderFileUploaderTest = new System.Windows.Forms.Button(); this.lblCustomUploaderFileUploader = new System.Windows.Forms.Label(); - this.label1 = new System.Windows.Forms.Label(); this.btnCustomUploaderImageUploaderTest = new System.Windows.Forms.Button(); - this.lblCustomUploaderRequestTypeHelp = new System.Windows.Forms.Label(); this.lblCustomUploaderTestResult = new System.Windows.Forms.Label(); this.txtCustomUploaderDeletionURL = new System.Windows.Forms.TextBox(); this.cbCustomUploaderFileUploader = new System.Windows.Forms.ComboBox(); @@ -326,6 +323,7 @@ private void InitializeComponent() this.txtRapidSharePremiumUserName = new System.Windows.Forms.TextBox(); this.ttHelpTip = new System.Windows.Forms.ToolTip(this.components); this.actRapidShareAccountType = new UploadersLib.GUI.AccountTypeControl(); + this.btnCustomUploaderHelp = new System.Windows.Forms.Button(); this.tcUploaders.SuspendLayout(); this.tpImageUploaders.SuspendLayout(); this.tcImageUploaders.SuspendLayout(); @@ -459,7 +457,6 @@ private void InitializeComponent() // // btnImageShackOpenPublicProfile // - this.btnImageShackOpenPublicProfile.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnImageShackOpenPublicProfile.Location = new System.Drawing.Point(16, 232); this.btnImageShackOpenPublicProfile.Name = "btnImageShackOpenPublicProfile"; this.btnImageShackOpenPublicProfile.Size = new System.Drawing.Size(200, 23); @@ -481,7 +478,6 @@ private void InitializeComponent() // // btnImageShackOpenMyImages // - this.btnImageShackOpenMyImages.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnImageShackOpenMyImages.Location = new System.Drawing.Point(16, 264); this.btnImageShackOpenMyImages.Name = "btnImageShackOpenMyImages"; this.btnImageShackOpenMyImages.Size = new System.Drawing.Size(200, 23); @@ -501,7 +497,6 @@ private void InitializeComponent() // // btnImageShackOpenRegistrationCode // - this.btnImageShackOpenRegistrationCode.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnImageShackOpenRegistrationCode.Location = new System.Drawing.Point(16, 200); this.btnImageShackOpenRegistrationCode.Name = "btnImageShackOpenRegistrationCode"; this.btnImageShackOpenRegistrationCode.Size = new System.Drawing.Size(200, 23); @@ -514,14 +509,12 @@ private void InitializeComponent() // this.txtImageShackUsername.Location = new System.Drawing.Point(16, 136); this.txtImageShackUsername.Name = "txtImageShackUsername"; - this.txtImageShackUsername.Size = new System.Drawing.Size(360, 20); + this.txtImageShackUsername.Size = new System.Drawing.Size(392, 20); this.txtImageShackUsername.TabIndex = 4; this.txtImageShackUsername.TextChanged += new System.EventHandler(this.txtImageShackUsername_TextChanged); // // txtImageShackRegistrationCode // - this.txtImageShackRegistrationCode.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); this.txtImageShackRegistrationCode.Location = new System.Drawing.Point(16, 80); this.txtImageShackRegistrationCode.Name = "txtImageShackRegistrationCode"; this.txtImageShackRegistrationCode.Size = new System.Drawing.Size(392, 20); @@ -581,7 +574,7 @@ private void InitializeComponent() this.txtTinyPicPassword.Location = new System.Drawing.Point(16, 136); this.txtTinyPicPassword.Name = "txtTinyPicPassword"; this.txtTinyPicPassword.PasswordChar = '*'; - this.txtTinyPicPassword.Size = new System.Drawing.Size(360, 20); + this.txtTinyPicPassword.Size = new System.Drawing.Size(392, 20); this.txtTinyPicPassword.TabIndex = 4; this.txtTinyPicPassword.TextChanged += new System.EventHandler(this.txtTinyPicPassword_TextChanged); // @@ -598,7 +591,7 @@ private void InitializeComponent() // this.txtTinyPicUsername.Location = new System.Drawing.Point(16, 80); this.txtTinyPicUsername.Name = "txtTinyPicUsername"; - this.txtTinyPicUsername.Size = new System.Drawing.Size(360, 20); + this.txtTinyPicUsername.Size = new System.Drawing.Size(392, 20); this.txtTinyPicUsername.TabIndex = 2; this.txtTinyPicUsername.TextChanged += new System.EventHandler(this.txtTinyPicUsername_TextChanged); // @@ -613,7 +606,6 @@ private void InitializeComponent() // // btnTinyPicOpenMyImages // - this.btnTinyPicOpenMyImages.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnTinyPicOpenMyImages.Location = new System.Drawing.Point(16, 264); this.btnTinyPicOpenMyImages.Name = "btnTinyPicOpenMyImages"; this.btnTinyPicOpenMyImages.Size = new System.Drawing.Size(200, 23); @@ -644,8 +636,6 @@ private void InitializeComponent() // // txtTinyPicRegistrationCode // - this.txtTinyPicRegistrationCode.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) - | System.Windows.Forms.AnchorStyles.Right))); this.txtTinyPicRegistrationCode.BackColor = System.Drawing.Color.White; this.txtTinyPicRegistrationCode.Location = new System.Drawing.Point(16, 232); this.txtTinyPicRegistrationCode.Name = "txtTinyPicRegistrationCode"; @@ -1721,7 +1711,6 @@ private void InitializeComponent() this.panelFtp.Controls.Add(this.btnFtpClient); this.panelFtp.Controls.Add(this.btnFTPExport); this.panelFtp.Controls.Add(this.btnFTPImport); - this.panelFtp.Controls.Add(this.btnFtpHelp); this.panelFtp.Controls.Add(this.ucFTPAccounts); this.panelFtp.Dock = System.Windows.Forms.DockStyle.Fill; this.panelFtp.Location = new System.Drawing.Point(3, 3); @@ -1767,17 +1756,6 @@ private void InitializeComponent() this.btnFTPImport.UseVisualStyleBackColor = true; this.btnFTPImport.Click += new System.EventHandler(this.btnFTPImport_Click); // - // btnFtpHelp - // - this.btnFtpHelp.Location = new System.Drawing.Point(378, 7); - this.btnFtpHelp.Name = "btnFtpHelp"; - this.btnFtpHelp.Size = new System.Drawing.Size(64, 24); - this.btnFtpHelp.TabIndex = 1; - this.btnFtpHelp.Text = "Help..."; - this.btnFtpHelp.UseVisualStyleBackColor = true; - this.btnFtpHelp.Visible = false; - this.btnFtpHelp.Click += new System.EventHandler(this.btnFtpHelp_Click); - // // ucFTPAccounts // this.ucFTPAccounts.Dock = System.Windows.Forms.DockStyle.Fill; @@ -2887,12 +2865,11 @@ private void InitializeComponent() // // tpCustomUploaders // + this.tpCustomUploaders.Controls.Add(this.btnCustomUploaderHelp); this.tpCustomUploaders.Controls.Add(this.lblCustomUploaderImageUploader); this.tpCustomUploaders.Controls.Add(this.btnCustomUploaderFileUploaderTest); this.tpCustomUploaders.Controls.Add(this.lblCustomUploaderFileUploader); - this.tpCustomUploaders.Controls.Add(this.label1); this.tpCustomUploaders.Controls.Add(this.btnCustomUploaderImageUploaderTest); - this.tpCustomUploaders.Controls.Add(this.lblCustomUploaderRequestTypeHelp); this.tpCustomUploaders.Controls.Add(this.lblCustomUploaderTestResult); this.tpCustomUploaders.Controls.Add(this.txtCustomUploaderDeletionURL); this.tpCustomUploaders.Controls.Add(this.cbCustomUploaderFileUploader); @@ -2957,19 +2934,6 @@ private void InitializeComponent() this.lblCustomUploaderFileUploader.TabIndex = 27; this.lblCustomUploaderFileUploader.Text = "File uploader:"; // - // label1 - // - this.label1.BackColor = System.Drawing.Color.White; - this.label1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.label1.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162))); - this.label1.Location = new System.Drawing.Point(688, 22); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(24, 24); - this.label1.TabIndex = 6; - this.label1.Text = "?"; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.ttHelpTip.SetToolTip(this.label1, resources.GetString("label1.ToolTip")); - // // btnCustomUploaderImageUploaderTest // this.btnCustomUploaderImageUploaderTest.Location = new System.Drawing.Point(264, 388); @@ -2980,19 +2944,6 @@ private void InitializeComponent() this.btnCustomUploaderImageUploaderTest.UseVisualStyleBackColor = true; this.btnCustomUploaderImageUploaderTest.Click += new System.EventHandler(this.btnCustomUploaderImageUploaderTest_Click); // - // lblCustomUploaderRequestTypeHelp - // - this.lblCustomUploaderRequestTypeHelp.BackColor = System.Drawing.Color.White; - this.lblCustomUploaderRequestTypeHelp.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.lblCustomUploaderRequestTypeHelp.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162))); - this.lblCustomUploaderRequestTypeHelp.Location = new System.Drawing.Point(424, 22); - this.lblCustomUploaderRequestTypeHelp.Name = "lblCustomUploaderRequestTypeHelp"; - this.lblCustomUploaderRequestTypeHelp.Size = new System.Drawing.Size(24, 24); - this.lblCustomUploaderRequestTypeHelp.TabIndex = 4; - this.lblCustomUploaderRequestTypeHelp.Text = "?"; - this.lblCustomUploaderRequestTypeHelp.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; - this.ttHelpTip.SetToolTip(this.lblCustomUploaderRequestTypeHelp, resources.GetString("lblCustomUploaderRequestTypeHelp.ToolTip")); - // // lblCustomUploaderTestResult // this.lblCustomUploaderTestResult.AutoSize = true; @@ -3324,9 +3275,12 @@ private void InitializeComponent() // // txtCustomUploaderLog // + this.txtCustomUploaderLog.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); this.txtCustomUploaderLog.Location = new System.Drawing.Point(328, 408); this.txtCustomUploaderLog.Name = "txtCustomUploaderLog"; - this.txtCustomUploaderLog.Size = new System.Drawing.Size(456, 80); + this.txtCustomUploaderLog.Size = new System.Drawing.Size(456, 74); this.txtCustomUploaderLog.TabIndex = 31; this.txtCustomUploaderLog.Text = ""; this.txtCustomUploaderLog.LinkClicked += new System.Windows.Forms.LinkClickedEventHandler(this.txtCustomUploaderLog_LinkClicked); @@ -3496,6 +3450,16 @@ private void InitializeComponent() this.actRapidShareAccountType.Size = new System.Drawing.Size(214, 29); this.actRapidShareAccountType.TabIndex = 16; // + // btnCustomUploaderHelp + // + this.btnCustomUploaderHelp.Location = new System.Drawing.Point(576, 376); + this.btnCustomUploaderHelp.Name = "btnCustomUploaderHelp"; + this.btnCustomUploaderHelp.Size = new System.Drawing.Size(64, 24); + this.btnCustomUploaderHelp.TabIndex = 34; + this.btnCustomUploaderHelp.Text = "Help..."; + this.btnCustomUploaderHelp.UseVisualStyleBackColor = true; + this.btnCustomUploaderHelp.Click += new System.EventHandler(this.btnCustomUploaderHelp_Click); + // // UploadersConfigForm // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -3506,6 +3470,7 @@ private void InitializeComponent() this.MinimumSize = new System.Drawing.Size(840, 572); this.Name = "UploadersConfigForm"; this.Padding = new System.Windows.Forms.Padding(3); + this.SizeGripStyle = System.Windows.Forms.SizeGripStyle.Hide; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Outputs Configuration"; this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.UploadersConfigForm_FormClosed); @@ -3660,7 +3625,6 @@ private void InitializeComponent() private System.Windows.Forms.ComboBox cboFtpImages; private System.Windows.Forms.Panel panelFtp; private AccountsControl ucFTPAccounts; - private System.Windows.Forms.Button btnFtpHelp; internal System.Windows.Forms.Button btnFTPExport; internal System.Windows.Forms.Button btnFTPImport; private System.Windows.Forms.Label lblRapidSharePassword; @@ -3844,8 +3808,6 @@ private void InitializeComponent() private System.Windows.Forms.Label lblCustomUploaderTestResult; private System.Windows.Forms.Button btnCustomUploaderShowLastResponse; private System.Windows.Forms.ToolTip ttHelpTip; - private System.Windows.Forms.Label lblCustomUploaderRequestTypeHelp; - private System.Windows.Forms.Label label1; private System.Windows.Forms.TabPage tpHostr; private System.Windows.Forms.Label lblLocalhostrPassword; private System.Windows.Forms.Label lblLocalhostrEmail; @@ -3900,5 +3862,6 @@ private void InitializeComponent() private System.Windows.Forms.Button btnCustomUploaderImport; private System.Windows.Forms.Button btnCustomUploaderExport; private System.Windows.Forms.CheckBox chkGistPublishPublic; + private System.Windows.Forms.Button btnCustomUploaderHelp; } } \ No newline at end of file diff --git a/UploadersLib/GUI/UploadersConfigForm.cs b/UploadersLib/GUI/UploadersConfigForm.cs index b82684506..678726cdb 100644 --- a/UploadersLib/GUI/UploadersConfigForm.cs +++ b/UploadersLib/GUI/UploadersConfigForm.cs @@ -580,11 +580,6 @@ private void cboFtpFiles_SelectedIndexChanged(object sender, EventArgs e) Config.FTPSelectedFile = cboFtpFiles.SelectedIndex; } - private void btnFtpHelp_Click(object sender, EventArgs e) - { - //Helpers.LoadBrowserAsync(Links.URL_WIKI_FTPAccounts); - } - private void btnFtpClient_Click(object sender, EventArgs e) { FTPOpenClient(); @@ -760,7 +755,244 @@ private void cbLocalhostrDirectURL_CheckedChanged(object sender, EventArgs e) #endregion Localhostr - #region Custom Uploader + #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_RefreshButtonClicked() + { + MessageBox.Show("Refresh authorization is not supported.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); + } + + #endregion Jira + + #region Mega + + private void MegaConfigureTab(bool tryLogin) + { + Color OkColor = Color.Green; + Color NokColor = Color.DarkRed; + + tpMega.Enabled = false; + + atcMegaAccountType.AccountTypeChanged -= atcMegaAccountType_AccountTypeChanged; + atcMegaAccountType.SelectedAccountType = Config.MegaAnonymousLogin ? AccountType.Anonymous : AccountType.User; + atcMegaAccountType.AccountTypeChanged += atcMegaAccountType_AccountTypeChanged; + + pnlMegaLogin.Enabled = !Config.MegaAnonymousLogin; + + if (Config.MegaAuthInfos != null) + { + txtMegaEmail.Text = Config.MegaAuthInfos.Email; + } + + if (Config.MegaAnonymousLogin) + { + lblMegaStatus.Text = "Configured (anonymous)"; + lblMegaStatus.ForeColor = OkColor; + } + else if (Config.MegaAuthInfos == null) + { + lblMegaStatus.Text = "Not configured"; + lblMegaStatus.ForeColor = NokColor; + } + else + { + cbMegaFolder.Items.Clear(); + + Mega mega = new Mega(Config.MegaAuthInfos); + if (!tryLogin || mega.TryLogin()) + { + lblMegaStatus.Text = "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("[Click refresh folders]"); + cbMegaFolder.SelectedIndex = 0; + } + } + else + { + lblMegaStatus.Text = "Invalid authentication"; + lblMegaStatus.ForeColor = NokColor; + } + } + + tpMega.Enabled = true; + } + + private void atcMegaAccountType_AccountTypeChanged(AccountType accountType) + { + Config.MegaAnonymousLogin = accountType == AccountType.Anonymous; + Config.MegaAuthInfos = null; + Config.MegaParentNodeId = null; + txtMegaEmail.Text = null; + txtMegaPassword.Text = null; + cbMegaFolder.SelectedIndex = -1; + MegaConfigureTab(true); + } + + private void btnMegaLogin_Click(object sender, EventArgs e) + { + if (string.IsNullOrEmpty(txtMegaEmail.Text) || string.IsNullOrEmpty(txtMegaPassword.Text)) + { + return; + } + + Config.MegaAuthInfos = MegaApiClient.GenerateAuthInfos(txtMegaEmail.Text, txtMegaPassword.Text); + + MegaConfigureTab(true); + } + + private void cbMegaFolder_SelectedIndexChanged(object sender, EventArgs e) + { + Mega.DisplayNode selectedNode = ((ComboBox)sender).SelectedItem as Mega.DisplayNode; + if (selectedNode != null) + { + Config.MegaParentNodeId = selectedNode == Mega.DisplayNode.EmptyNode ? null : selectedNode.Node.Id; + } + } + + private void btnMegaRegister_Click(object sender, EventArgs e) + { + Helpers.LoadBrowserAsync("https://mega.co.nz/#register"); + } + + private void btnMegaRefreshFolders_Click(object sender, EventArgs e) + { + MegaConfigureTab(true); + } + + #endregion Mega + + #endregion File Uploaders + + #region Text Uploaders + + #region Pastebin + + private void btnPastebinLogin_Click(object sender, EventArgs e) + { + PastebinLogin(); + } + + #endregion Pastebin + + #region Paste.ee + + private void txtPaste_eeUserAPIKey_TextChanged(object sender, EventArgs e) + { + Config.Paste_eeUserAPIKey = txtPaste_eeUserAPIKey.Text; + } + + #endregion Paste.ee + + #region Gist + + private void atcGistAccountType_AccountTypeChanged(AccountType accountType) + { + this.Config.GistAnonymousLogin = accountType == AccountType.Anonymous; + this.oAuth2Gist.Enabled = !this.Config.GistAnonymousLogin; + } + + private void oAuth2Gist_CompleteButtonClicked(string code) + { + this.GistAuthComplete(code); + } + + private void oAuth2Gist_OpenButtonClicked() + { + this.GistAuthOpen(); + } + + private void oAuth2Gist_RefreshButtonClicked() + { + MessageBox.Show("Refresh authorization is not supported.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); + } + + private void chkGistPublishPublic_CheckedChanged(object sender, EventArgs e) + { + this.Config.GistPublishPublic = ((CheckBox)sender).Checked; + } + + #endregion Gist + + #endregion Text Uploaders + + #region URL Shorteners + + private void atcGoogleURLShortenerAccountType_AccountTypeChanged(AccountType accountType) + { + Config.GoogleURLShortenerAccountType = accountType; + } + + private void oauth2GoogleURLShortener_OpenButtonClicked() + { + GoogleURLShortenerAuthOpen(); + } + + private void oauth2GoogleURLShortener_CompleteButtonClicked(string code) + { + GoogleURLShortenerAuthComplete(code); + } + + private void oauth2GoogleURLShortener_RefreshButtonClicked() + { + GoogleURLShortenerAuthRefresh(); + } + + #endregion URL Shorteners + + #region Other Services + + private void btnTwitterLogin_Click(object sender, EventArgs e) + { + TwitterLogin(); + } + + private void cboSharedFolderImages_SelectedIndexChanged(object sender, EventArgs e) + { + Config.LocalhostSelectedImages = cboSharedFolderImages.SelectedIndex; + } + + private void cboSharedFolderText_SelectedIndexChanged(object sender, EventArgs e) + { + Config.LocalhostSelectedText = cboSharedFolderText.SelectedIndex; + } + + private void cboSharedFolderFiles_SelectedIndexChanged(object sender, EventArgs e) + { + Config.LocalhostSelectedFiles = cboSharedFolderFiles.SelectedIndex; + } + + #endregion Other Services + + #region Custom Uploaders private void btnCustomUploaderAdd_Click(object sender, EventArgs e) { @@ -1000,6 +1232,11 @@ private void btnCustomUploaderURLShortenerTest_Click(object sender, EventArgs e) } } + private void btnCustomUploaderHelp_Click(object sender, EventArgs e) + { + Helpers.LoadBrowserAsync(Links.URL_DOCS_CUSTOM_UPLOADER); + } + private void btnCustomUploaderShowLastResponse_Click(object sender, EventArgs e) { string response = btnCustomUploaderShowLastResponse.Tag as string; @@ -1018,243 +1255,6 @@ private void txtCustomUploaderLog_LinkClicked(object sender, LinkClickedEventArg Helpers.LoadBrowserAsync(e.LinkText); } - #endregion Custom Uploader - - #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_RefreshButtonClicked() - { - MessageBox.Show("Refresh authorization is not supported.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); - } - - #endregion Jira - - #region Mega - - private void MegaConfigureTab(bool tryLogin) - { - Color OkColor = Color.Green; - Color NokColor = Color.DarkRed; - - tpMega.Enabled = false; - - atcMegaAccountType.AccountTypeChanged -= atcMegaAccountType_AccountTypeChanged; - atcMegaAccountType.SelectedAccountType = Config.MegaAnonymousLogin ? AccountType.Anonymous : AccountType.User; - atcMegaAccountType.AccountTypeChanged += atcMegaAccountType_AccountTypeChanged; - - pnlMegaLogin.Enabled = !Config.MegaAnonymousLogin; - - if (Config.MegaAuthInfos != null) - { - txtMegaEmail.Text = Config.MegaAuthInfos.Email; - } - - if (Config.MegaAnonymousLogin) - { - lblMegaStatus.Text = "Configured (anonymous)"; - lblMegaStatus.ForeColor = OkColor; - } - else if (Config.MegaAuthInfos == null) - { - lblMegaStatus.Text = "Not configured"; - lblMegaStatus.ForeColor = NokColor; - } - else - { - cbMegaFolder.Items.Clear(); - - Mega mega = new Mega(Config.MegaAuthInfos); - if (!tryLogin || mega.TryLogin()) - { - lblMegaStatus.Text = "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("[Click refresh folders]"); - cbMegaFolder.SelectedIndex = 0; - } - } - else - { - lblMegaStatus.Text = "Invalid authentication"; - lblMegaStatus.ForeColor = NokColor; - } - } - - tpMega.Enabled = true; - } - - private void atcMegaAccountType_AccountTypeChanged(AccountType accountType) - { - Config.MegaAnonymousLogin = accountType == AccountType.Anonymous; - Config.MegaAuthInfos = null; - Config.MegaParentNodeId = null; - txtMegaEmail.Text = null; - txtMegaPassword.Text = null; - cbMegaFolder.SelectedIndex = -1; - MegaConfigureTab(true); - } - - private void btnMegaLogin_Click(object sender, EventArgs e) - { - if (string.IsNullOrEmpty(txtMegaEmail.Text) || string.IsNullOrEmpty(txtMegaPassword.Text)) - { - return; - } - - Config.MegaAuthInfos = MegaApiClient.GenerateAuthInfos(txtMegaEmail.Text, txtMegaPassword.Text); - - MegaConfigureTab(true); - } - - private void cbMegaFolder_SelectedIndexChanged(object sender, EventArgs e) - { - Mega.DisplayNode selectedNode = ((ComboBox)sender).SelectedItem as Mega.DisplayNode; - if (selectedNode != null) - { - Config.MegaParentNodeId = selectedNode == Mega.DisplayNode.EmptyNode ? null : selectedNode.Node.Id; - } - } - - private void btnMegaRegister_Click(object sender, EventArgs e) - { - Helpers.LoadBrowserAsync("https://mega.co.nz/#register"); - } - - private void btnMegaRefreshFolders_Click(object sender, EventArgs e) - { - MegaConfigureTab(true); - } - - #endregion Mega - - #endregion File Uploaders - - #region Text Uploaders - - #region Pastebin - - private void btnPastebinLogin_Click(object sender, EventArgs e) - { - PastebinLogin(); - } - - #endregion Pastebin - - #region Paste.ee - - private void txtPaste_eeUserAPIKey_TextChanged(object sender, EventArgs e) - { - Config.Paste_eeUserAPIKey = txtPaste_eeUserAPIKey.Text; - } - - #endregion Paste.ee - - #region Gist - - private void atcGistAccountType_AccountTypeChanged(AccountType accountType) - { - this.Config.GistAnonymousLogin = accountType == AccountType.Anonymous; - this.oAuth2Gist.Enabled = !this.Config.GistAnonymousLogin; - } - - private void oAuth2Gist_CompleteButtonClicked(string code) - { - this.GistAuthComplete(code); - } - - private void oAuth2Gist_OpenButtonClicked() - { - this.GistAuthOpen(); - } - - private void oAuth2Gist_RefreshButtonClicked() - { - MessageBox.Show("Refresh authorization is not supported.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); - } - - private void chkGistPublishPublic_CheckedChanged(object sender, EventArgs e) - { - this.Config.GistPublishPublic = ((CheckBox)sender).Checked; - } - - #endregion - - #endregion Text Uploaders - - #region URL Shorteners - - private void atcGoogleURLShortenerAccountType_AccountTypeChanged(AccountType accountType) - { - Config.GoogleURLShortenerAccountType = accountType; - } - - private void oauth2GoogleURLShortener_OpenButtonClicked() - { - GoogleURLShortenerAuthOpen(); - } - - private void oauth2GoogleURLShortener_CompleteButtonClicked(string code) - { - GoogleURLShortenerAuthComplete(code); - } - - private void oauth2GoogleURLShortener_RefreshButtonClicked() - { - GoogleURLShortenerAuthRefresh(); - } - - #endregion URL Shorteners - - #region Other Services - - private void btnTwitterLogin_Click(object sender, EventArgs e) - { - TwitterLogin(); - } - - private void cboSharedFolderImages_SelectedIndexChanged(object sender, EventArgs e) - { - Config.LocalhostSelectedImages = cboSharedFolderImages.SelectedIndex; - } - - private void cboSharedFolderText_SelectedIndexChanged(object sender, EventArgs e) - { - Config.LocalhostSelectedText = cboSharedFolderText.SelectedIndex; - } - - private void cboSharedFolderFiles_SelectedIndexChanged(object sender, EventArgs e) - { - Config.LocalhostSelectedFiles = cboSharedFolderFiles.SelectedIndex; - } - - #endregion Other Services + #endregion Custom Uploaders } } \ No newline at end of file diff --git a/UploadersLib/GUI/UploadersConfigForm.resx b/UploadersLib/GUI/UploadersConfigForm.resx index f66dc80ef..92b411931 100644 --- a/UploadersLib/GUI/UploadersConfigForm.resx +++ b/UploadersLib/GUI/UploadersConfigForm.resx @@ -237,28 +237,4 @@ 17, 17 - - If URL textbox is empty then 'Response text' or 'Redirection URL' will be automatically used. - -Regex usage for get regex result: $n$ -'n' must be index number from 'Regex from response' list. -Example for get second regex result from list: $2$ - -Regex groups usage: $n,n$ or $n,name$ -Second 'n' here must be group number or group name. -Example: $3,1$ or $2,thumbnail_result$ - - - For image uploader & file uploader: The 'POST' request type is required along with the 'File form name'. - -For text uploader or url shortener: 'POST' with no 'File Form Name' or 'GET' will replace an argument with -value '%input' or '$input$' with the text or URL. - -For text uploader: Specifying 'POST' request type and a 'File Form Name' will upload the input as a file -(useful for very long inputs). - -For example, if the argument name is 'pastebin_text' then a value of '%input' will be automatically -replaced with the text you're going to upload. Same thing applies for url shortener; '%input' -will be replaced with the url in the argument. - \ No newline at end of file