Esempio n. 1
0
 public virtual void CleanupErrorStatus()
 {
     if (_connection != null && _connection.IsOpen)
     {
         _connection.Close();
     }
 }
Esempio n. 2
0
        //profに対応したSSHConnectionを返す。接続がなければparentを親に認証ダイアログを出して認証する
        public ISSHConnection GetOrCreateConnection(ChannelProfile prof, Form parent)
        {
            //ホスト名とアカウントのペアからコネクションを共有する仕組みがあるとよいかも
            ISSHConnection c = _profileToConnection[prof] as ISSHConnection;

            if (c != null)
            {
                return(c);
            }

            SSHShortcutLoginDialog dlg = new SSHShortcutLoginDialog(prof);

            if (dlg.ShowDialog(parent) == DialogResult.OK)
            {
                c = dlg.Result.Connection;
                try {
                    dlg.Result.WaitRequest();
                }
                catch (Exception ex) {
                    Debug.WriteLine(ex.StackTrace);
                    Util.Warning(parent, ex.Message);
                    c.Close();
                    return(null);
                }
                _profileToConnection[prof] = c;
                Env.MainForm.RefreshProfileStatus(prof);
            }

            return(c);
        }