public UploadResult UploadText(Stream stream) { TextUploader textUploader = null; switch (UploadManager.TextUploader) { case TextDestination.Pastebin: textUploader = new PastebinUploader(ZKeys.PastebinKey, Program.UploadersConfig.PastebinSettings); break; case TextDestination.PastebinCA: textUploader = new PastebinCaUploader(ZKeys.PastebinCaKey); break; case TextDestination.Paste2: textUploader = new Paste2Uploader(); break; case TextDestination.Slexy: textUploader = new SlexyUploader(); break; } if (textUploader != null) { PrepareUploader(textUploader); string url = textUploader.UploadText(stream); return new UploadResult(null, url); } return null; }
private void UploadText(TextDestination textUploaderType) { TextUploader textUploader = null; switch (textUploaderType) { case TextDestination.Pastebin: textUploader = new PastebinUploader(Engine.ConfigUI.ApiKeysConfig.PastebinKey, Engine.ConfigUploaders.PastebinSettings); break; case TextDestination.PastebinCA: textUploader = new PastebinCaUploader(Engine.ConfigUI.ApiKeysConfig.PastebinCaKey); break; case TextDestination.Paste2: textUploader = new Paste2Uploader(); break; case TextDestination.Slexy: textUploader = new SlexyUploader(); break; case TextDestination.FileUploader: UploadFile(); break; } if (textUploader != null) { DestinationName = textUploaderType.GetDescription(); DebugHelper.WriteLine("Uploading to " + DestinationName); string url = string.Empty; if (!string.IsNullOrEmpty(TempText)) { url = textUploader.UploadText(TempText); } else { url = textUploader.UploadTextFile(Info.LocalFilePath); } var ur_remote_text = new UploadResult { LocalFilePath = Info.LocalFilePath, Host = textUploaderType.GetDescription(), URL = url }; AddUploadResult(ur_remote_text); Errors = textUploader.Errors; } }