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); }
public static TextUploader GetTextUploaderActive() { TextUploader uploader = null; if (CheckTextUploaders()) { uploader = Engine.conf.TextUploadersList[Engine.conf.TextUploaderSelected]; } return(uploader); }
/// <summary> /// Method to shorten a URL /// </summary> /// <param name="url"></param> /// <returns></returns> public static string ShortenURL(string url) { if (!string.IsNullOrEmpty(url)) { TextUploader tu = Engine.conf.UrlShortenersList[Engine.conf.UrlShortenerSelected]; if (tu != null) { string temp = tu.UploadText(TextInfo.FromString(url)); if (!string.IsNullOrEmpty(temp)) { url = temp; } } } return(url); }
public UploadResult UploadText(Stream stream, string fileName) { TextUploader textUploader = null; switch (Info.TaskSettings.TextDestination) { case TextDestination.Pastebin: PastebinSettings settings = Program.UploadersConfig.PastebinSettings; if (string.IsNullOrEmpty(settings.TextFormat)) { settings.TextFormat = Info.TaskSettings.AdvancedSettings.TextFormat; } textUploader = new Pastebin(APIKeys.PastebinKey, settings); break; case TextDestination.PastebinCA: textUploader = new Pastebin_ca(APIKeys.PastebinCaKey, new PastebinCaSettings { TextFormat = Info.TaskSettings.AdvancedSettings.TextFormat }); break; case TextDestination.Paste2: textUploader = new Paste2(new Paste2Settings { TextFormat = Info.TaskSettings.AdvancedSettings.TextFormat }); break; case TextDestination.Slexy: textUploader = new Slexy(new SlexySettings { TextFormat = Info.TaskSettings.AdvancedSettings.TextFormat }); break; case TextDestination.Pastee: textUploader = new Pastee { Lexer = Info.TaskSettings.AdvancedSettings.TextFormat }; break; case TextDestination.Paste_ee: textUploader = new Paste_ee(Program.UploadersConfig.Paste_eeUserAPIKey); break; case TextDestination.Gist: textUploader = Program.UploadersConfig.GistAnonymousLogin ? new Gist(Program.UploadersConfig.GistPublishPublic) : new Gist(Program.UploadersConfig.GistPublishPublic, Program.UploadersConfig.GistOAuth2Info); break; case TextDestination.Upaste: textUploader = new Upaste(Program.UploadersConfig.UpasteUserKey) { IsPublic = Program.UploadersConfig.UpasteIsPublic }; break; case TextDestination.CustomTextUploader: if (Program.UploadersConfig.CustomUploadersList.IsValidIndex(Program.UploadersConfig.CustomTextUploaderSelected)) { textUploader = new CustomTextUploader(Program.UploadersConfig.CustomUploadersList[Program.UploadersConfig.CustomTextUploaderSelected]); } break; } if (textUploader != null) { PrepareUploader(textUploader); return(textUploader.UploadText(stream, fileName)); } return(null); }