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;
            }
        }
示例#2
0
        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 void PastebinLogin()
        {
            if (Config.PastebinSettings != null)
            {
                try
                {
                    PastebinUploader pastebin = new PastebinUploader(APIKeys.PastebinKey, Config.PastebinSettings);

                    if (pastebin.Login())
                    {
                        pgPastebinSettings.SelectedObject = Config.PastebinSettings;
                        MessageBox.Show("Login successful.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    else
                    {
                        MessageBox.Show("Login failed.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }