示例#1
0
        private void Init_Connection(string address, string username, string password)
        {
            this.terminalControl1.UserName = username.Trim();
            this.terminalControl1.Password = password.Trim();
            this.terminalControl1.Host     = address.Trim();

            if (this.terminalControl1.UserName.Length < 2 || this.terminalControl1.Password.Length < 2 || this.terminalControl1.Host.Length < 2)
            {
                this.Close();
                return;
            }

            this.terminalControl1.Method = WalburySoftware.ConnectionMethod.SSH2;

            if (this.terminalControl1.Connect() == false)
            {
                NighterSSH.PopupBox PopupBox = new NighterSSH.PopupBox();
                PopupBox.pText = "Unable to connect: " + this.terminalControl1.Host;
                PopupBox.Show();
                Application.Exit();
                this.Close();
                return;
            }

            try
            {
                TextReader textReader = new StreamReader("nighterssh.settings");
                ConfigNode configNode = new ConfigNode("nighterssh-settings");
                configNode.ReadFrom(textReader);
                if (configNode.Children != null)
                {
                    configNode = configNode.FindChildConfigNode("nighterssh-settings");
                    if (configNode != null)
                    {
                        this.terminalControl1.TerminalPane.ConnectionTag.RenderProfile.Import(configNode);
                        Color textColor = default(Color);
                        textColor = Color.FromArgb(int.Parse(configNode["force-color"], NumberStyles.HexNumber));
                        Color backColor = default(Color);
                        backColor = Color.FromArgb(int.Parse(configNode["back-color"], NumberStyles.HexNumber));
                        this.terminalControl1.SetPaneColors(textColor, backColor);
                        this.terminalControl1.Focus();
                    }
                    textReader.Close();
                }
                else
                {
                    //this.terminalControl1.SetPaneColors(Color.LawnGreen, Color.Black);
                    //this.terminalControl1.Focus();
                }
            }
            catch
            {
                try
                {
                    //this.terminalControl1.SetPaneColors(Color.LawnGreen, Color.Black);
                    //this.terminalControl1.Focus();
                }
                catch { }
            }
        }
示例#2
0
 private void mnuAbout_Click(object sender, EventArgs e)
 {
     NighterSSH.PopupBox PopupBox = new NighterSSH.PopupBox();
     PopupBox.pText = "NighterSSH\n  Author: Mikael Kall \n [email protected]";
     PopupBox.Show();
 }