Exemplo n.º 1
0
        private void FontButton_Click(object sender, EventArgs e)
        {
            this.fontDialog1.Font = FontParser.FromString(this.FontTextbox.Text);
            DialogResult result = this.fontDialog1.ShowDialog();

            if (result == DialogResult.OK)
            {
                this.FontTextbox.Text = FontParser.ToString(this.fontDialog1.Font);
            }
        }
Exemplo n.º 2
0
        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);

                IGuardedSecurity security = this.ResolveFavoriteCredentials();
                switch (Favorite.Protocol)
                {
                case TelnetConnectionPlugin.TELNET:
                {
                    protocol = ConfigureTelnetConnection(security);
                }
                break;

                case SshConnectionPlugin.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);
            }
        }
Exemplo n.º 3
0
        public FavoritesTreeView()
        {
            // This prevents SharpDevelop and Visual Studio from both an exception in design mode for controls using this HistoryTreeView and from crashing when opening the
            // designer for this class.
            if (LicenseManager.UsageMode == LicenseUsageMode.Runtime)
            {
                this.ImageList          = ConnectionImageHandler.GetProtocolImageList();
                this.ImageIndex         = 0;
                this.LineColor          = Color.Black;
                this.SelectedImageIndex = 0;
                this.ShowNodeToolTips   = true;
                this.AfterExpand       += this.OnTreeViewExpand;

                this.ImageList.ImageSize = new Size(Settings.FavoritesImageWidth, Settings.FavoritesImageHeight);
                this.ImageList           = ConnectionImageHandler.GetProtocolImageList();
                this.ImageList.ImageSize = new Size(Settings.FavoritesImageWidth, Settings.FavoritesImageHeight);
                this.Font      = FontParser.FromString(Settings.FavoritesFont);
                this.BackColor = ColorParser.FromString(Settings.FavoritesFontBackColor);
                this.ForeColor = ColorParser.FromString(Settings.FavoritesFontForeColor);

                this.loader = new TreeListLoader(this);
            }
        }
Exemplo n.º 4
0
        public DBTreeView()
        {
            this.ImageList = new ImageList();

            if (LicenseManager.UsageMode == LicenseUsageMode.Runtime)
            {
                this.ImageList          = ConnectionImageHandler.GetProtocolImageList();
                this.ImageIndex         = 0;
                this.LineColor          = Color.Black;
                this.SelectedImageIndex = 0;
                this.ShowNodeToolTips   = true;
                this.AfterExpand       += this.OnTreeViewExpand;

                this.ImageList.ImageSize = new Size(Settings.FavoritesImageWidth, Settings.FavoritesImageHeight);
                this.ImageList           = ConnectionImageHandler.GetProtocolImageList();
                this.ImageList.ImageSize = new Size(Settings.FavoritesImageWidth, Settings.FavoritesImageHeight);
                this.Font      = FontParser.FromString(Settings.FavoritesFont);
                this.BackColor = ColorParser.FromString(Settings.FavoritesFontBackColor);
                this.ForeColor = ColorParser.FromString(Settings.FavoritesFontForeColor);

                this.loader = new TreeListLoader(this);
            }
        }
Exemplo n.º 5
0
        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);
            }
        }