public SFTP(FTPAccount account) { this.FTPAccount = account; if (FTPAccount.UserName.Contains("@")) { FTPAccount.UserName = FTPAccount.UserName.Substring(0, FTPAccount.UserName.IndexOf('@')); } if (!string.IsNullOrEmpty(FTPAccount.Password) && (string.IsNullOrEmpty(FTPAccount.Keypath))) { client = new SftpClient(FTPAccount.Host, FTPAccount.Port, FTPAccount.UserName, FTPAccount.Password); } else if (string.IsNullOrEmpty(FTPAccount.Password) && (File.Exists(FTPAccount.Keypath)) && (string.IsNullOrEmpty(FTPAccount.Passphrase))) { client = new SftpClient(FTPAccount.Host, FTPAccount.Port, FTPAccount.UserName, new PrivateKeyFile(FTPAccount.Keypath)); } else if (string.IsNullOrEmpty(FTPAccount.Password) && (File.Exists(FTPAccount.Keypath)) && (!string.IsNullOrEmpty(FTPAccount.Passphrase))) { client = new SftpClient(FTPAccount.Host, FTPAccount.Port, FTPAccount.UserName, new PrivateKeyFile(FTPAccount.Keypath, FTPAccount.Passphrase)); } else { //Need to do something here... DebugHelper.WriteLine("Can't instantiate a SFTP client..."); IsInstantiated = false; return; } IsInstantiated = true; }
public void UploadData(Stream stream, string fileName) { Connect(); progress = new ProgressManager(stream.Length); ChangeDirectory(FTPAccount.GetSubFolderPath()); object s = new object(); AsyncCallback ac = new AsyncCallback(CallBack); var result = client.BeginUploadFile(stream, Path.GetFileName(fileName), ac, s); SftpUploadAsyncResult sftpresult = result as SftpUploadAsyncResult; while (!sftpresult.IsCompleted) { if (sftpresult.UploadedBytes > 0) { OnTransferProgressChanged(sftpresult); } Thread.Sleep(500); } Disconnect(); }
public static void OpenFTPClient() { if (Program.UploadersConfig != null && Program.UploadersConfig.FTPAccountList.IsValidIndex(Program.UploadersConfig.FTPSelectedImage)) { FTPAccount account = Program.UploadersConfig.FTPAccountList[Program.UploadersConfig.FTPSelectedImage]; new FTPClientForm(account).Show(); } }
public static FTPAccount GetFtpAcctActive() { FTPAccount acc = null; if (CheckFTPAccounts()) { acc = Engine.conf.FTPAccountList[Engine.conf.FtpImages]; } return(acc); }
private FTPAccount GetSelectedFTPforImages() { FTPAccount acc = null; if (Adapter.CheckFTPAccounts(Engine.ConfigUploaders.FTPSelectedImage)) { acc = Engine.ConfigUploaders.FTPAccountList2[Engine.ConfigUploaders.FTPSelectedImage]; } return(acc); }
public FTP(FTPAccount account) { Account = account; client = new FtpClient() { Host = Account.Host, Port = Account.Port, Credentials = new NetworkCredential(Account.Username, Account.Password) }; if (account.IsActive) { client.DataConnectionType = FtpDataConnectionType.AutoActive; } else { client.DataConnectionType = FtpDataConnectionType.AutoPassive; } if (account.Protocol == FTPProtocol.FTPS) { switch (Account.FTPSEncryption) { default: case FTPSEncryption.Explicit: client.EncryptionMode = FtpEncryptionMode.Explicit; break; case FTPSEncryption.Implicit: client.EncryptionMode = FtpEncryptionMode.Implicit; break; } client.SslProtocols = SslProtocols.Tls | SslProtocols.Tls11 | SslProtocols.Tls12; client.DataConnectionEncryption = true; if (!string.IsNullOrEmpty(account.FTPSCertificateLocation) && File.Exists(account.FTPSCertificateLocation)) { X509Certificate cert = X509Certificate2.CreateFromSignedFile(Account.FTPSCertificateLocation); client.ClientCertificates.Add(cert); } else { client.ValidateCertificate += (control, e) => { if (e.PolicyErrors != SslPolicyErrors.None) { e.Accept = true; } }; } } }
public void TestFTPAccountAsync(FTPAccount acc) { if (acc != null) { mZScreen.ucFTPAccounts.btnTest.Enabled = false; BackgroundWorker bw = new BackgroundWorker(); bw.DoWork += new DoWorkEventHandler(bw_DoWorkTestFTPAccount); bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompletedTestFTPAccount); bw.RunWorkerAsync(acc); } }
public static void TestFTPAccount(FTPAccount account, bool silent) { string msg; string sfp = account.GetSubFolderPath(); using (FTP ftpClient = new FTP(account)) { try { DateTime time = DateTime.Now; ftpClient.Test(sfp); msg = "Success!"; } catch (Exception e) { if (e.Message.StartsWith("Could not change working directory to")) { try { ftpClient.MakeMultiDirectory(sfp); ftpClient.Test(sfp); msg = "Success!\nAuto created folders: " + sfp; } catch (Exception e2) { msg = e2.Message; } } else { msg = e.Message; } } } if (!string.IsNullOrEmpty(msg)) { string ping = SendPing(account.Host, 3); if (!string.IsNullOrEmpty(ping)) { msg += "\n\nPing results:\n" + ping; } if (silent) { FileSystem.AppendDebug(string.Format("Tested {0} sub-folder path in {1}", sfp, account.ToString())); } else { MessageBox.Show(msg, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); } } }
public FTP(FTPAccount account) { Account = account; client = new FtpClient() { Host = Account.Host, Port = Account.Port, Credentials = new NetworkCredential(Account.Username, Account.Password) }; if (account.IsActive) { client.DataConnectionType = FtpDataConnectionType.AutoActive; } else { client.DataConnectionType = FtpDataConnectionType.AutoPassive; } if (account.Protocol == FTPProtocol.FTPS) { switch (Account.FTPSEncryption) { default: case FTPSEncryption.Explicit: client.EncryptionMode = FtpEncryptionMode.Explicit; break; case FTPSEncryption.Implicit: client.EncryptionMode = FtpEncryptionMode.Implicit; break; } client.DataConnectionEncryption = true; if (!string.IsNullOrEmpty(account.FTPSCertificateLocation) && File.Exists(account.FTPSCertificateLocation)) { X509Certificate cert = X509Certificate2.CreateFromSignedFile(Account.FTPSCertificateLocation); client.ClientCertificates.Add(cert); } else { client.ValidateCertificate += (FtpClient control, FtpSslValidationEventArgs e) => { if (e.PolicyErrors != SslPolicyErrors.None) { e.Accept = true; } }; } } }
public override GenericUploader CreateUploader(UploadersConfig config, TaskReferenceHelper taskInfo) { int index; if (taskInfo.OverrideFTP) { index = taskInfo.FTPIndex.BetweenOrDefault(0, config.FTPAccountList.Count - 1); } else { switch (taskInfo.DataType) { case EDataType.Image: index = config.FTPSelectedImage; break; case EDataType.Text: index = config.FTPSelectedText; break; default: case EDataType.File: index = config.FTPSelectedFile; break; } } FTPAccount account = config.FTPAccountList.ReturnIfValidIndex(index); if (account != null) { if (account.Protocol == FTPProtocol.FTP || account.Protocol == FTPProtocol.FTPS) { return(new FTP(account)); } else if (account.Protocol == FTPProtocol.SFTP) { return(new SFTP(account)); } } return(null); }
public FTPClient2(FTPAccount account) { InitializeComponent(); lblStatus.Text = string.Empty; lvFTPList.SubItemEndEditing += new SubItemEndEditingEventHandler(lvFTPList_SubItemEndEditing); this.Account = account; FTPAdapter = new FTP(account); FTPAdapter.Client.ClientRequest += new EventHandler <FtpRequestEventArgs>(Client_ClientRequest); FTPAdapter.Client.ServerResponse += new EventHandler <FtpResponseEventArgs>(Client_ServerResponse); FTPAdapter.Client.OpenAsyncCompleted += new EventHandler <OpenAsyncCompletedEventArgs>(Client_OpenAsyncCompleted); pgAccount.SelectedObject = FTPAdapter.Account; this.Text = "FTP Client - " + account.Name; lblConnecting.Text = "Connecting to " + account.FTPAddress; FTPAdapter.Client.OpenAsync(account.UserName, account.Password); }
public void OpenFTPClient() { if (Engine.ConfigUploaders.FTPAccountList2.Count > 0) { FTPAccount acc = Engine.ConfigUploaders.FTPAccountList2[Engine.ConfigUploaders.FTPSelectedImage]; if (acc != null) { if (acc.Protocol == FTPProtocol.SFTP) { MessageBox.Show("Sorry, this doesn't support SFTP.", "Sorry!", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } var ftpClient = new FTPClient2(acc) { Icon = Icon }; ftpClient.Show(); } } }
public static void OpenFTPClient() { if (Program.UploadersConfig != null && Program.UploadersConfig.FTPAccountList != null) { FTPAccount account = Program.UploadersConfig.FTPAccountList.ReturnIfValidIndex(Program.UploadersConfig.FTPSelectedImage); if (account != null) { if (account.Protocol == FTPProtocol.FTP || account.Protocol == FTPProtocol.FTPS) { new FTPClientForm(account).Show(); } else { MessageBox.Show(Resources.TaskHelpers_OpenFTPClient_FTP_client_only_supports_FTP_or_FTPS_, "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Information); } return; } } MessageBox.Show(Resources.TaskHelpers_OpenFTPClient_Unable_to_find_valid_FTP_account_, "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Information); }
private void sBwFetchlist() { if (Engine.ConfigUploaders.FTPAccountList2 != null) { mAcc = Engine.ConfigUploaders.FTPAccountList2[Engine.ConfigUploaders.FTPSelectedImage]; } bwRemoteViewer.ReportProgress((int)RemoteViewerTask.ProgressType.UPDATE_STATUS_BAR_TEXT, string.Format("Fetching files from {0}", mAcc.Name)); if (mAcc != null && !string.IsNullOrEmpty(mAcc.Host)) { FTPOptions fopt = new FTPOptions(); fopt.Account = mAcc; fopt.ProxySettings = Adapter.CheckProxySettings().GetWebProxy; mFTP = new FTPAdapter(fopt); List <string> files = FetchList(); if (files.Count > 0) { sBwViewFile(files[0]); } } }
public static void OpenFTPClient() { if (Program.UploadersConfig != null && Program.UploadersConfig.FTPAccountList != null) { FTPAccount account = Program.UploadersConfig.FTPAccountList.ReturnIfValidIndex(Program.UploadersConfig.FTPSelectedImage); if (account != null) { if (account.Protocol == FTPProtocol.FTP || account.Protocol == FTPProtocol.FTPS) { new FTPClientForm(account).Show(); } else { MessageBox.Show("FTP client only supports FTP or FTPS.", "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Information); } return; } } MessageBox.Show("Unable to find valid FTP account.", "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Information); }
public FTPUploader(FTPAccount account) { FTPAccount = account; }
public UploadResult UploadFile(Stream stream, string fileName) { FileUploader fileUploader = null; FileDestination fileDestination; switch (Info.DataType) { case EDataType.Image: fileDestination = Info.TaskSettings.ImageFileDestination; break; case EDataType.Text: fileDestination = Info.TaskSettings.TextFileDestination; break; default: case EDataType.File: fileDestination = Info.TaskSettings.FileDestination; break; } switch (fileDestination) { case FileDestination.Dropbox: NameParser parser = new NameParser(NameParserType.URL); string uploadPath = parser.Parse(Dropbox.TidyUploadPath(Program.UploadersConfig.DropboxUploadPath)); fileUploader = new Dropbox(Program.UploadersConfig.DropboxOAuthInfo, Program.UploadersConfig.DropboxAccountInfo) { UploadPath = uploadPath, AutoCreateShareableLink = Program.UploadersConfig.DropboxAutoCreateShareableLink, ShareURLType = Program.UploadersConfig.DropboxURLType }; break; case FileDestination.GoogleDrive: fileUploader = new GoogleDrive(Program.UploadersConfig.GoogleDriveOAuth2Info) { IsPublic = Program.UploadersConfig.GoogleDriveIsPublic }; break; case FileDestination.RapidShare: fileUploader = new RapidShare(Program.UploadersConfig.RapidShareUsername, Program.UploadersConfig.RapidSharePassword, Program.UploadersConfig.RapidShareFolderID); break; case FileDestination.SendSpace: fileUploader = new SendSpace(APIKeys.SendSpaceKey); switch (Program.UploadersConfig.SendSpaceAccountType) { case AccountType.Anonymous: SendSpaceManager.PrepareUploadInfo(APIKeys.SendSpaceKey); break; case AccountType.User: SendSpaceManager.PrepareUploadInfo(APIKeys.SendSpaceKey, Program.UploadersConfig.SendSpaceUsername, Program.UploadersConfig.SendSpacePassword); break; } break; case FileDestination.Minus: fileUploader = new Minus(Program.UploadersConfig.MinusConfig, Program.UploadersConfig.MinusOAuth2Info); break; case FileDestination.Box: fileUploader = new Box(Program.UploadersConfig.BoxOAuth2Info) { FolderID = Program.UploadersConfig.BoxSelectedFolder.id, Share = Program.UploadersConfig.BoxShare }; break; case FileDestination.Ge_tt: if (Program.UploadersConfig.IsActive(FileDestination.Ge_tt)) { fileUploader = new Ge_tt(APIKeys.Ge_ttKey) { AccessToken = Program.UploadersConfig.Ge_ttLogin.AccessToken }; } break; case FileDestination.Localhostr: fileUploader = new Hostr(Program.UploadersConfig.LocalhostrEmail, Program.UploadersConfig.LocalhostrPassword) { DirectURL = Program.UploadersConfig.LocalhostrDirectURL }; break; case FileDestination.CustomFileUploader: if (Program.UploadersConfig.CustomUploadersList.IsValidIndex(Program.UploadersConfig.CustomFileUploaderSelected)) { fileUploader = new CustomFileUploader(Program.UploadersConfig.CustomUploadersList[Program.UploadersConfig.CustomFileUploaderSelected]); } break; case FileDestination.FTP: int index = Info.TaskSettings.OverrideFTP ? Info.TaskSettings.FTPIndex.BetweenOrDefault(0, Program.UploadersConfig.FTPAccountList.Count - 1) : Program.UploadersConfig.GetFTPIndex(Info.DataType); FTPAccount account = Program.UploadersConfig.FTPAccountList.ReturnIfValidIndex(index); if (account != null) { if (account.Protocol == FTPProtocol.SFTP) { fileUploader = new SFTP(account); } else { fileUploader = new FTPUploader(account); } } break; case FileDestination.SharedFolder: int idLocalhost = Program.UploadersConfig.GetLocalhostIndex(Info.DataType); if (Program.UploadersConfig.LocalhostAccountList.IsValidIndex(idLocalhost)) { fileUploader = new SharedFolderUploader(Program.UploadersConfig.LocalhostAccountList[idLocalhost]); } break; case FileDestination.Email: using (EmailForm emailForm = new EmailForm(Program.UploadersConfig.EmailRememberLastTo ? Program.UploadersConfig.EmailLastTo : string.Empty, Program.UploadersConfig.EmailDefaultSubject, Program.UploadersConfig.EmailDefaultBody)) { emailForm.Icon = ShareXResources.Icon; if (emailForm.ShowDialog() == DialogResult.OK) { if (Program.UploadersConfig.EmailRememberLastTo) { Program.UploadersConfig.EmailLastTo = emailForm.ToEmail; } fileUploader = new Email { SmtpServer = Program.UploadersConfig.EmailSmtpServer, SmtpPort = Program.UploadersConfig.EmailSmtpPort, FromEmail = Program.UploadersConfig.EmailFrom, Password = Program.UploadersConfig.EmailPassword, ToEmail = emailForm.ToEmail, Subject = emailForm.Subject, Body = emailForm.Body }; } else { IsStopped = true; } } break; case FileDestination.Jira: fileUploader = new Jira(Program.UploadersConfig.JiraHost, Program.UploadersConfig.JiraOAuthInfo, Program.UploadersConfig.JiraIssuePrefix); break; case FileDestination.Mega: fileUploader = new Mega(Program.UploadersConfig.MegaAuthInfos, Program.UploadersConfig.MegaParentNodeId); break; case FileDestination.AmazonS3: fileUploader = new AmazonS3(Program.UploadersConfig.AmazonS3Settings); break; case FileDestination.Pushbullet: fileUploader = new Pushbullet(Program.UploadersConfig.PushbulletSettings); break; } if (fileUploader != null) { PrepareUploader(fileUploader); return(fileUploader.Upload(stream, fileName)); } return(null); }
public SFTP(FTPAccount account) { Account = account; }
public static void TestFTPAccount(FTPAccount account, bool silent) { string msg = string.Empty; string sfp = account.GetSubFolderPath(); bool succ = false; switch (account.Protocol) { case FTPProtocol.SFTP: SFTP sftp = new SFTP(account); if (!sftp.IsInstantiated) { msg = "An SFTP client couldn't be instantiated, not enough information.\nCould be a missing key file."; } else { sftp.Connect(); List <string> createddirs = new List <string>(); if (!sftp.DirectoryExists(sfp)) { createddirs = sftp.CreateMultipleDirectorys(FTPHelpers.GetPaths(sfp)); } if (sftp.IsConnected) { msg = (createddirs.Count == 0) ? "Connected!" : "Conected!\nCreated folders;\n"; for (int x = 0; x <= createddirs.Count - 1; x++) { msg += createddirs[x] + "\n"; } msg += " \n\nPing results:\n " + SendPing(account.Host, 3); sftp.Disconnect(); } } break; default: using (FTP ftpClient = new FTP(account)) { try { succ = ftpClient.Test(sfp); if (succ) { msg = "Success!"; } } catch (Exception e) { if (e.Message.StartsWith("Could not change working directory to")) { try { ftpClient.MakeMultiDirectory(sfp); ftpClient.Test(sfp); msg = "Success!\nAuto created folders: " + sfp; } catch (Exception e2) { msg = e2.Message; } } else { msg = e.Message; } } } if (succ && !string.IsNullOrEmpty(msg)) { string ping = SendPing(account.Host, 3); if (!string.IsNullOrEmpty(ping)) { msg += "\n\nPing results:\n" + ping; } } break; } if (succ && silent) { DebugHelper.WriteLine(string.Format("Tested {0} sub-folder path in {1}", sfp, account.ToString())); } else if (succ) { MessageBox.Show(msg, Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public FTPUploader(FTPAccount account) { Account = account; }
private UploadResult UploadFile(string ssPath) { FileUploader fileUploader = null; switch (Program.Settings.ImageFileUploaderType) { case FileDestination.Dropbox: fileUploader = new Dropbox(Program.UploadersConfig.DropboxOAuth2Info, Program.UploadersConfig.DropboxAccountInfo) { UploadPath = NameParser.Parse(NameParserType.URL, Dropbox.TidyUploadPath(Program.UploadersConfig.DropboxUploadPath)), AutoCreateShareableLink = Program.UploadersConfig.DropboxAutoCreateShareableLink, ShareURLType = Program.UploadersConfig.DropboxURLType }; break; case FileDestination.Copy: fileUploader = new Copy(Program.UploadersConfig.CopyOAuthInfo, Program.UploadersConfig.CopyAccountInfo) { UploadPath = NameParser.Parse(NameParserType.URL, Copy.TidyUploadPath(Program.UploadersConfig.CopyUploadPath)), URLType = Program.UploadersConfig.CopyURLType }; break; case FileDestination.GoogleDrive: fileUploader = new GoogleDrive(Program.UploadersConfig.GoogleDriveOAuth2Info) { IsPublic = Program.UploadersConfig.GoogleDriveIsPublic, FolderID = Program.UploadersConfig.GoogleDriveUseFolder ? Program.UploadersConfig.GoogleDriveFolderID : null }; break; case FileDestination.RapidShare: fileUploader = new RapidShare(Program.UploadersConfig.RapidShareUsername, Program.UploadersConfig.RapidSharePassword, Program.UploadersConfig.RapidShareFolderID); break; case FileDestination.SendSpace: fileUploader = new SendSpace(APIKeys.SendSpaceKey); switch (Program.UploadersConfig.SendSpaceAccountType) { case AccountType.Anonymous: SendSpaceManager.PrepareUploadInfo(APIKeys.SendSpaceKey); break; case AccountType.User: SendSpaceManager.PrepareUploadInfo(APIKeys.SendSpaceKey, Program.UploadersConfig.SendSpaceUsername, Program.UploadersConfig.SendSpacePassword); break; } break; case FileDestination.Minus: fileUploader = new Minus(Program.UploadersConfig.MinusConfig, Program.UploadersConfig.MinusOAuth2Info); break; case FileDestination.Box: fileUploader = new Box(Program.UploadersConfig.BoxOAuth2Info) { FolderID = Program.UploadersConfig.BoxSelectedFolder.id, Share = Program.UploadersConfig.BoxShare }; break; case FileDestination.Gfycat: fileUploader = new GfycatUploader(); break; case FileDestination.Ge_tt: fileUploader = new Ge_tt(APIKeys.Ge_ttKey) { AccessToken = Program.UploadersConfig.Ge_ttLogin.AccessToken }; break; case FileDestination.Localhostr: fileUploader = new Hostr(Program.UploadersConfig.LocalhostrEmail, Program.UploadersConfig.LocalhostrPassword) { DirectURL = Program.UploadersConfig.LocalhostrDirectURL }; break; case FileDestination.CustomFileUploader: if (Program.UploadersConfig.CustomUploadersList.IsValidIndex(Program.UploadersConfig.CustomFileUploaderSelected)) { fileUploader = new CustomFileUploader(Program.UploadersConfig.CustomUploadersList[Program.UploadersConfig.CustomFileUploaderSelected]); } break; case FileDestination.FTP: FTPAccount account = Program.UploadersConfig.FTPAccountList.ReturnIfValidIndex(Program.UploadersConfig.FTPSelectedImage); if (account != null) { if (account.Protocol == FTPProtocol.FTP || account.Protocol == FTPProtocol.FTPS) { fileUploader = new FTP(account); } else if (account.Protocol == FTPProtocol.SFTP) { fileUploader = new SFTP(account); } } break; case FileDestination.SharedFolder: int idLocalhost = Program.UploadersConfig.LocalhostSelectedImages; if (Program.UploadersConfig.LocalhostAccountList.IsValidIndex(idLocalhost)) { fileUploader = new SharedFolderUploader(Program.UploadersConfig.LocalhostAccountList[idLocalhost]); } break; case FileDestination.Email: using (EmailForm emailForm = new EmailForm(Program.UploadersConfig.EmailRememberLastTo ? Program.UploadersConfig.EmailLastTo : string.Empty, Program.UploadersConfig.EmailDefaultSubject, Program.UploadersConfig.EmailDefaultBody)) { emailForm.Icon = ShareXResources.Icon; if (emailForm.ShowDialog() == DialogResult.OK) { if (Program.UploadersConfig.EmailRememberLastTo) { Program.UploadersConfig.EmailLastTo = emailForm.ToEmail; } fileUploader = new Email { SmtpServer = Program.UploadersConfig.EmailSmtpServer, SmtpPort = Program.UploadersConfig.EmailSmtpPort, FromEmail = Program.UploadersConfig.EmailFrom, Password = Program.UploadersConfig.EmailPassword, ToEmail = emailForm.ToEmail, Subject = emailForm.Subject, Body = emailForm.Body }; } } break; case FileDestination.Jira: fileUploader = new Jira(Program.UploadersConfig.JiraHost, Program.UploadersConfig.JiraOAuthInfo, Program.UploadersConfig.JiraIssuePrefix); break; case FileDestination.Mega: fileUploader = new Mega(Program.UploadersConfig.MegaAuthInfos, Program.UploadersConfig.MegaParentNodeId); break; case FileDestination.AmazonS3: fileUploader = new AmazonS3(Program.UploadersConfig.AmazonS3Settings); break; case FileDestination.OwnCloud: fileUploader = new OwnCloud(Program.UploadersConfig.OwnCloudHost, Program.UploadersConfig.OwnCloudUsername, Program.UploadersConfig.OwnCloudPassword) { Path = Program.UploadersConfig.OwnCloudPath, CreateShare = Program.UploadersConfig.OwnCloudCreateShare, DirectLink = Program.UploadersConfig.OwnCloudDirectLink, IgnoreInvalidCert = Program.UploadersConfig.OwnCloudIgnoreInvalidCert }; break; case FileDestination.Pushbullet: fileUploader = new Pushbullet(Program.UploadersConfig.PushbulletSettings); break; case FileDestination.MediaCrush: fileUploader = new MediaCrushUploader() { DirectLink = Program.UploadersConfig.MediaCrushDirectLink }; break; case FileDestination.MediaFire: fileUploader = new MediaFire(APIKeys.MediaFireAppId, APIKeys.MediaFireApiKey, Program.UploadersConfig.MediaFireUsername, Program.UploadersConfig.MediaFirePassword) { UploadPath = NameParser.Parse(NameParserType.URL, Program.UploadersConfig.MediaFirePath), UseLongLink = Program.UploadersConfig.MediaFireUseLongLink }; break; case FileDestination.Pomf: fileUploader = new Pomf(); break; } if (fileUploader != null) { ReportProgress(ProgressType.UPDATE_STATUSBAR_DEBUG, string.Format("Uploading {0}.", Path.GetFileName(ssPath))); return(fileUploader.Upload(ssPath)); } return(null); }