Added ImageShack anonymous support and ui improvements

This commit is contained in:
Jaex 2014-01-12 13:37:05 +02:00
parent afe2985b60
commit 520dee1563
5 changed files with 113 additions and 107 deletions

View file

@ -261,7 +261,7 @@ public bool IsActive(ImageDestination destination)
switch (destination) switch (destination)
{ {
case ImageDestination.ImageShack: case ImageDestination.ImageShack:
return ImageShackSettings != null && !string.IsNullOrEmpty(ImageShackSettings.Auth_token); return ImageShackSettings != null && (ImageShackSettings.AccountType == AccountType.Anonymous || !string.IsNullOrEmpty(ImageShackSettings.Auth_token));
case ImageDestination.TinyPic: case ImageDestination.TinyPic:
return TinyPicAccountType == AccountType.Anonymous || !string.IsNullOrEmpty(TinyPicRegistrationCode); return TinyPicAccountType == AccountType.Anonymous || !string.IsNullOrEmpty(TinyPicRegistrationCode);
case ImageDestination.Imgur: case ImageDestination.Imgur:

View file

@ -34,13 +34,15 @@ private void InitializeComponent()
this.tpImageUploaders = new System.Windows.Forms.TabPage(); this.tpImageUploaders = new System.Windows.Forms.TabPage();
this.tcImageUploaders = new System.Windows.Forms.TabControl(); this.tcImageUploaders = new System.Windows.Forms.TabControl();
this.tpImageShack = new System.Windows.Forms.TabPage(); this.tpImageShack = new System.Windows.Forms.TabPage();
this.atcImageShackAccountType = new UploadersLib.GUI.AccountTypeControl();
this.btnImageShackLogin = new System.Windows.Forms.Button();
this.btnImageShackOpenPublicProfile = new System.Windows.Forms.Button(); this.btnImageShackOpenPublicProfile = new System.Windows.Forms.Button();
this.cbImageShackIsPublic = new System.Windows.Forms.CheckBox(); this.cbImageShackIsPublic = new System.Windows.Forms.CheckBox();
this.btnImageShackOpenMyImages = new System.Windows.Forms.Button(); this.btnImageShackOpenMyImages = new System.Windows.Forms.Button();
this.lblImageShackUsername = new System.Windows.Forms.Label(); this.lblImageShackUsername = new System.Windows.Forms.Label();
this.txtImageShackUsername = new System.Windows.Forms.TextBox(); this.txtImageShackUsername = new System.Windows.Forms.TextBox();
this.txtImageShackPassword = new System.Windows.Forms.TextBox(); this.txtImageShackPassword = new System.Windows.Forms.TextBox();
this.lblImageShackRegistrationCode = new System.Windows.Forms.Label(); this.lblImageShackPassword = new System.Windows.Forms.Label();
this.tpTinyPic = new System.Windows.Forms.TabPage(); this.tpTinyPic = new System.Windows.Forms.TabPage();
this.atcTinyPicAccountType = new UploadersLib.GUI.AccountTypeControl(); this.atcTinyPicAccountType = new UploadersLib.GUI.AccountTypeControl();
this.btnTinyPicLogin = new System.Windows.Forms.Button(); this.btnTinyPicLogin = new System.Windows.Forms.Button();
@ -49,9 +51,6 @@ private void InitializeComponent()
this.txtTinyPicUsername = new System.Windows.Forms.TextBox(); this.txtTinyPicUsername = new System.Windows.Forms.TextBox();
this.lblTinyPicUsername = new System.Windows.Forms.Label(); this.lblTinyPicUsername = new System.Windows.Forms.Label();
this.btnTinyPicOpenMyImages = new System.Windows.Forms.Button(); this.btnTinyPicOpenMyImages = new System.Windows.Forms.Button();
this.cbTinyPicRememberUsernamePassword = new System.Windows.Forms.CheckBox();
this.lblTinyPicRegistrationCode = new System.Windows.Forms.Label();
this.txtTinyPicRegistrationCode = new System.Windows.Forms.TextBox();
this.tpImgur = new System.Windows.Forms.TabPage(); this.tpImgur = new System.Windows.Forms.TabPage();
this.oauth2Imgur = new UploadersLib.GUI.OAuth2Control(); this.oauth2Imgur = new UploadersLib.GUI.OAuth2Control();
this.txtImgurAlbumID = new System.Windows.Forms.TextBox(); this.txtImgurAlbumID = new System.Windows.Forms.TextBox();
@ -430,13 +429,15 @@ private void InitializeComponent()
// //
// tpImageShack // tpImageShack
// //
this.tpImageShack.Controls.Add(this.atcImageShackAccountType);
this.tpImageShack.Controls.Add(this.btnImageShackLogin);
this.tpImageShack.Controls.Add(this.btnImageShackOpenPublicProfile); this.tpImageShack.Controls.Add(this.btnImageShackOpenPublicProfile);
this.tpImageShack.Controls.Add(this.cbImageShackIsPublic); this.tpImageShack.Controls.Add(this.cbImageShackIsPublic);
this.tpImageShack.Controls.Add(this.btnImageShackOpenMyImages); this.tpImageShack.Controls.Add(this.btnImageShackOpenMyImages);
this.tpImageShack.Controls.Add(this.lblImageShackUsername); this.tpImageShack.Controls.Add(this.lblImageShackUsername);
this.tpImageShack.Controls.Add(this.txtImageShackUsername); this.tpImageShack.Controls.Add(this.txtImageShackUsername);
this.tpImageShack.Controls.Add(this.txtImageShackPassword); this.tpImageShack.Controls.Add(this.txtImageShackPassword);
this.tpImageShack.Controls.Add(this.lblImageShackRegistrationCode); this.tpImageShack.Controls.Add(this.lblImageShackPassword);
this.tpImageShack.Location = new System.Drawing.Point(4, 22); this.tpImageShack.Location = new System.Drawing.Point(4, 22);
this.tpImageShack.Name = "tpImageShack"; this.tpImageShack.Name = "tpImageShack";
this.tpImageShack.Padding = new System.Windows.Forms.Padding(3); this.tpImageShack.Padding = new System.Windows.Forms.Padding(3);
@ -445,11 +446,30 @@ private void InitializeComponent()
this.tpImageShack.Text = "ImageShack"; this.tpImageShack.Text = "ImageShack";
this.tpImageShack.UseVisualStyleBackColor = true; this.tpImageShack.UseVisualStyleBackColor = true;
// //
// atcImageShackAccountType
//
this.atcImageShackAccountType.Location = new System.Drawing.Point(8, 16);
this.atcImageShackAccountType.Name = "atcImageShackAccountType";
this.atcImageShackAccountType.SelectedAccountType = UploadersLib.AccountType.Anonymous;
this.atcImageShackAccountType.Size = new System.Drawing.Size(272, 29);
this.atcImageShackAccountType.TabIndex = 10;
this.atcImageShackAccountType.AccountTypeChanged += new UploadersLib.GUI.AccountTypeControl.AccountTypeChangedEventHandler(this.atcImageShackAccountType_AccountTypeChanged);
//
// btnImageShackLogin
//
this.btnImageShackLogin.Location = new System.Drawing.Point(296, 82);
this.btnImageShackLogin.Name = "btnImageShackLogin";
this.btnImageShackLogin.Size = new System.Drawing.Size(72, 24);
this.btnImageShackLogin.TabIndex = 9;
this.btnImageShackLogin.Text = "Login";
this.btnImageShackLogin.UseVisualStyleBackColor = true;
this.btnImageShackLogin.Click += new System.EventHandler(this.btnImageShackLogin_Click);
//
// btnImageShackOpenPublicProfile // btnImageShackOpenPublicProfile
// //
this.btnImageShackOpenPublicProfile.Location = new System.Drawing.Point(16, 160); this.btnImageShackOpenPublicProfile.Location = new System.Drawing.Point(184, 152);
this.btnImageShackOpenPublicProfile.Name = "btnImageShackOpenPublicProfile"; this.btnImageShackOpenPublicProfile.Name = "btnImageShackOpenPublicProfile";
this.btnImageShackOpenPublicProfile.Size = new System.Drawing.Size(200, 23); this.btnImageShackOpenPublicProfile.Size = new System.Drawing.Size(160, 24);
this.btnImageShackOpenPublicProfile.TabIndex = 7; this.btnImageShackOpenPublicProfile.TabIndex = 7;
this.btnImageShackOpenPublicProfile.Text = "Open public profile page..."; this.btnImageShackOpenPublicProfile.Text = "Open public profile page...";
this.btnImageShackOpenPublicProfile.UseVisualStyleBackColor = true; this.btnImageShackOpenPublicProfile.UseVisualStyleBackColor = true;
@ -458,19 +478,19 @@ private void InitializeComponent()
// cbImageShackIsPublic // cbImageShackIsPublic
// //
this.cbImageShackIsPublic.AutoSize = true; this.cbImageShackIsPublic.AutoSize = true;
this.cbImageShackIsPublic.Location = new System.Drawing.Point(16, 128); this.cbImageShackIsPublic.Location = new System.Drawing.Point(18, 120);
this.cbImageShackIsPublic.Name = "cbImageShackIsPublic"; this.cbImageShackIsPublic.Name = "cbImageShackIsPublic";
this.cbImageShackIsPublic.Size = new System.Drawing.Size(307, 17); this.cbImageShackIsPublic.Size = new System.Drawing.Size(106, 17);
this.cbImageShackIsPublic.TabIndex = 5; this.cbImageShackIsPublic.TabIndex = 5;
this.cbImageShackIsPublic.Text = "Show images uploaded to ImageShack in your public profile"; this.cbImageShackIsPublic.Text = "Is public upload?";
this.cbImageShackIsPublic.UseVisualStyleBackColor = true; this.cbImageShackIsPublic.UseVisualStyleBackColor = true;
this.cbImageShackIsPublic.CheckedChanged += new System.EventHandler(this.cbImageShackIsPublic_CheckedChanged); this.cbImageShackIsPublic.CheckedChanged += new System.EventHandler(this.cbImageShackIsPublic_CheckedChanged);
// //
// btnImageShackOpenMyImages // btnImageShackOpenMyImages
// //
this.btnImageShackOpenMyImages.Location = new System.Drawing.Point(16, 192); this.btnImageShackOpenMyImages.Location = new System.Drawing.Point(16, 152);
this.btnImageShackOpenMyImages.Name = "btnImageShackOpenMyImages"; this.btnImageShackOpenMyImages.Name = "btnImageShackOpenMyImages";
this.btnImageShackOpenMyImages.Size = new System.Drawing.Size(200, 23); this.btnImageShackOpenMyImages.Size = new System.Drawing.Size(160, 24);
this.btnImageShackOpenMyImages.TabIndex = 8; this.btnImageShackOpenMyImages.TabIndex = 8;
this.btnImageShackOpenMyImages.Text = "Open my images page..."; this.btnImageShackOpenMyImages.Text = "Open my images page...";
this.btnImageShackOpenMyImages.UseVisualStyleBackColor = true; this.btnImageShackOpenMyImages.UseVisualStyleBackColor = true;
@ -479,37 +499,37 @@ private void InitializeComponent()
// lblImageShackUsername // lblImageShackUsername
// //
this.lblImageShackUsername.AutoSize = true; this.lblImageShackUsername.AutoSize = true;
this.lblImageShackUsername.Location = new System.Drawing.Point(16, 16); this.lblImageShackUsername.Location = new System.Drawing.Point(16, 56);
this.lblImageShackUsername.Name = "lblImageShackUsername"; this.lblImageShackUsername.Name = "lblImageShackUsername";
this.lblImageShackUsername.Size = new System.Drawing.Size(55, 13); this.lblImageShackUsername.Size = new System.Drawing.Size(35, 13);
this.lblImageShackUsername.TabIndex = 3; this.lblImageShackUsername.TabIndex = 3;
this.lblImageShackUsername.Text = "Username"; this.lblImageShackUsername.Text = "Email:";
// //
// txtImageShackUsername // txtImageShackUsername
// //
this.txtImageShackUsername.Location = new System.Drawing.Point(16, 40); this.txtImageShackUsername.Location = new System.Drawing.Point(80, 52);
this.txtImageShackUsername.Name = "txtImageShackUsername"; this.txtImageShackUsername.Name = "txtImageShackUsername";
this.txtImageShackUsername.Size = new System.Drawing.Size(304, 20); this.txtImageShackUsername.Size = new System.Drawing.Size(208, 20);
this.txtImageShackUsername.TabIndex = 4; this.txtImageShackUsername.TabIndex = 4;
this.txtImageShackUsername.TextChanged += new System.EventHandler(this.txtImageShackUsername_TextChanged); this.txtImageShackUsername.TextChanged += new System.EventHandler(this.txtImageShackUsername_TextChanged);
// //
// txtImageShackPassword // txtImageShackPassword
// //
this.txtImageShackPassword.Location = new System.Drawing.Point(16, 96); this.txtImageShackPassword.Location = new System.Drawing.Point(80, 84);
this.txtImageShackPassword.Name = "txtImageShackPassword"; this.txtImageShackPassword.Name = "txtImageShackPassword";
this.txtImageShackPassword.PasswordChar = '*'; this.txtImageShackPassword.PasswordChar = '*';
this.txtImageShackPassword.Size = new System.Drawing.Size(304, 20); this.txtImageShackPassword.Size = new System.Drawing.Size(208, 20);
this.txtImageShackPassword.TabIndex = 2; this.txtImageShackPassword.TabIndex = 2;
this.txtImageShackPassword.TextChanged += new System.EventHandler(this.txtImageShackRegistrationCode_TextChanged); this.txtImageShackPassword.TextChanged += new System.EventHandler(this.txtImageShackPassword_TextChanged);
// //
// lblImageShackRegistrationCode // lblImageShackPassword
// //
this.lblImageShackRegistrationCode.AutoSize = true; this.lblImageShackPassword.AutoSize = true;
this.lblImageShackRegistrationCode.Location = new System.Drawing.Point(16, 72); this.lblImageShackPassword.Location = new System.Drawing.Point(16, 88);
this.lblImageShackRegistrationCode.Name = "lblImageShackRegistrationCode"; this.lblImageShackPassword.Name = "lblImageShackPassword";
this.lblImageShackRegistrationCode.Size = new System.Drawing.Size(56, 13); this.lblImageShackPassword.Size = new System.Drawing.Size(56, 13);
this.lblImageShackRegistrationCode.TabIndex = 1; this.lblImageShackPassword.TabIndex = 1;
this.lblImageShackRegistrationCode.Text = "Password:"; this.lblImageShackPassword.Text = "Password:";
// //
// tpTinyPic // tpTinyPic
// //
@ -520,9 +540,6 @@ private void InitializeComponent()
this.tpTinyPic.Controls.Add(this.txtTinyPicUsername); this.tpTinyPic.Controls.Add(this.txtTinyPicUsername);
this.tpTinyPic.Controls.Add(this.lblTinyPicUsername); this.tpTinyPic.Controls.Add(this.lblTinyPicUsername);
this.tpTinyPic.Controls.Add(this.btnTinyPicOpenMyImages); this.tpTinyPic.Controls.Add(this.btnTinyPicOpenMyImages);
this.tpTinyPic.Controls.Add(this.cbTinyPicRememberUsernamePassword);
this.tpTinyPic.Controls.Add(this.lblTinyPicRegistrationCode);
this.tpTinyPic.Controls.Add(this.txtTinyPicRegistrationCode);
this.tpTinyPic.Location = new System.Drawing.Point(4, 22); this.tpTinyPic.Location = new System.Drawing.Point(4, 22);
this.tpTinyPic.Name = "tpTinyPic"; this.tpTinyPic.Name = "tpTinyPic";
this.tpTinyPic.Padding = new System.Windows.Forms.Padding(3); this.tpTinyPic.Padding = new System.Windows.Forms.Padding(3);
@ -542,9 +559,9 @@ private void InitializeComponent()
// //
// btnTinyPicLogin // btnTinyPicLogin
// //
this.btnTinyPicLogin.Location = new System.Drawing.Point(16, 168); this.btnTinyPicLogin.Location = new System.Drawing.Point(296, 82);
this.btnTinyPicLogin.Name = "btnTinyPicLogin"; this.btnTinyPicLogin.Name = "btnTinyPicLogin";
this.btnTinyPicLogin.Size = new System.Drawing.Size(80, 23); this.btnTinyPicLogin.Size = new System.Drawing.Size(72, 24);
this.btnTinyPicLogin.TabIndex = 5; this.btnTinyPicLogin.TabIndex = 5;
this.btnTinyPicLogin.Text = "Login"; this.btnTinyPicLogin.Text = "Login";
this.btnTinyPicLogin.UseVisualStyleBackColor = true; this.btnTinyPicLogin.UseVisualStyleBackColor = true;
@ -552,17 +569,17 @@ private void InitializeComponent()
// //
// txtTinyPicPassword // txtTinyPicPassword
// //
this.txtTinyPicPassword.Location = new System.Drawing.Point(16, 136); this.txtTinyPicPassword.Location = new System.Drawing.Point(80, 84);
this.txtTinyPicPassword.Name = "txtTinyPicPassword"; this.txtTinyPicPassword.Name = "txtTinyPicPassword";
this.txtTinyPicPassword.PasswordChar = '*'; this.txtTinyPicPassword.PasswordChar = '*';
this.txtTinyPicPassword.Size = new System.Drawing.Size(392, 20); this.txtTinyPicPassword.Size = new System.Drawing.Size(208, 20);
this.txtTinyPicPassword.TabIndex = 4; this.txtTinyPicPassword.TabIndex = 4;
this.txtTinyPicPassword.TextChanged += new System.EventHandler(this.txtTinyPicPassword_TextChanged); this.txtTinyPicPassword.TextChanged += new System.EventHandler(this.txtTinyPicPassword_TextChanged);
// //
// lblTinyPicPassword // lblTinyPicPassword
// //
this.lblTinyPicPassword.AutoSize = true; this.lblTinyPicPassword.AutoSize = true;
this.lblTinyPicPassword.Location = new System.Drawing.Point(16, 112); this.lblTinyPicPassword.Location = new System.Drawing.Point(16, 88);
this.lblTinyPicPassword.Name = "lblTinyPicPassword"; this.lblTinyPicPassword.Name = "lblTinyPicPassword";
this.lblTinyPicPassword.Size = new System.Drawing.Size(56, 13); this.lblTinyPicPassword.Size = new System.Drawing.Size(56, 13);
this.lblTinyPicPassword.TabIndex = 3; this.lblTinyPicPassword.TabIndex = 3;
@ -570,9 +587,9 @@ private void InitializeComponent()
// //
// txtTinyPicUsername // txtTinyPicUsername
// //
this.txtTinyPicUsername.Location = new System.Drawing.Point(16, 80); this.txtTinyPicUsername.Location = new System.Drawing.Point(80, 52);
this.txtTinyPicUsername.Name = "txtTinyPicUsername"; this.txtTinyPicUsername.Name = "txtTinyPicUsername";
this.txtTinyPicUsername.Size = new System.Drawing.Size(392, 20); this.txtTinyPicUsername.Size = new System.Drawing.Size(208, 20);
this.txtTinyPicUsername.TabIndex = 2; this.txtTinyPicUsername.TabIndex = 2;
this.txtTinyPicUsername.TextChanged += new System.EventHandler(this.txtTinyPicUsername_TextChanged); this.txtTinyPicUsername.TextChanged += new System.EventHandler(this.txtTinyPicUsername_TextChanged);
// //
@ -587,43 +604,14 @@ private void InitializeComponent()
// //
// btnTinyPicOpenMyImages // btnTinyPicOpenMyImages
// //
this.btnTinyPicOpenMyImages.Location = new System.Drawing.Point(16, 264); this.btnTinyPicOpenMyImages.Location = new System.Drawing.Point(16, 120);
this.btnTinyPicOpenMyImages.Name = "btnTinyPicOpenMyImages"; this.btnTinyPicOpenMyImages.Name = "btnTinyPicOpenMyImages";
this.btnTinyPicOpenMyImages.Size = new System.Drawing.Size(200, 23); this.btnTinyPicOpenMyImages.Size = new System.Drawing.Size(160, 24);
this.btnTinyPicOpenMyImages.TabIndex = 9; this.btnTinyPicOpenMyImages.TabIndex = 9;
this.btnTinyPicOpenMyImages.Text = "Open my images page..."; this.btnTinyPicOpenMyImages.Text = "Open my images page...";
this.btnTinyPicOpenMyImages.UseVisualStyleBackColor = true; this.btnTinyPicOpenMyImages.UseVisualStyleBackColor = true;
this.btnTinyPicOpenMyImages.Click += new System.EventHandler(this.btnTinyPicOpenMyImages_Click); this.btnTinyPicOpenMyImages.Click += new System.EventHandler(this.btnTinyPicOpenMyImages_Click);
// //
// cbTinyPicRememberUsernamePassword
//
this.cbTinyPicRememberUsernamePassword.AutoSize = true;
this.cbTinyPicRememberUsernamePassword.Location = new System.Drawing.Point(112, 171);
this.cbTinyPicRememberUsernamePassword.Name = "cbTinyPicRememberUsernamePassword";
this.cbTinyPicRememberUsernamePassword.Size = new System.Drawing.Size(233, 17);
this.cbTinyPicRememberUsernamePassword.TabIndex = 6;
this.cbTinyPicRememberUsernamePassword.Text = "Remember TinyPic username and password";
this.cbTinyPicRememberUsernamePassword.UseVisualStyleBackColor = true;
this.cbTinyPicRememberUsernamePassword.CheckedChanged += new System.EventHandler(this.cbTinyPicRememberUsernamePassword_CheckedChanged);
//
// lblTinyPicRegistrationCode
//
this.lblTinyPicRegistrationCode.AutoSize = true;
this.lblTinyPicRegistrationCode.Location = new System.Drawing.Point(16, 208);
this.lblTinyPicRegistrationCode.Name = "lblTinyPicRegistrationCode";
this.lblTinyPicRegistrationCode.Size = new System.Drawing.Size(335, 13);
this.lblTinyPicRegistrationCode.TabIndex = 7;
this.lblTinyPicRegistrationCode.Text = "Registration code (You must login for be able to get registration code):";
//
// txtTinyPicRegistrationCode
//
this.txtTinyPicRegistrationCode.BackColor = System.Drawing.Color.White;
this.txtTinyPicRegistrationCode.Location = new System.Drawing.Point(16, 232);
this.txtTinyPicRegistrationCode.Name = "txtTinyPicRegistrationCode";
this.txtTinyPicRegistrationCode.ReadOnly = true;
this.txtTinyPicRegistrationCode.Size = new System.Drawing.Size(392, 20);
this.txtTinyPicRegistrationCode.TabIndex = 8;
//
// tpImgur // tpImgur
// //
this.tpImgur.Controls.Add(this.oauth2Imgur); this.tpImgur.Controls.Add(this.oauth2Imgur);
@ -3600,16 +3588,12 @@ private void InitializeComponent()
private System.Windows.Forms.TabControl tcSocialNetworkingServices; private System.Windows.Forms.TabControl tcSocialNetworkingServices;
private System.Windows.Forms.TabPage tpTwitter; private System.Windows.Forms.TabPage tpTwitter;
internal System.Windows.Forms.Button btnImageShackOpenPublicProfile; internal System.Windows.Forms.Button btnImageShackOpenPublicProfile;
internal System.Windows.Forms.CheckBox cbImageShackIsPublic;
internal System.Windows.Forms.Button btnImageShackOpenMyImages; internal System.Windows.Forms.Button btnImageShackOpenMyImages;
internal System.Windows.Forms.Label lblImageShackUsername; internal System.Windows.Forms.Label lblImageShackUsername;
internal System.Windows.Forms.TextBox txtImageShackUsername; internal System.Windows.Forms.TextBox txtImageShackUsername;
internal System.Windows.Forms.TextBox txtImageShackPassword; internal System.Windows.Forms.TextBox txtImageShackPassword;
internal System.Windows.Forms.Label lblImageShackRegistrationCode; internal System.Windows.Forms.Label lblImageShackPassword;
internal System.Windows.Forms.Button btnTinyPicOpenMyImages; internal System.Windows.Forms.Button btnTinyPicOpenMyImages;
internal System.Windows.Forms.CheckBox cbTinyPicRememberUsernamePassword;
internal System.Windows.Forms.Label lblTinyPicRegistrationCode;
internal System.Windows.Forms.TextBox txtTinyPicRegistrationCode;
private System.Windows.Forms.TextBox txtTinyPicPassword; private System.Windows.Forms.TextBox txtTinyPicPassword;
private System.Windows.Forms.Label lblTinyPicPassword; private System.Windows.Forms.Label lblTinyPicPassword;
private System.Windows.Forms.TextBox txtTinyPicUsername; private System.Windows.Forms.TextBox txtTinyPicUsername;
@ -3871,5 +3855,8 @@ private void InitializeComponent()
private System.Windows.Forms.Button btnCustomUploaderHelp; private System.Windows.Forms.Button btnCustomUploaderHelp;
private System.Windows.Forms.TabPage tpBitly; private System.Windows.Forms.TabPage tpBitly;
private GUI.OAuth2Control oauth2Bitly; private GUI.OAuth2Control oauth2Bitly;
private System.Windows.Forms.Button btnImageShackLogin;
private System.Windows.Forms.CheckBox cbImageShackIsPublic;
private GUI.AccountTypeControl atcImageShackAccountType;
} }
} }

View file

@ -69,16 +69,43 @@ private void UploadersConfigForm_Resize(object sender, EventArgs e)
#region ImageShack #region ImageShack
private void atcImageShackAccountType_AccountTypeChanged(AccountType accountType)
{
Config.ImageShackSettings.AccountType = accountType;
}
private void txtImageShackUsername_TextChanged(object sender, EventArgs e) private void txtImageShackUsername_TextChanged(object sender, EventArgs e)
{ {
Config.ImageShackSettings.Username = txtImageShackUsername.Text; Config.ImageShackSettings.Username = txtImageShackUsername.Text;
} }
private void txtImageShackRegistrationCode_TextChanged(object sender, EventArgs e) private void txtImageShackPassword_TextChanged(object sender, EventArgs e)
{ {
Config.ImageShackSettings.Password = txtImageShackPassword.Text; 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("Login successful.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show("Login failed.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
catch (Exception ex)
{
DebugHelper.WriteException(ex);
MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void cbImageShackIsPublic_CheckedChanged(object sender, EventArgs e) private void cbImageShackIsPublic_CheckedChanged(object sender, EventArgs e)
{ {
Config.ImageShackSettings.IsPublic = cbImageShackIsPublic.Checked; Config.ImageShackSettings.IsPublic = cbImageShackIsPublic.Checked;
@ -141,32 +168,21 @@ private void btnTinyPicLogin_Click(object sender, EventArgs e)
if (!string.IsNullOrEmpty(registrationCode)) if (!string.IsNullOrEmpty(registrationCode))
{ {
Config.TinyPicRegistrationCode = registrationCode; Config.TinyPicRegistrationCode = registrationCode;
txtTinyPicRegistrationCode.Text = registrationCode; MessageBox.Show("Login successful.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
}
else
{
MessageBox.Show("Login failed.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
catch (Exception ex) catch (Exception ex)
{ {
DebugHelper.WriteException(ex); DebugHelper.WriteException(ex);
MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
} }
} }
} }
private void cbTinyPicRememberUsernamePassword_CheckedChanged(object sender, EventArgs e)
{
Config.TinyPicRememberUserPass = cbTinyPicRememberUsernamePassword.Checked;
if (Config.TinyPicRememberUserPass)
{
Config.TinyPicUsername = txtTinyPicUsername.Text;
Config.TinyPicPassword = txtTinyPicPassword.Text;
}
else
{
Config.TinyPicUsername = string.Empty;
Config.TinyPicPassword = string.Empty;
}
}
private void btnTinyPicOpenMyImages_Click(object sender, EventArgs e) private void btnTinyPicOpenMyImages_Click(object sender, EventArgs e)
{ {
Helpers.LoadBrowserAsync("http://tinypic.com/yourstuff.php"); Helpers.LoadBrowserAsync("http://tinypic.com/yourstuff.php");

View file

@ -129,6 +129,7 @@ public void LoadSettings(UploadersConfig uploadersConfig)
// ImageShack // ImageShack
atcImageShackAccountType.SelectedAccountType = Config.ImageShackSettings.AccountType;
txtImageShackUsername.Text = Config.ImageShackSettings.Username; txtImageShackUsername.Text = Config.ImageShackSettings.Username;
txtImageShackPassword.Text = Config.ImageShackSettings.Password; txtImageShackPassword.Text = Config.ImageShackSettings.Password;
cbImageShackIsPublic.Checked = Config.ImageShackSettings.IsPublic; cbImageShackIsPublic.Checked = Config.ImageShackSettings.IsPublic;
@ -138,8 +139,6 @@ public void LoadSettings(UploadersConfig uploadersConfig)
atcTinyPicAccountType.SelectedAccountType = Config.TinyPicAccountType; atcTinyPicAccountType.SelectedAccountType = Config.TinyPicAccountType;
txtTinyPicUsername.Text = Config.TinyPicUsername; txtTinyPicUsername.Text = Config.TinyPicUsername;
txtTinyPicPassword.Text = Config.TinyPicPassword; txtTinyPicPassword.Text = Config.TinyPicPassword;
cbTinyPicRememberUsernamePassword.Checked = Config.TinyPicRememberUserPass;
txtTinyPicRegistrationCode.Text = Config.TinyPicRegistrationCode;
// Imgur // Imgur

View file

@ -48,22 +48,25 @@ public ImageShackUploader(string developerKey, ImageShackOptions config)
Config = config; Config = config;
} }
public bool GetAccessToken(ImageShackOptions config) public bool GetAccessToken()
{ {
Dictionary<string, string> args = new Dictionary<string, string>(); if (!string.IsNullOrEmpty(Config.Username) && !string.IsNullOrEmpty(Config.Password))
args.Add("user", config.Username);
args.Add("password", config.Password);
string response = SendPostRequest(URLAccessToken, args);
if (!string.IsNullOrEmpty(response))
{ {
ImageShackLoginResponse resp = JsonConvert.DeserializeObject<ImageShackLoginResponse>(response); Dictionary<string, string> args = new Dictionary<string, string>();
args.Add("user", Config.Username);
args.Add("password", Config.Password);
if (resp != null && resp.result != null && !string.IsNullOrEmpty(resp.result.auth_token)) string response = SendPostRequest(URLAccessToken, args);
if (!string.IsNullOrEmpty(response))
{ {
config.Auth_token = resp.result.auth_token; ImageShackLoginResponse resp = JsonConvert.DeserializeObject<ImageShackLoginResponse>(response);
return true;
if (resp != null && resp.result != null && !string.IsNullOrEmpty(resp.result.auth_token))
{
Config.Auth_token = resp.result.auth_token;
return true;
}
} }
} }
@ -75,7 +78,7 @@ public override UploadResult Upload(Stream stream, string fileName)
Dictionary<string, string> arguments = new Dictionary<string, string>(); Dictionary<string, string> arguments = new Dictionary<string, string>();
arguments.Add("api_key", APIKey); arguments.Add("api_key", APIKey);
if (!string.IsNullOrEmpty(Config.Auth_token)) if (Config.AccountType == AccountType.User && !string.IsNullOrEmpty(Config.Auth_token))
{ {
arguments.Add("auth_token", Config.Auth_token); arguments.Add("auth_token", Config.Auth_token);
} }
@ -190,6 +193,7 @@ public class ImageShackImage
public class ImageShackOptions public class ImageShackOptions
{ {
public AccountType AccountType { get; set; }
public string Username { get; set; } public string Username { get; set; }
public string Password { get; set; } public string Password { get; set; }
public bool IsPublic { get; set; } public bool IsPublic { get; set; }