public void InitUI() { tb_host.Text = config.Host; tb_name.Text = config.Name; tb_password.Text = YSEncrypt.DecryptB(config.Password, KeysUtil.PassKey); tb_userName.Text = config.UserName; cb_protocol.SelectedItem = config.Protocol; cb_method.SelectedItem = config.Method; cb_scheme.SelectedItem = config.Theme.ColorScheme; cb_fontName.SelectedItem = config.Theme.FontName; cb_fontSize.SelectedItem = config.Theme.FontSize; cb_remenber_pwd.Checked = config.RemenberPwd; }
public void Connect() { shell = new SshShell(user.Host, user.UserName, YSEncrypt.DecryptB(user.Password, KeysUtil.PassKey)); shell.Connect(user.Port); m_Channel = shell.getChannel(); session = shell.getSession(); sftpChannel = (ChannelSftp)session.openChannel("sftp"); sftpChannel.connect(); ThreadPool.QueueUserWorkItem((a) => { string line = null; while (RUN_CUT && shell.ShellOpened) { success = true; logger.Debug("Successed..."); sftpForm.HideTool(); System.Threading.Thread.Sleep(100); while ((line = m_Channel.GetMessage()) != null) { Console.WriteLine(line); } } logger.Debug("Disconnecting..."); Disconnection(); logger.Debug("OK"); }); dir = sftpChannel.getHome(); text_adress.Text = dir; LoadDirFilesToListView(dir); SetContentMenuItem(true); }