Esempio n. 1
0
        private bool SetFTP()
        {
            bool result = string.IsNullOrWhiteSpace(textBoxHost.Text) ||
                          string.IsNullOrWhiteSpace(textBoxPort.Text) ||
                          string.IsNullOrWhiteSpace(textBoxUserName.Text) ||
                          string.IsNullOrWhiteSpace(passwordBoxUserPass.Password);

            if (selectedUser != null)
            {
                ftp = new YSFTPClient(selectedUser);
                return(true);
            }

            if (!result)
            {
                ftp = new YSFTPClient(textBoxHost.Text, Convert.ToInt32(textBoxPort.Text), textBoxUserName.Text, passwordBoxUserPass.Password);
                return(true);
            }
            else if (!string.IsNullOrWhiteSpace(textBoxHost.Text))
            {
                ftp = new YSFTPClient(textBoxHost.Text);
                return(true);
            }
            return(false);
        }
Esempio n. 2
0
 private bool SetConnection()
 {
     if (ftp != null)
     {
         DisableBar();
         ftp = null;
         return(false);
     }
     return(true);
 }