private void btnOutputsConfig_Click(object sender, EventArgs e)
 {
     UploadersConfigForm ocf = new UploadersConfigForm(Engine.ConfigUploaders, Engine.ConfigUI.ApiKeysConfig) { Icon = this.Icon };
     ocf.ShowDialog();
     Engine.ConfigUploaders = ocf.Config;
 }
Exemple #2
0
 private void btnUploadersConfig_Click(object sender, EventArgs e)
 {
     UploadersConfigForm form = new UploadersConfigForm(Program.UploadersConfig);
     form.Show();
 }
        private void UploadFile(FileDestination fileUploaderType, Stream data)
        {
            FileUploader fileUploader = null;

            switch (fileUploaderType)
            {
                case FileDestination.FTP:
                    if (Engine.ConfigUI.ShowFTPSettingsBeforeUploading)
                    {
                        var ucf = new UploadersConfigForm(Engine.ConfigUploaders, Engine.ConfigUI.ApiKeysConfig);
                        ucf.Icon = Resources.zss_main;
                        ucf.tcUploaders.SelectedTab = ucf.tpFileUploaders;
                        ucf.tcFileUploaders.SelectedTab = ucf.tpFTP;
                        ucf.ShowDialog();
                    }
                    switch (Job1)
                    {
                        case EDataType.Text:
                            UploadToFTP(Engine.ConfigUploaders.FTPSelectedText, data);
                            break;
                        case EDataType.Image:
                            UploadToFTP(Engine.ConfigUploaders.FTPSelectedImage, data);
                            break;
                        default:
                        case EDataType.File:
                            UploadToFTP(Engine.ConfigUploaders.FTPSelectedFile, data);
                            break;
                    }
                    break;
                case FileDestination.Minus:
                    fileUploader = new Minus(Engine.ConfigUploaders.MinusConfig, new OAuthInfo(Engine.ConfigUI.ApiKeysConfig.MinusConsumerKey, Engine.ConfigUI.ApiKeysConfig.MinusConsumerSecret));
                    break;
                case FileDestination.Dropbox:
                    string uploadPath = new NameParser { IsFolderPath = true }.Convert(Dropbox.TidyUploadPath(Engine.ConfigUploaders.DropboxUploadPath));
                    fileUploader = new Dropbox(Engine.ConfigUploaders.DropboxOAuthInfo, uploadPath, Engine.ConfigUploaders.DropboxAccountInfo)
                    {
                        AutoCreateShareableLink = Engine.ConfigUploaders.DropboxAutoCreateShareableLink
                    };
                    break;
                case FileDestination.Box:
                    fileUploader = new Box(ZKeys.BoxKey)
                     {
                         AuthToken = Engine.ConfigUploaders.BoxAuthToken,
                         FolderID = Engine.ConfigUploaders.BoxFolderID,
                         Share = Engine.ConfigUploaders.BoxShare
                     };
                    break;
                case FileDestination.SendSpace:
                    fileUploader = new SendSpace(Engine.ConfigUI.ApiKeysConfig.SendSpaceKey);
                    switch (Engine.ConfigUploaders.SendSpaceAccountType)
                    {
                        case AccountType.Anonymous:
                            SendSpaceManager.PrepareUploadInfo(Engine.ConfigUI.ApiKeysConfig.SendSpaceKey);
                            break;
                        case AccountType.User:
                            SendSpaceManager.PrepareUploadInfo(Engine.ConfigUI.ApiKeysConfig.SendSpaceKey, Engine.ConfigUploaders.SendSpaceUsername, Engine.ConfigUploaders.SendSpacePassword);
                            break;
                    }
                    break;
                case FileDestination.RapidShare:
                    fileUploader = new RapidShare(Engine.ConfigUploaders.RapidShareUsername, Engine.ConfigUploaders.RapidSharePassword,
                        Engine.ConfigUploaders.RapidShareFolderID);
                    break;
                case FileDestination.CustomUploader:
                    fileUploader = new CustomUploader(Engine.ConfigUploaders.CustomUploadersList[Engine.ConfigUploaders.CustomUploaderSelected]);
                    break;
            }

            if (fileUploader != null)
            {
                MyWorker.ReportProgress((int)ProgressType.UpdateProgressMax, TaskbarProgressBarState.Indeterminate);
                DestinationName = fileUploaderType.GetDescription();
                DebugHelper.WriteLine("Initialized " + DestinationName);
                fileUploader.ProgressChanged += UploadProgressChanged;
                UploadResult ur_remote_file = fileUploader.Upload(data, Info.FileName);
                if (ur_remote_file != null)
                {
                    ur_remote_file.Host = fileUploaderType.GetDescription();
                    ur_remote_file.LocalFilePath = Info.LocalFilePath;
                    AddUploadResult(ur_remote_file);
                }
                Errors = fileUploader.Errors;
            }
        }
 public void tsbDestConfig_Click(object sender, System.EventArgs e)
 {
     UploadersConfigForm form = new UploadersConfigForm(Engine.ConfigUploaders, Engine.ConfigUI.ApiKeysConfig);
     form.Icon = Resources.zss_main;
     if (form.ShowDialog() == DialogResult.OK)
     {
         ReconfigOutputsUI();
     }
 }
        private void tsddbUploadersConfig_Click(object sender, EventArgs e)
        {
            if (Program.UploadersConfig == null)
            {
                Program.UploaderSettingsResetEvent.WaitOne();
            }

            UploadersConfigForm uploadersConfigForm = new UploadersConfigForm(Program.UploadersConfig, new UploadersAPIKeys()) { Icon = this.Icon };
            uploadersConfigForm.ShowDialog();
            uploadersConfigForm.Config.SaveAsync(Program.UploadersConfigFilePath);
        }