public ITerminalConnection EstablishConnection(IPoderosaMainWindow window, ITerminalParameter destination, ITerminalSettings settings) { ISSHLoginParameter ssh = (ISSHLoginParameter)destination.GetAdapter(typeof(ISSHLoginParameter)); if (ssh.LetUserInputPassword && ssh.AuthenticationType != Granados.AuthenticationType.KeyboardInteractive) //ダイアログで入力を促して接続 { SSHShortcutLoginDialog dlg = new SSHShortcutLoginDialog(window, ssh, settings); if (dlg.ShowDialog(window.AsForm()) == DialogResult.OK) { ITerminalConnection con = dlg.Result; AdjustCaptionAndText(settings, ((ITCPParameter)con.Destination.GetAdapter(typeof(ITCPParameter))).Destination, StartCommandIcon.NewConnection); return(con); } else { return(null); } } else //主にReproduceやマクロ。設定済みのパスワードで接続 { IProtocolService protocolservice = TerminalSessionsPlugin.Instance.ProtocolService; ISynchronizedConnector conn = protocolservice.CreateFormBasedSynchronozedConnector(window); IInterruptable r = protocolservice.AsyncSSHConnect(conn.InterruptableConnectorClient, ssh); AdjustCaptionAndText(settings, ((ITCPParameter)destination.GetAdapter(typeof(ITCPParameter))).Destination, StartCommandIcon.NewConnection); return(conn.WaitConnection(r, TerminalSessionsPlugin.Instance.TerminalSessionOptions.TerminalEstablishTimeout)); //時間? } }
public static string FormatItemDescription(MRUItem item) { ITerminalParameter param = item.TerminalParameter; string suffix = ""; ICygwinParameter cygwin = (ICygwinParameter)param.GetAdapter(typeof(ICygwinParameter)); if (cygwin != null) { suffix = "- Cygwin"; } ISSHLoginParameter ssh = (ISSHLoginParameter)param.GetAdapter(typeof(ISSHLoginParameter)); ITCPParameter tcp = (ITCPParameter)param.GetAdapter(typeof(ITCPParameter)); if (ssh != null) { suffix = String.Format("- {0}", ssh.Method.ToString()); } else if (tcp != null) { suffix = "- Telnet"; } return(String.Format("{0} {1}", item.TerminalSettings.Caption, suffix)); }
private void OnHostIsSelected(object sender, System.EventArgs e) { if (_initializing || _loginDialogUISupport == null) { return; } ITerminalParameter parameter = null; ITerminalSettings settings = null; _loginDialogUISupport.FillCorrespondingDestination(typeof(ITCPParameter), _hostBox.Text, out parameter, out settings); if (parameter != null && settings != null) //原理的には片方のみの適用もあるが { ISSHLoginParameter ssh = (ISSHLoginParameter)parameter.GetAdapter(typeof(ISSHLoginParameter)); ITCPParameter tcp = (ITCPParameter)parameter.GetAdapter(typeof(ITCPParameter)); if (ssh != null) { ssh.PasswordOrPassphrase = ""; if (TerminalSessionsPlugin.Instance.ProtocolService.ProtocolOptions.RetainsPassphrase) { ssh.PasswordOrPassphrase = TerminalSessionsPlugin.Instance.ProtocolService.PassphraseCache.GetOrEmpty(tcp.Destination, ssh.Account); } } ApplyParam(parameter, settings); } }
public bool IsSupporting(ITerminalParameter param, ITerminalSettings settings) { ITCPParameter tcp = (ITCPParameter)param.GetAdapter(typeof(ITCPParameter)); ISSHLoginParameter ssh = (ISSHLoginParameter)param.GetAdapter(typeof(ISSHLoginParameter)); return(tcp != null && ssh == null); //SSHならSSHを使う。 }
public void ApplyLoginDialogInfo(ITelnetSSHLoginDialogInitializeInfo info) { foreach (MRUItem item in _data) { ITerminalParameter tp = item.TerminalParameter; ITCPParameter tcp = (ITCPParameter)tp.GetAdapter(typeof(ITCPParameter)); ISSHLoginParameter ssh = (ISSHLoginParameter)tp.GetAdapter(typeof(ISSHLoginParameter)); ICygwinParameter cygwin = (ICygwinParameter)tp.GetAdapter(typeof(ICygwinParameter)); if (tcp != null) { info.AddHost(tcp.Destination); } if (tcp != null) { info.AddPort(tcp.Port); } if (ssh != null) { info.AddIdentityFile(ssh.IdentityFileName); } if (ssh != null) { info.AddAccount(ssh.Account); } } }
//EXTP使用 public void ApplyParam() { ICygwinParameter parameter = null; ITerminalSettings settings = null; if (_loginDialogUISupport != null) { ITerminalParameter tp = null; _loginDialogUISupport.FillTopDestination(typeof(ICygwinParameter), out tp, out settings); parameter = tp == null ? null : (ICygwinParameter)tp.GetAdapter(typeof(ICygwinParameter)); } if (parameter == null) { parameter = TerminalSessionsPlugin.Instance.ProtocolService.CreateDefaultCygwinParameter(); } if (settings == null) { settings = CygwinPlugin.Instance.CreateDefaultCygwinTerminalSettings(); } IAutoExecMacroParameter autoExecParams = parameter.GetAdapter(typeof(IAutoExecMacroParameter)) as IAutoExecMacroParameter; if (autoExecParams != null && CygwinPlugin.Instance.MacroEngine != null) { _autoExecMacroPathBox.Text = (autoExecParams.AutoExecMacroPath != null) ? autoExecParams.AutoExecMacroPath : String.Empty; } else { _autoExecMacroPathLabel.Enabled = false; _autoExecMacroPathBox.Enabled = false; _selectAutoExecMacroButton.Enabled = false; } ApplyParam(parameter, settings); }
public ITerminalConnection EstablishConnection(IPoderosaMainWindow window, ITerminalParameter destination, ITerminalSettings settings) { ITCPParameter tcp = (ITCPParameter)destination.GetAdapter(typeof(ITCPParameter)); IProtocolService ps = TerminalSessionsPlugin.Instance.ProtocolService; ISynchronizedConnector sc = ps.CreateFormBasedSynchronozedConnector(window); IInterruptable t = ps.AsyncTelnetConnect(sc.InterruptableConnectorClient, tcp); ITerminalConnection con = sc.WaitConnection(t, TerminalSessionsPlugin.Instance.TerminalSessionOptions.TerminalEstablishTimeout); AdjustCaptionAndText(settings, tcp.Destination, StartCommandIcon.NewConnection); return(con); }
protected override void StartConnection() { ISSHLoginParameter ssh = (ISSHLoginParameter)_param.GetAdapter(typeof(ISSHLoginParameter)); ITCPParameter tcp = (ITCPParameter)_param.GetAdapter(typeof(ITCPParameter)); IProtocolService protocolservice = TerminalSessionsPlugin.Instance.ProtocolService; if (ssh != null) { _connector = protocolservice.AsyncSSHConnect(this, ssh); } else { _connector = protocolservice.AsyncTelnetConnect(this, tcp); } if (_connector == null) { ClearConnectingState(); } }
public void BeforeAsyncConnect(ITerminalParameter tp) { ISSHLoginParameter ssh = (ISSHLoginParameter)tp.GetAdapter(typeof(ISSHLoginParameter)); if (ssh == null) { return; //SSH以外は興味なし } if (ssh.Method == SSHProtocol.SSH2 && _originalOptions.EnableKeyAgent) { ssh.AgentForward = this; //自分をハンドルするように設定 } }
public void BeforeAsyncConnect(ITerminalParameter tp) { ISSHLoginParameter ssh = (ISSHLoginParameter)tp.GetAdapter(typeof(ISSHLoginParameter)); if (ssh == null) { return; //SSH以外は興味なし } if (ssh.Method == SSHProtocol.SSH2 && ssh.EnableAgentForwarding) { ssh.AgentForwardingAuthKeyProvider = this; //自分をハンドルするように設定 } }
private CommandResult Reproduce(ITerminalSession ts) { //TODO SSH2では同一コネクションでもう一本張るショートカット、シリアルでは複製できないことを通知するショートカットがあるが... ITerminalParameter param = (ITerminalParameter)ts.TerminalTransmission.Connection.Destination.Clone(); ISSHLoginParameter ssh = (ISSHLoginParameter)param.GetAdapter(typeof(ISSHLoginParameter)); if (ssh != null) { ssh.LetUserInputPassword = false; } ITerminalSettings settings = ts.TerminalSettings.Clone(); ITerminalSession session = TerminalSessionsPlugin.Instance.TerminalSessionStartCommand.StartTerminalSession(ts.OwnerWindow, param, settings); return(session != null ? CommandResult.Succeeded : CommandResult.Failed); }
public IEnumerable <TerminalSessionParameters <T> > FindTerminalParameter <T>() where T : class { return(_data.Select((item) => { ITerminalParameter tp = item.TerminalParameter; T param = tp.GetAdapter(typeof(T)) as T; if (param != null && item.TerminalParameter != null && item.TerminalSettings != null) { return new TerminalSessionParameters <T>(param, item.TerminalParameter, item.TerminalSettings); } else { return null; } }) .Where((item) => { return item != null; })); }
private static bool CheckDestination(ITerminalParameter tp, string destination) { //destinationがnull(FillTop()由来)なら常にOK if (destination == null) { return(true); } ITCPParameter tcp = (ITCPParameter)tp.GetAdapter(typeof(ITCPParameter)); if (tcp == null) { return(false); } else { return(tcp.Destination == destination); } }
private CommandResult ConnectAgain(ITerminalSession ts0) { TerminalSession ts = (TerminalSession)ts0.GetAdapter(typeof(TerminalSession)); ITerminalParameter param = (ITerminalParameter)ts.TerminalTransmission.Connection.Destination.Clone(); ISSHLoginParameter ssh = (ISSHLoginParameter)param.GetAdapter(typeof(ISSHLoginParameter)); if (ssh != null) { ssh.LetUserInputPassword = false; } ITerminalConnection connection = TerminalSessionsPlugin.Instance.TerminalSessionStartCommand.OpenConnection(ts.OwnerWindow, param, ts.TerminalSettings); if (connection == null) { return(CommandResult.Failed); } ts.Revive(connection); //接続を復活 return(CommandResult.Succeeded); }
public void FillCorrespondingDestination(Type adapter, string destination, out ITerminalParameter parameter, out ITerminalSettings settings) { Debug.WriteLineIf(DebugOpt.MRU, "FillCorrespondingDestination"); List <ITerminalParameter> l = new List <ITerminalParameter>(); foreach (MRUItem item in _data) { ITerminalParameter tp = item.TerminalParameter; if (tp.GetAdapter(adapter) != null) { if (CheckDestination(item.TerminalParameter, destination)) //見つかった { parameter = item.TerminalParameter; settings = item.TerminalSettings; return; } } } parameter = null; settings = null; }
public void BeforeAsyncConnect(ITerminalParameter tp) { ISSHLoginParameter ssh = (ISSHLoginParameter)tp.GetAdapter(typeof(ISSHLoginParameter)); if (ssh == null) return; //SSH�ȊO�͋����Ȃ� if (ssh.Method == SSHProtocol.SSH2 && _originalOptions.EnableKeyAgent) { ssh.AgentForward = this; //������n���h������悤�ɐݒ� } }
public override bool UIEquals(ITerminalParameter param) { ISSHLoginParameter ssh = (ISSHLoginParameter)param.GetAdapter(typeof(ISSHLoginParameter)); return ssh != null && base.UIEquals(param) && _account == ssh.Account; //プロトコルが違うだけでは同一視してしまう }
public void BeforeAsyncConnect(ITerminalParameter tp) { ISSHLoginParameter ssh = (ISSHLoginParameter)tp.GetAdapter(typeof(ISSHLoginParameter)); if (ssh == null) return; //SSH以外は興味なし if (ssh.Method == SSHProtocol.SSH2 && _originalOptions.EnableKeyAgent) { ssh.AgentForward = this; //自分をハンドルするように設定 } }
public bool IsSupporting(ITerminalParameter param, ITerminalSettings settings) { ICygwinParameter cygwin = (ICygwinParameter)param.GetAdapter(typeof(ICygwinParameter)); return cygwin != null; }
public override bool UIEquals(ITerminalParameter param) { ITCPParameter tcp = (ITCPParameter)param.GetAdapter(typeof(ITCPParameter)); return tcp != null && _destination == tcp.Destination && _port == tcp.Port; }
public override bool UIEquals(ITerminalParameter param) { ITCPParameter tcp = (ITCPParameter)param.GetAdapter(typeof(ITCPParameter)); return(tcp != null && _destination == tcp.Destination && _port == tcp.Port); }
public override bool UIEquals(ITerminalParameter param) { ISSHLoginParameter ssh = (ISSHLoginParameter)param.GetAdapter(typeof(ISSHLoginParameter)); return(ssh != null && base.UIEquals(param) && _account == ssh.Account); //プロトコルが違うだけでは同一視してしまう }
public ITerminalConnection EstablishConnection(IPoderosaMainWindow window, ITerminalParameter destination, ITerminalSettings settings) { ITCPParameter tcp = (ITCPParameter)destination.GetAdapter(typeof(ITCPParameter)); IProtocolService ps = TerminalSessionsPlugin.Instance.ProtocolService; ISynchronizedConnector sc = ps.CreateFormBasedSynchronozedConnector(window); IInterruptable t = ps.AsyncTelnetConnect(sc.InterruptableConnectorClient, tcp); ITerminalConnection con = sc.WaitConnection(t, TerminalSessionsPlugin.Instance.TerminalSessionOptions.TerminalEstablishTimeout); AdjustCaptionAndText(settings, tcp.Destination, StartCommandIcon.NewConnection); return con; }
public bool IsSupporting(ITerminalParameter param, ITerminalSettings settings) { ITCPParameter tcp = (ITCPParameter)param.GetAdapter(typeof(ITCPParameter)); ISSHLoginParameter ssh = (ISSHLoginParameter)param.GetAdapter(typeof(ISSHLoginParameter)); return tcp != null && ssh == null; //SSHならSSHを使う。 }
public bool IsSupporting(ITerminalParameter destination, ITerminalSettings settings) { ISSHLoginParameter ssh = (ISSHLoginParameter)destination.GetAdapter(typeof(ISSHLoginParameter)); return ssh != null; }
public ITerminalConnection EstablishConnection(IPoderosaMainWindow window, ITerminalParameter destination, ITerminalSettings settings) { ISSHLoginParameter ssh = (ISSHLoginParameter)destination.GetAdapter(typeof(ISSHLoginParameter)); if (ssh.LetUserInputPassword && ssh.AuthenticationType != Granados.AuthenticationType.KeyboardInteractive) { //ダイアログで入力を促して接続 SSHShortcutLoginDialog dlg = new SSHShortcutLoginDialog(window, ssh, settings); if (dlg.ShowDialog(window.AsForm()) == DialogResult.OK) { ITerminalConnection con = dlg.Result; AdjustCaptionAndText(settings, ((ITCPParameter)con.Destination.GetAdapter(typeof(ITCPParameter))).Destination, StartCommandIcon.NewConnection); return con; } else return null; } else { //主にReproduceやマクロ。設定済みのパスワードで接続 IProtocolService protocolservice = TerminalSessionsPlugin.Instance.ProtocolService; ISynchronizedConnector conn = protocolservice.CreateFormBasedSynchronozedConnector(window); IInterruptable r = protocolservice.AsyncSSHConnect(conn.InterruptableConnectorClient, ssh); AdjustCaptionAndText(settings, ((ITCPParameter)destination.GetAdapter(typeof(ITCPParameter))).Destination, StartCommandIcon.NewConnection); return conn.WaitConnection(r, TerminalSessionsPlugin.Instance.TerminalSessionOptions.TerminalEstablishTimeout); //時間? } }
public bool IsSupporting(ITerminalParameter param, ITerminalSettings settings) { ICygwinParameter cygwin = (ICygwinParameter)param.GetAdapter(typeof(ICygwinParameter)); return(cygwin != null); }
public void BeforeAsyncConnect(ITerminalParameter tp) { ISSHLoginParameter ssh = (ISSHLoginParameter)tp.GetAdapter(typeof(ISSHLoginParameter)); if (ssh == null) return; //SSH以外は興味なし if (ssh.Method == SSHProtocol.SSH2 && ssh.EnableAgentForwarding) { ssh.AgentForwardingAuthKeyProvider = this; //自分をハンドルするように設定 } }
public bool IsSupporting(ITerminalParameter destination, ITerminalSettings settings) { ISSHLoginParameter ssh = (ISSHLoginParameter)destination.GetAdapter(typeof(ISSHLoginParameter)); return(ssh != null); }
public override bool UIEquals(ITerminalParameter param) { ISSHLoginParameter ssh = (ISSHLoginParameter)param.GetAdapter(typeof(ISSHLoginParameter)); return ssh != null && base.UIEquals(param) && _account == ssh.Account; //�v���g�R�����Ⴄ�����ł͓��ꎋ���Ă��܂� }
private static bool CheckDestination(ITerminalParameter tp, string destination) { //destinationがnull(FillTop()由来)なら常にOK if (destination == null) return true; ITCPParameter tcp = (ITCPParameter)tp.GetAdapter(typeof(ITCPParameter)); if (tcp == null) return false; else return tcp.Destination == destination; }