public FTPClientForm(FTPAccount account) { InitializeComponent(); lblStatus.Text = string.Empty; lvFTPList.SubItemEndEditing += lvFTPList_SubItemEndEditing; FtpTrace.AddListener(new TextBoxTraceListener(txtDebug)); Account = account; Client = new FTP(account); pgAccount.SelectedObject = Client.Account; Text = Resources.FTPClientForm_FTPClientForm_ShareXYZ_FTP_client + " - " + account.Name; lblConnecting.Text = string.Format(Resources.FTPClientForm_FTPClientForm_Connecting_to__0_, account.FTPAddress); TaskEx.Run(() => { Client.Connect(); }, () => { pConnecting.Visible = false; Refresh(); RefreshDirectory(); }); }
public FTPClientForm(FTPAccount account) { InitializeComponent(); lblStatus.Text = string.Empty; lvFTPList.SubItemEndEditing += lvFTPList_SubItemEndEditing; FtpTrace.AddListener(new TextBoxTraceListener(txtDebug)); Account = account; Client = new FTP(account); pgAccount.SelectedObject = Client.Account; Text = Resources.FTPClientForm_FTPClientForm_ShareXYZ_FTP_client + " - " + account.Name; lblConnecting.Text = string.Format(Resources.FTPClientForm_FTPClientForm_Connecting_to__0_, account.FTPAddress); TaskEx.Run(() => { Client.Connect(); }, () => { pConnecting.Visible = false; Refresh(); RefreshDirectory(); }); }
private string GetURL(FtpListItem file) { if (file != null && file.Type == FtpFileSystemObjectType.File) { FTPAccount accountClone = Account.Clone(); accountClone.SubFolderPath = currentDirectory; accountClone.HttpHomePathAutoAddSubFolderPath = true; return(accountClone.GetUriPath(file.Name)); } return(null); }
public FTPOptions(FTPAccount acc, IWebProxy proxy) { Account = acc; ProxySettings = proxy; }
public FTPOptions(FTPAccount acc, IWebProxy proxy) { Account = acc; ProxySettings = proxy; }
public static void TestFTPAccount(FTPAccount account) { string msg = string.Empty; string remotePath = account.GetSubFolderPath(); List<string> directories = new List<string>(); try { if (account.Protocol == FTPProtocol.FTP || account.Protocol == FTPProtocol.FTPS) { using (FTP ftp = new FTP(account)) { if (ftp.Connect()) { if (!ftp.DirectoryExists(remotePath)) { directories = ftp.CreateMultiDirectory(remotePath); } if (ftp.IsConnected) { if (directories.Count > 0) { msg = Resources.UploadersConfigForm_TestFTPAccount_Connected_Created_folders + "\r\n" + string.Join("\r\n", directories); } else { msg = Resources.UploadersConfigForm_TestFTPAccount_Connected_; } } } } } else if (account.Protocol == FTPProtocol.SFTP) { using (SFTP sftp = new SFTP(account)) { if (sftp.Connect()) { if (!sftp.DirectoryExists(remotePath)) { directories = sftp.CreateMultiDirectory(remotePath); } if (sftp.IsConnected) { if (directories.Count > 0) { msg = Resources.UploadersConfigForm_TestFTPAccount_Connected_Created_folders + "\r\n" + string.Join("\r\n", directories); } else { msg = Resources.UploadersConfigForm_TestFTPAccount_Connected_; } } } } } } catch (Exception e) { msg = e.Message; } MessageBox.Show(msg, "ShareXYZ", MessageBoxButtons.OK, MessageBoxIcon.Information); }
public void TestFTPAccountAsync(FTPAccount acc) { if (acc != null) { ucFTPAccounts.btnTest.Enabled = false; TaskEx.Run(() => { TestFTPAccount(acc); }, () => { ucFTPAccounts.btnTest.Enabled = true; }); } }
public void AddFTPAccount(FTPAccount account) { if (account != null) { Config.FTPAccountList.Add(account); ucFTPAccounts.AddItem(account); FTPSetup(Config.FTPAccountList); } }