Пример #1
0
 protected override bool InitClient(ConnectEntryData ci, ref SFTPSyncClient client)
 {
     try
     {
         client = SFTPSyncClient.Create(ci.ce);
     }
     catch (Exception eClient)
     {
         ClouderSyncPackage.Log(eClient.Message);
         return(false);
     }
     try
     {
         if (!client.Connect())
         {
             client.Log("Connection has failed" + '\n');
             return(false);
         }
     }
     catch (Exception eConnect)
     {
         ClouderSyncPackage.WriteToOutputWindow(eConnect.Message + '\n');
         string testResult = client.getLogMessages();
         ClouderSyncPackage.WriteToOutputWindow(testResult);
         client.clearLogMessages();
         return(false);
     }
     return(true);
 }
Пример #2
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            ClouderSyncPackage.Log("Starting connection test...");
            //            WriteLog("Starting connection test...");
            SFTPSyncClient client = null;

            resultMessages.Clear();
            TestConnection(ref client);
            testResult = resultMessages.ToString();
            if (client != null)
            {
                testResult = client.getLogMessages();
            }
            //WriteLog(testResult);
            MessageBox.Show(testResult, "Test Result", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }