Beispiel #1
0
        /// <summary>
        ///
        /// </summary>
        /// <returns>Empty string for success or the exception message</returns>
        public LocationConnectionResultSet testConnection()
        {
            LocationConnectionResultSet result = new LocationConnectionResultSet();

            try
            {
                session = new Session();
                if (config.useSFTP)
                {
                    result.sshHostKeyFingerprint         = session.ScanFingerprint(sessionOptions);
                    sessionOptions.SshHostKeyFingerprint = result.sshHostKeyFingerprint;
                }
                session.Open(sessionOptions);
                result.wasSuccessful = true;
            }
            catch (Exception ex)
            {
                result.errorMessage = ex.Message;
            }
            finally
            {
                session.Dispose();
            }
            return(result);
        }
Beispiel #2
0
        public LocationConnectionResultSet connect()
        {
            FTPUtils ftputils = new FTPUtils((FTPCredentialsConfig)config);

            ftputils.Progress += progressHandler;
            LocationConnectionResultSet result = ftputils.testConnection();

            return(result);
        }
Beispiel #3
0
 private void onTestConnectionComplete(LocationConnectionResultSet result)
 {
     TestConnectionComplete?.Invoke(result);
 }