public void ReConnect() { Poderosa.ConnectionParam.LogType logType = Poderosa.ConnectionParam.LogType.Default; if (this._terminalPane.Connection != null) { logType = this._terminalPane.Connection.LogType; this._terminalPane.Connection.Close(); this._terminalPane.Detach(); } Connect(); }
public void Connect() { #region old stuff /* * Poderosa.ConnectionParam.LogType logType = Poderosa.ConnectionParam.LogType.Default; * string file = null; * if (this.TerminalPane.Connection != null) * { * logType = this.TerminalPane.Connection.LogType; * file = this.TerminalPane.Connection.LogPath; * //GApp.GetConnectionCommandTarget().Close(); * this.TerminalPane.Connection.Close(); * this.TerminalPane.Detach(); * } * * * SSHTerminalParam p = new SSHTerminalParam((Poderosa.ConnectionParam.ConnectionMethod)this.Method, this.Host, this.UserName, this.Password); * * GApp.GlobalCommandTarget.SilentNewConnection(p); * * * if (file != null) * this.SetLog((LogType) logType, file, true); */ #endregion // Save old log info in case this is a reconnect Poderosa.ConnectionParam.LogType logType = Poderosa.ConnectionParam.LogType.Default; string file = null; if (this.TerminalPane.Connection != null) { logType = this.TerminalPane.Connection.LogType; file = this.TerminalPane.Connection.LogPath; //GApp.GetConnectionCommandTarget().Close(); this.TerminalPane.Connection.Close(); this.TerminalPane.Detach(); } try { //------------------------------------------------------------------------ SSHTerminalParam sshp = new SSHTerminalParam((Poderosa.ConnectionParam.ConnectionMethod) this.Method, this.Host, this.UserName, this.Password); sshp.AuthType = this.AuthType; sshp.IdentityFile = this.IdentifyFile; sshp.Encoding = EncodingType.ISO8859_1; sshp.Port = 22; sshp.RenderProfile = new RenderProfile(); sshp.TerminalType = TerminalType.XTerm; CommunicationUtil.SilentClient s = new CommunicationUtil.SilentClient(); Size sz = this.Size; SocketWithTimeout swt; swt = new SSHConnector((Poderosa.ConnectionParam.SSHTerminalParam)sshp, sz, sshp.Passphrase, (HostKeyCheckCallback)null); swt.AsyncConnect(s, sshp.Host, sshp.Port); ConnectionTag ct = s.Wait(swt); this.TerminalPane.FakeVisible = true; this.TerminalPane.Attach(ct); ct.Receiver.Listen(); //------------------------------------------------------------- if (file != null) { this.SetLog((LogType)logType, file, true); } this.TerminalPane.ConnectionTag.RenderProfile = new RenderProfile(); this.SetPaneColors(Color.LightBlue, Color.Black); } catch { //MessageBox.Show(e.Message, "Connection Error"); return; } }