public static TerminalParam CreateFromConfigNode(ConfigNode sec) { string type = sec["type"]; TerminalParam param; if(type=="serial") param = new SerialTerminalParam(); else if(type=="tcp") { ConnectionMethod cm = ParseMethod(sec["method"]); if(cm==ConnectionMethod.Telnet) param = new TelnetTerminalParam(); else param = new SSHTerminalParam(); } else if(type=="cygwin") param = new CygwinTerminalParam(); else if(type=="sfu") param = new SFUTerminalParam(); else throw new Exception("invalid format"); param.Import(sec); return param; }
internal TelnetTerminalParam(TelnetTerminalParam r) : base(r) { }
//���͓�e�Ɍ�肪��������x������null��Ԃ��B�Ȃ���ΕK�v�ȂƂ���߂�TCPTerminalParam��Ԃ� private TCPTerminalParam ValidateContent() { string msg = null; TCPTerminalParam p = null; SSHTerminalParam sp = null; try { ConnectionMethod m = ParseMethod(_methodBox.Text); if(m==ConnectionMethod.Telnet) p = new TelnetTerminalParam(""); else { p = sp = new SSHTerminalParam(ConnectionMethod.SSH2, "", "", ""); sp.Method = m; sp.Account = _userNameBox.Text; } p.Host = _hostBox.Text; try { p.Port = ParsePort(_portBox.Text); } catch(FormatException ex) { msg = ex.Message; } if(_hostBox.Text.Length==0) msg = GApp.Strings.GetString("Message.LoginDialog.HostIsEmpty"); p.LogType = (LogType)EnumDescAttributeT.For(typeof(LogType)).FromDescription(_logTypeBox.Text, LogType.None); if(p.LogType!=LogType.None) { p.LogPath = _logFileBox.Text; if(p.LogPath==GUtil.CreateLogFileName(null)) p.LogPath = GUtil.CreateLogFileName(_hostBox.Text); LogFileCheckResult r = GCUtil.CheckLogFileName(p.LogPath, this); if(r==LogFileCheckResult.Cancel || r==LogFileCheckResult.Error) return null; p.LogAppend = (r==LogFileCheckResult.Append); } if(p.IsSSH) { Debug.Assert(sp!=null); sp.AuthType = (AuthType)_authOptions.SelectedIndex; if(sp.AuthType==AuthType.PublicKey) { if(!File.Exists(_privateKeyFile.Text)) msg = GApp.Strings.GetString("Message.LoginDialog.KeyFileNotExist"); else sp.IdentityFile = _privateKeyFile.Text; } } p.EncodingProfile = EncodingProfile.Get((EncodingType)_encodingBox.SelectedIndex); p.LocalEcho = _localEchoBox.SelectedIndex==1; p.TransmitNL = (NewLine)EnumDescAttributeT.For(typeof(NewLine)).FromDescription(_newLineBox.Text, NewLine.CR); p.TerminalType = (TerminalType)_terminalTypeBox.SelectedIndex; if(msg!=null) { ShowError(msg); return null; } else return p; } catch(Exception ex) { GUtil.Warning(this, ex.Message); return null; } }
public TelnetConnector(TelnetTerminalParam param, Size size) { _param = param; _size = size; }