Пример #1
0
 //========================================================================
 private void frmRunRep_FormClosing(object sender, FormClosingEventArgs e)
 {
     if (running)
     {
         checker.CancelAsync();
     }
     if (session != null)
     {
         session.Disconnect();
     }
 }
Пример #2
0
        private void Login()
        {
            while (!_session.LoggedIn)
            {
                _session.Disconnect();
                _session.Connect("symitar", 23);
                _session.Login("jdeering", "h3dd0#mon", "083ch#ckb00k");

                if (_session.LoggedIn)
                {
                    responseBox.Text += @"Logged in";
                    responseBox.Text += "\n\n";
                }
            }
        }
Пример #3
0
 public void Disconnect_CallsDisconnectOnSocket()
 {
     var socketMock = Substitute.For<ISymSocket>();
     var session = new SymSession(socketMock);
     session.Disconnect();
     socketMock.Received().Disconnect();
 }
Пример #4
0
        //------------------------------------------------------------------------
        private void btnTest_Click(object sender, EventArgs e)
        {
            SymSession test = new SymSession();

            try
            {
                if (!test.Connect(txtIP.Text, int.Parse(txtPort.Text)))
                {
                    MessageBox.Show(test.error, "PwrIDE", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                if (!test.AIXTest(txtUser.Text, txtPass.Text))
                {
                    MessageBox.Show(test.error, "PwrIDE", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error During Login\n" + ex.Message, "PwrIDE", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            test.Disconnect();
            MessageBox.Show("Server Connected Okay!", "PwrIDE", MessageBoxButtons.OK, MessageBoxIcon.None);
        }
Пример #5
0
        public void Disconnect_CallsDisconnectOnSocket()
        {
            var socketMock = Substitute.For <ISymSocket>();
            var session    = new SymSession(socketMock);

            session.Disconnect();
            socketMock.Received().Disconnect();
        }
Пример #6
0
 //========================================================================
 public void Disconnect()
 {
     if (Connection == null)
     {
         return;
     }
     Connection.Disconnect();
     Connection = null;
 }
Пример #7
0
        //========================================================================
        public bool Connect()
        {
            if (Connection != null)
            {
                if (Connection.isLoggedIn)
                {
                    return(true);
                }
            }

            Connection = new SymSession();
            if (!Connection.Connect(Parent.IP, Parent.Port))
            {
                return(false);
            }
            if (Connection.Login(Parent.AixUsr, Parent.AixPwd, SymDir, SymId) == false)
            {
                Connection.Disconnect();
                Connection = null;
                return(false);
            }
            return(true);
        }
Пример #8
0
        //------------------------------------------------------------------------
        private void btnTest_Click(object sender, EventArgs e)
        {
            SymSession test = new SymSession();

            try
            {
                if (!test.Connect(Server.IP, Server.Port))
                {
                    MessageBox.Show(test.error, "PwrIDE", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }
                string aixPwd = Server.AixPwd;
                if (aixPwd.Trim().Length == 0)
                {
                    InputBox inp = new InputBox("Test Sym Connection", "Please Enter AIX Password for Server \"" + Server.Alias + "\".", "", true);
                    if (inp.ShowDialog(this) == DialogResult.Cancel)
                    {
                        return;
                    }
                    aixPwd = inp.Input;
                    inp.Dispose();
                }

                bool retry  = true;
                bool result = test.Login(Server.AixUsr, aixPwd, txtSym.Text, txtID.Text);
                while (retry && (!result))
                {
                    retry = false;
                    if (result == false)
                    {
                        if (test.error == "Invalid AIX Login")
                        {
                            InputBox inp = new InputBox("Test Sym Connection", "Invalid AIX Login.\nPlease Re-Enter or Cancel (ESC).", "", true);
                            if (inp.ShowDialog(this) == DialogResult.Cancel)
                            {
                                return;
                            }
                            aixPwd = inp.Input;
                            inp.Dispose();
                            result = test.Login(Server.AixUsr, aixPwd, txtSym.Text, txtID.Text, 1);
                            retry  = true;
                        }
                        else if (test.error == "Invalid Sym User")
                        {
                            InputBox inp = new InputBox("Test Sym Connection", "Invalid Sym User ID.\nPlease Re-Enter or Cancel (ESC).", "", true);
                            if (inp.ShowDialog(this) == DialogResult.Cancel)
                            {
                                return;
                            }
                            txtID.Text = inp.Input;
                            inp.Dispose();
                            result = test.Login(Server.AixUsr, aixPwd, txtSym.Text, txtID.Text, 2);
                            retry  = true;
                        }
                        else
                        {
                            retry = (MessageBox.Show("Error Connecting to Sym\nError: " + test.error + "\n\nRetry?", "Sym Connection Test", MessageBoxButtons.YesNo, MessageBoxIcon.Error) == DialogResult.Yes);
                        }
                        if ((!retry) && (!result))
                        {
                            test.Disconnect();
                            return;
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error During Login Test\n" + ex.Message, "PwrIDE", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }
            test.Disconnect();
            MessageBox.Show("Sym Connected Okay!", "PwrIDE", MessageBoxButtons.OK, MessageBoxIcon.None);
        }