public override Boolean Connect() { String protocol = "unknown"; try { Logging.Info(String.Format("Connecting to a {0} Connection", Favorite.Protocol)); term = new TerminalEmulator(); Controls.Add(term); term.BringToFront(); this.BringToFront(); term.Parent = this.Parent; term.Dock = System.Windows.Forms.DockStyle.Fill; ConsoleOptions consoleOptions = this.GetConsoleOptionsFromFavorite(); AssignTerminalCollors(consoleOptions); term.Font = FontParser.FromString(consoleOptions.Font); term.Rows = consoleOptions.Rows; term.Columns = consoleOptions.Columns; this.client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); this.client.Connect(Favorite.ServerName, Favorite.Port); ISecurityOptions security = this.Favorite.Security.GetResolvedCredentials(); switch (Favorite.Protocol) { case ConnectionManager.TELNET: { protocol = ConfigureTelnetConnection(security); } break; case ConnectionManager.SSH: { protocol = ConfigureSshConnection(security); } break; } this.term.Focus(); return true; } catch (Exception exc) { Logging.Fatal(String.Format("Connecting to {0} Connection", protocol), exc); LastError = exc.Message; return false; } }
public uc_Keyboard(TerminalEmulator p1) { this.Parent = p1; }
public override Boolean Connect() { this.connected = false; String protocol = "unknown"; try { if (typeof(TerminalConnection).IsEqual(this.Favorite.Protocol)) { protocol = typeof(TerminalConnection).GetProtocolName(); } else { protocol = (this.Favorite.Ssh1) ? "SSH1" : "SSH2"; } this.InvokeIfNecessary(delegate {this.term = new TerminalEmulator();}); this.Embed(this.term); this.term.BackColor = FavoriteConfigurationElement.TranslateColor(this.Favorite.ConsoleBackColor); this.term.ForeColor = FavoriteConfigurationElement.TranslateColor(this.Favorite.ConsoleTextColor); this.term.BlinkColor = this.term.CursorColor = FavoriteConfigurationElement.TranslateColor(this.Favorite.ConsoleCursorColor); if (this.term.InvokeRequired) this.term.Invoke(new MethodInvoker(delegate { this.term.Font = FontParser.FromString(this.Favorite.ConsoleFont); })); else this.term.Font = FontParser.FromString(this.Favorite.ConsoleFont); this.term.Rows = this.Favorite.ConsoleRows; this.term.Columns = this.Favorite.ConsoleCols; this.client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); this.client.Connect(this.Favorite.ServerName, this.Favorite.Port); if (!this.Favorite.Credential.IsSetUserName || !this.Favorite.Credential.IsSetPassword) { Log.Fatal(string.Format("Please set user name and password in your {0} connection properties.", this.Favorite.Protocol.ToLower())); return false; } if (typeof(TerminalConnection).IsEqual(this.Favorite.Protocol)) { this.ConfigureTelnetConnection(this.Favorite.Credential.UserName, this.Favorite.Credential.Password); } else { this.ConfigureSshConnection(this.Favorite.Credential.UserName, this.Favorite.Credential.Password); } if (this.term.InvokeRequired) this.term.Invoke(new MethodInvoker(delegate { this.term.Focus(); })); else this.term.Focus(); return this.connected = true; } catch (Exception exc) { Log.Fatal(string.Format("Terminals was unable to create the {0} connection.", protocol), exc); return this.connected = false; } }
public Reader(object obj) { Terminal = (TerminalEmulator) obj; }