private void btnTinyPicLogin_Click(object sender, EventArgs e) { string username = txtTinyPicUsername.Text; string password = txtTinyPicPassword.Text; if (!string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password)) { try { TinyPicUploader tpu = new TinyPicUploader(APIKeys.TinyPicID, APIKeys.TinyPicKey); string registrationCode = tpu.UserAuth(username, password); if (!string.IsNullOrEmpty(registrationCode)) { Config.TinyPicRegistrationCode = 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) { DebugHelper.WriteException(ex); MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
public static void UpdateTinyPicRegCode() { if (Uploader.ProxySettings != null && Engine.ConfigWorkflow != null) { try { if (Engine.ConfigUploaders.TinyPicRememberUserPass && !string.IsNullOrEmpty(Engine.ConfigUploaders.TinyPicUsername) && !string.IsNullOrEmpty(Engine.ConfigUploaders.TinyPicPassword)) { var tpu = new TinyPicUploader(Engine.ConfigUI.ApiKeysConfig.TinyPicID, Engine.ConfigUI.ApiKeysConfig.TinyPicKey, AccountType.User); var regCode = tpu.UserAuth(Engine.ConfigUploaders.TinyPicUsername, Engine.ConfigUploaders.TinyPicPassword); if (Engine.ConfigUploaders.TinyPicRegistrationCode != regCode) { DebugHelper.WriteLine(string.Format("Updated TinyPic Shuk from {0} to {1}", Engine.ConfigUploaders.TinyPicRegistrationCode, regCode)); Engine.ConfigUploaders.TinyPicRegistrationCode = regCode; } } } catch (Exception ex) { DebugHelper.WriteException(ex, "error while trying to update TinyPic registration code."); } } }
/// <summary> /// Method to update TinyPic Shuk; Run periodically /// </summary> public static void UpdateTinyPicShuk() { if (Engine.conf.RememberTinyPicUserPass && !string.IsNullOrEmpty(Engine.conf.TinyPicUserName) && !string.IsNullOrEmpty(Engine.conf.TinyPicPassword)) { TinyPicUploader tpu = new TinyPicUploader(Engine.TINYPIC_ID, Engine.TINYPIC_KEY); string shuk = tpu.UserAuth(Engine.conf.TinyPicUserName, Engine.conf.TinyPicPassword); if (!string.IsNullOrEmpty(shuk)) { if (Engine.conf.TinyPicShuk != shuk) { FileSystem.AppendDebug(string.Format("Updated TinyPic Shuk from {0} to {1}", Engine.conf.TinyPicShuk, shuk)); } Engine.conf.TinyPicShuk = shuk; } } }
public static string GetTinyPicShuk() { UserPassBox ub = new UserPassBox("Enter TinyPic Email Address and Password", string.IsNullOrEmpty(Engine.conf.TinyPicUserName) ? "*****@*****.**" : Engine.conf.TinyPicUserName, Engine.conf.TinyPicPassword) { Icon = Resources.zss_main }; ub.ShowDialog(); if (ub.DialogResult == DialogResult.OK) { TinyPicUploader tpu = new TinyPicUploader(Engine.TINYPIC_ID, Engine.TINYPIC_KEY); if (Engine.conf.RememberTinyPicUserPass) { Engine.conf.TinyPicUserName = ub.UserName; Engine.conf.TinyPicPassword = ub.Password; } return(tpu.UserAuth(ub.UserName, ub.Password)); } return(null); }
private void btnTinyPicLogin_Click(object sender, EventArgs e) { string username = txtTinyPicUsername.Text; string password = txtTinyPicPassword.Text; if (!string.IsNullOrEmpty(username) && !string.IsNullOrEmpty(password)) { try { TinyPicUploader tpu = new TinyPicUploader(APIKeys.TinyPicID, APIKeys.TinyPicKey); string registrationCode = tpu.UserAuth(username, password); if (!string.IsNullOrEmpty(registrationCode)) { Config.TinyPicRegistrationCode = registrationCode; txtTinyPicRegistrationCode.Text = registrationCode; } } catch (Exception ex) { DebugHelper.WriteException(ex); } } }
public UploadResult UploadImage(Stream stream, string fileName) { ImageUploader imageUploader = null; switch (Info.TaskSettings.ImageDestination) { case ImageDestination.ImageShack: Program.UploadersConfig.ImageShackSettings.ThumbnailWidth = Info.TaskSettings.AdvancedSettings.ThumbnailPreferredWidth; Program.UploadersConfig.ImageShackSettings.ThumbnailHeight = Info.TaskSettings.AdvancedSettings.ThumbnailPreferredHeight; imageUploader = new ImageShackUploader(APIKeys.ImageShackKey, Program.UploadersConfig.ImageShackSettings); break; case ImageDestination.TinyPic: imageUploader = new TinyPicUploader(APIKeys.TinyPicID, APIKeys.TinyPicKey, Program.UploadersConfig.TinyPicAccountType, Program.UploadersConfig.TinyPicRegistrationCode); break; case ImageDestination.Imgur: if (Program.UploadersConfig.ImgurOAuth2Info == null) { Program.UploadersConfig.ImgurOAuth2Info = new OAuth2Info(APIKeys.ImgurClientID, APIKeys.ImgurClientSecret); } imageUploader = new Imgur_v3(Program.UploadersConfig.ImgurOAuth2Info) { UploadMethod = Program.UploadersConfig.ImgurAccountType, ThumbnailType = Program.UploadersConfig.ImgurThumbnailType, UploadAlbumID = Program.UploadersConfig.ImgurAlbumID }; break; case ImageDestination.Flickr: imageUploader = new FlickrUploader(APIKeys.FlickrKey, APIKeys.FlickrSecret, Program.UploadersConfig.FlickrAuthInfo, Program.UploadersConfig.FlickrSettings); break; case ImageDestination.Photobucket: imageUploader = new Photobucket(Program.UploadersConfig.PhotobucketOAuthInfo, Program.UploadersConfig.PhotobucketAccountInfo); break; case ImageDestination.Picasa: imageUploader = new Picasa(Program.UploadersConfig.PicasaOAuth2Info) { AlbumID = Program.UploadersConfig.PicasaAlbumID }; break; case ImageDestination.Twitpic: int indexTwitpic = Program.UploadersConfig.TwitterSelectedAccount; if (Program.UploadersConfig.TwitterOAuthInfoList != null && Program.UploadersConfig.TwitterOAuthInfoList.IsValidIndex(indexTwitpic)) { imageUploader = new TwitPicUploader(APIKeys.TwitPicKey, Program.UploadersConfig.TwitterOAuthInfoList[indexTwitpic]) { TwitPicThumbnailMode = Program.UploadersConfig.TwitPicThumbnailMode, ShowFull = Program.UploadersConfig.TwitPicShowFull }; } break; case ImageDestination.Twitsnaps: int indexTwitsnaps = Program.UploadersConfig.TwitterSelectedAccount; if (Program.UploadersConfig.TwitterOAuthInfoList.IsValidIndex(indexTwitsnaps)) { imageUploader = new TwitSnapsUploader(APIKeys.TwitsnapsKey, Program.UploadersConfig.TwitterOAuthInfoList[indexTwitsnaps]); } break; case ImageDestination.yFrog: YfrogOptions yFrogOptions = new YfrogOptions(APIKeys.ImageShackKey); yFrogOptions.Username = Program.UploadersConfig.YFrogUsername; yFrogOptions.Password = Program.UploadersConfig.YFrogPassword; yFrogOptions.Source = Application.ProductName; imageUploader = new YfrogUploader(yFrogOptions); break; case ImageDestination.MediaCrush: imageUploader = new MediaCrushUploader(); break; case ImageDestination.CustomImageUploader: if (Program.UploadersConfig.CustomUploadersList.IsValidIndex(Program.UploadersConfig.CustomImageUploaderSelected)) { imageUploader = new CustomImageUploader(Program.UploadersConfig.CustomUploadersList[Program.UploadersConfig.CustomImageUploaderSelected]); } break; } if (imageUploader != null) { PrepareUploader(imageUploader); return(imageUploader.Upload(stream, fileName)); } return(null); }
public UploadResult UploadImage(Stream stream, string fileName) { ImageUploader imageUploader = null; switch (UploadManager.ImageUploader) { case ImageDestination.ImageShack: imageUploader = new ImageShackUploader(ZKeys.ImageShackKey, Program.UploadersConfig.ImageShackAccountType, Program.UploadersConfig.ImageShackRegistrationCode) { IsPublic = Program.UploadersConfig.ImageShackShowImagesInPublic }; break; case ImageDestination.TinyPic: imageUploader = new TinyPicUploader(ZKeys.TinyPicID, ZKeys.TinyPicKey, Program.UploadersConfig.TinyPicAccountType, Program.UploadersConfig.TinyPicRegistrationCode); break; case ImageDestination.Imgur: imageUploader = new Imgur(Program.UploadersConfig.ImgurAccountType, ZKeys.ImgurAnonymousKey, Program.UploadersConfig.ImgurOAuthInfo) { ThumbnailType = Program.UploadersConfig.ImgurThumbnailType }; break; case ImageDestination.Flickr: imageUploader = new FlickrUploader(ZKeys.FlickrKey, ZKeys.FlickrSecret, Program.UploadersConfig.FlickrAuthInfo, Program.UploadersConfig.FlickrSettings); break; case ImageDestination.Photobucket: imageUploader = new Photobucket(Program.UploadersConfig.PhotobucketOAuthInfo, Program.UploadersConfig.PhotobucketAccountInfo); break; case ImageDestination.UploadScreenshot: imageUploader = new UploadScreenshot(ZKeys.UploadScreenshotKey); break; case ImageDestination.Twitpic: TwitPicOptions twitPicOptions = new TwitPicOptions(); twitPicOptions.Username = Program.UploadersConfig.TwitPicUsername; twitPicOptions.Password = Program.UploadersConfig.TwitPicPassword; twitPicOptions.TwitPicThumbnailMode = Program.UploadersConfig.TwitPicThumbnailMode; twitPicOptions.ShowFull = Program.UploadersConfig.TwitPicShowFull; imageUploader = new TwitPicUploader(twitPicOptions); break; case ImageDestination.Twitsnaps: int index = Program.UploadersConfig.TwitterSelectedAccount; if (Program.UploadersConfig.TwitterOAuthInfoList.HasValidIndex(index)) { imageUploader = new TwitSnapsUploader(ZKeys.TwitsnapsKey, Program.UploadersConfig.TwitterOAuthInfoList[index]); } break; case ImageDestination.yFrog: YfrogOptions yFrogOptions = new YfrogOptions(ZKeys.ImageShackKey); yFrogOptions.Username = Program.UploadersConfig.YFrogUsername; yFrogOptions.Password = Program.UploadersConfig.YFrogPassword; yFrogOptions.Source = Application.ProductName; imageUploader = new YfrogUploader(yFrogOptions); break; } if (imageUploader != null) { PrepareUploader(imageUploader); return(imageUploader.Upload(stream, fileName)); } return(null); }
private UploadResult UploadImage(string ssPath) { ImageUploader imageUploader = null; if (!string.IsNullOrEmpty(Program.Settings.PtpImgCode)) { imageUploader = new PtpImageUploader(Crypt.Decrypt(Program.Settings.PtpImgCode)); } else { switch ((ImageDestination)Program.Settings.ImageUploaderType) { case ImageDestination.TinyPic: imageUploader = new TinyPicUploader(ZKeys.TinyPicID, ZKeys.TinyPicKey, Program.UploadersConfig.TinyPicAccountType, Program.UploadersConfig.TinyPicRegistrationCode); break; case ImageDestination.Imgur: if (Program.UploadersConfig.ImgurOAuth2Info == null) { Program.UploadersConfig.ImgurOAuth2Info = new OAuth2Info(APIKeys.ImgurClientID, APIKeys.ImgurClientSecret); } string albumID = null; if (Program.UploadersConfig.ImgurUploadSelectedAlbum && Program.UploadersConfig.ImgurSelectedAlbum != null) { albumID = Program.UploadersConfig.ImgurSelectedAlbum.id; } imageUploader = new Imgur_v3(Program.UploadersConfig.ImgurOAuth2Info) { UploadMethod = Program.UploadersConfig.ImgurAccountType, DirectLink = Program.UploadersConfig.ImgurDirectLink, ThumbnailType = Program.UploadersConfig.ImgurThumbnailType, UploadAlbumID = albumID }; break; case ImageDestination.Flickr: imageUploader = new FlickrUploader(APIKeys.FlickrKey, APIKeys.FlickrSecret, Program.UploadersConfig.FlickrAuthInfo, Program.UploadersConfig.FlickrSettings); break; case ImageDestination.Photobucket: imageUploader = new Photobucket(Program.UploadersConfig.PhotobucketOAuthInfo, Program.UploadersConfig.PhotobucketAccountInfo); break; case ImageDestination.Picasa: imageUploader = new Picasa(Program.UploadersConfig.PicasaOAuth2Info) { AlbumID = Program.UploadersConfig.PicasaAlbumID }; break; case ImageDestination.Twitter: OAuthInfo twitterOAuth = Program.UploadersConfig.TwitterOAuthInfoList.ReturnIfValidIndex(Program.UploadersConfig.TwitterSelectedAccount); imageUploader = new Twitter(twitterOAuth); break; case ImageDestination.Chevereto: imageUploader = new Chevereto(Program.UploadersConfig.CheveretoWebsite, Program.UploadersConfig.CheveretoAPIKey) { DirectURL = Program.UploadersConfig.CheveretoDirectURL }; break; case ImageDestination.HizliResim: imageUploader = new HizliResim() { DirectURL = true }; break; case ImageDestination.CustomImageUploader: if (Program.UploadersConfig.CustomUploadersList.IsValidIndex(Program.UploadersConfig.CustomImageUploaderSelected)) { imageUploader = new CustomImageUploader(Program.UploadersConfig.CustomUploadersList[Program.UploadersConfig.CustomImageUploaderSelected]); } break; case ImageDestination.FileUploader: return(UploadFile(ssPath)); } } if (imageUploader != null) { ReportProgress(ProgressType.UPDATE_STATUSBAR_DEBUG, string.Format("Uploading {0}.", Path.GetFileName(ssPath))); return(imageUploader.Upload(ssPath)); } return(null); }
private UploadResult UploadImage(string ssPath) { ImageUploader imageUploader = null; if (!string.IsNullOrEmpty(App.Settings.PtpImgCode)) { imageUploader = new PtpImageUploader(Crypt.Decrypt(App.Settings.PtpImgCode)); } else { switch (App.Settings.ProfileActive.ImageUploaderType) { case ImageDestination.Imgur: if (App.UploadersConfig.ImgurOAuth2Info == null) { App.UploadersConfig.ImgurOAuth2Info = new OAuth2Info(APIKeys.ImgurClientID, APIKeys.ImgurClientSecret); } string albumID = null; if (App.UploadersConfig.ImgurUploadSelectedAlbum && App.UploadersConfig.ImgurSelectedAlbum != null) { albumID = App.UploadersConfig.ImgurSelectedAlbum.id; } imageUploader = new Imgur(App.UploadersConfig.ImgurOAuth2Info) { UploadMethod = App.UploadersConfig.ImgurAccountType, DirectLink = App.UploadersConfig.ImgurDirectLink, ThumbnailType = App.UploadersConfig.ImgurThumbnailType, UploadAlbumID = albumID }; break; case ImageDestination.TinyPic: imageUploader = new TinyPicUploader(APIKeys.TinyPicID, APIKeys.TinyPicKey, App.UploadersConfig.TinyPicAccountType, App.UploadersConfig.TinyPicRegistrationCode); break; case ImageDestination.Flickr: imageUploader = new FlickrUploader(APIKeys.FlickrKey, APIKeys.FlickrSecret, App.UploadersConfig.FlickrAuthInfo, App.UploadersConfig.FlickrSettings); break; case ImageDestination.Photobucket: imageUploader = new Photobucket(App.UploadersConfig.PhotobucketOAuthInfo, App.UploadersConfig.PhotobucketAccountInfo); break; case ImageDestination.Picasa: imageUploader = new Picasa(App.UploadersConfig.PicasaOAuth2Info) { AlbumID = App.UploadersConfig.PicasaAlbumID }; break; case ImageDestination.Twitter: OAuthInfo twitterOAuth = App.UploadersConfig.TwitterOAuthInfoList.ReturnIfValidIndex(App.UploadersConfig.TwitterSelectedAccount); imageUploader = new Twitter(twitterOAuth); break; case ImageDestination.Chevereto: imageUploader = new Chevereto(App.UploadersConfig.CheveretoWebsite, App.UploadersConfig.CheveretoAPIKey) { DirectURL = App.UploadersConfig.CheveretoDirectURL }; break; case ImageDestination.HizliResim: imageUploader = new HizliResim() { DirectURL = true }; break; case ImageDestination.CustomImageUploader: if (App.UploadersConfig.CustomUploadersList.IsValidIndex(App.UploadersConfig.CustomImageUploaderSelected)) { imageUploader = new CustomImageUploader(App.UploadersConfig.CustomUploadersList[App.UploadersConfig.CustomImageUploaderSelected]); } break; case ImageDestination.FileUploader: return UploadFile(ssPath); } } if (imageUploader != null) { PrepareUploader(imageUploader); return imageUploader.Upload(ssPath); } return null; }
public UploadResult UploadImage(Stream stream, string fileName) { ImageUploader imageUploader = null; switch (Info.TaskSettings.ImageDestination) { case ImageDestination.Imgur: if (Program.UploadersConfig.ImgurOAuth2Info == null) { Program.UploadersConfig.ImgurOAuth2Info = new OAuth2Info(APIKeys.ImgurClientID, APIKeys.ImgurClientSecret); } imageUploader = new Imgur_v3(Program.UploadersConfig.ImgurOAuth2Info) { UploadMethod = Program.UploadersConfig.ImgurAccountType, DirectLink = Program.UploadersConfig.ImgurDirectLink, ThumbnailType = Program.UploadersConfig.ImgurThumbnailType, UploadAlbumID = Program.UploadersConfig.ImgurAlbumID }; break; case ImageDestination.ImageShack: Program.UploadersConfig.ImageShackSettings.ThumbnailWidth = Info.TaskSettings.AdvancedSettings.ThumbnailPreferredWidth; Program.UploadersConfig.ImageShackSettings.ThumbnailHeight = Info.TaskSettings.AdvancedSettings.ThumbnailPreferredHeight; imageUploader = new ImageShackUploader(APIKeys.ImageShackKey, Program.UploadersConfig.ImageShackSettings); break; case ImageDestination.TinyPic: imageUploader = new TinyPicUploader(APIKeys.TinyPicID, APIKeys.TinyPicKey, Program.UploadersConfig.TinyPicAccountType, Program.UploadersConfig.TinyPicRegistrationCode); break; case ImageDestination.Flickr: imageUploader = new FlickrUploader(APIKeys.FlickrKey, APIKeys.FlickrSecret, Program.UploadersConfig.FlickrAuthInfo, Program.UploadersConfig.FlickrSettings); break; case ImageDestination.Photobucket: imageUploader = new Photobucket(Program.UploadersConfig.PhotobucketOAuthInfo, Program.UploadersConfig.PhotobucketAccountInfo); break; case ImageDestination.Picasa: imageUploader = new Picasa(Program.UploadersConfig.PicasaOAuth2Info) { AlbumID = Program.UploadersConfig.PicasaAlbumID }; break; case ImageDestination.Twitter: OAuthInfo twitterOAuth = Program.UploadersConfig.TwitterOAuthInfoList.ReturnIfValidIndex(Program.UploadersConfig.TwitterSelectedAccount); imageUploader = new Twitter(twitterOAuth); break; case ImageDestination.CustomImageUploader: if (Program.UploadersConfig.CustomUploadersList.IsValidIndex(Program.UploadersConfig.CustomImageUploaderSelected)) { imageUploader = new CustomImageUploader(Program.UploadersConfig.CustomUploadersList[Program.UploadersConfig.CustomImageUploaderSelected]); } break; } if (imageUploader != null) { PrepareUploader(imageUploader); return(imageUploader.Upload(stream, fileName)); } return(null); }