Пример #1
0
        private void executeSshSingleThreadedConnectionTest()
        {
            StringBuilder response      = new StringBuilder();
            SSH           sshConnection = null;

            foreach (var item in this.lbServers.SelectedItems)
            {
                try
                {
                    Connection localConnection = Connections.RetriveConnection(item.ToString());
                    sshConnection = new SSH(localConnection.Username, localConnection.DecriptPassword(GlobalPassword.Password), DNS.ReturnCorrectAddress(localConnection.Ipaddress));
                    sshConnection.AttemptConnection();
                    response.Append(connectionHeader(localConnection));
                    response.Append(sshConnection.GetLastAction());
                    this.txtCommandOutput.AppendText(response.ToString());
                    response.Clear();
                }
                catch (Exception e)
                {
                    response.Append(LogError(item.ToString(), e, "This is a connection test error: "));
                }
                finally
                {
                    if (sshConnection != null)
                    {
                        sshConnection.Disconnect();
                    }
                }
            }

            WriteLog(response);
        }