public static bool UploadFile(String localPath, String remotePath) { SshConnectionInfo objInfo = new SshConnectionInfo(); objInfo.User = "******"; objInfo.Host = "106.75.3.227"; objInfo.Pass = "******"; //基于密码 SFTPHelper objSFTPHelper = new SFTPHelper(objInfo); return(objSFTPHelper.Upload(localPath, remotePath)); }
public static bool mkDir(String remotePath) { SshConnectionInfo objInfo = new SshConnectionInfo(); objInfo.User = "******"; objInfo.Host = "106.75.3.227"; objInfo.Pass = "******"; //基于密码 SFTPHelper objSFTPHelper = new SFTPHelper(objInfo); return(objSFTPHelper.ftpMkdir(remotePath)); }
public SFTPHelper(SshConnectionInfo connectionInfo) { m_sshCp = new Sftp(connectionInfo.Host, connectionInfo.User); if (connectionInfo.Pass != null) { m_sshCp.Password = connectionInfo.Pass; } if (connectionInfo.IdentityFile != null) { m_sshCp.AddIdentityFile(connectionInfo.IdentityFile); } }