Exemple #1
0
 public void ApplySettings(SettingInfoBase settings)
 {
     if (_clientPlugin != null)
     {
         _client.RestoreFileProperties = settings.Get <bool>(SettingInfo.RestoreFileProperties);
         _clientPlugin.ApplySettings(settings);
     }
 }
Exemple #2
0
        /// <summary>
        /// Initializes the <see cref="ClientController"/>
        /// </summary>
        /// <param name="view">The <see cref="IClientView"/>.</param>
        /// <param name="loginSettings">The login settings.</param>
        /// <param name="settings">The general settings.</param>
        public ClientController(IClientView view, SettingInfoBase loginSettings, SettingInfoBase settings)
        {
            _view      = view;
            _loginInfo = loginSettings;
            _settings  = settings;

            _currentLocalDirectory = loginSettings.Get <string>(LoginInfo.LocalDir);
        }
Exemple #3
0
        /// <summary>
        /// Displays progress information of the current operation.
        /// </summary>
        private void client_Progress(object sender, FileSystemProgressEventArgs e)
        {
            switch (e.State)
            {
            case TransferState.DeletingDirectory:
                // It's about to delete a directory. To skip deleting this directory, simply set e.Skip = true.
                _view.UpdateStatus(string.Format("Deleting directory {0}...", e.SourceFileSystem.GetFileName(e.SourcePath)));
                if (_settings.Get <bool>(SettingInfo.ShowProgressWhileDeleting))
                {
                    //progressBarTotal.Value = (int)e.TotalPercentage;
                    _view.UpdateProgress(e, false, true);
                }
                return;

            case TransferState.DeletingFile:
                // It's about to delete a file. To skip deleting this file, simply set e.Skip = true.
                _view.UpdateStatus(string.Format("Deleting file {0}...", e.SourceFileSystem.GetFileName(e.SourcePath)));
                if (_settings.Get <bool>(SettingInfo.ShowProgressWhileDeleting))
                {
                    //progressBarTotal.Value = (int)e.TotalPercentage;
                    _view.UpdateProgress(e, false, true);
                }
                return;

            case TransferState.SettingFileAttribute:
                // It's about to setting attributes of a file. To skip this file, simply set e.Skip = true.
                _view.UpdateStatus(string.Format("Setting attributes file {0}...", e.SourceFileSystem.GetFileName(e.SourcePath)));
                if (_settings.Get <bool>(SettingInfo.ShowProgressWhileDeleting))
                {
                    //progressBarTotal.Value = (int)e.TotalPercentage;
                    _view.UpdateProgress(e, false, true);
                }
                return;

            case TransferState.SettingFilePermission:
                // It's about to setting attributes of a file. To skip this file, simply set e.Skip = true.
                _view.UpdateStatus(string.Format("Setting permissions file {0}...", e.SourceFileSystem.GetFileName(e.SourcePath)));
                if (_settings.Get <bool>(SettingInfo.ShowProgressWhileDeleting))
                {
                    //progressBarTotal.Value = (int)e.TotalPercentage;
                    _view.UpdateProgress(e, false, true);
                }
                return;

            case TransferState.BuildingDirectoryStructure:
                // It informs us that the directory structure has been prepared for the multiple file transfer.
                _view.UpdateStatus("Building directory structure...");
                break;

                #region Comparing File Events

            case TransferState.StartComparingFile:
                // Source file and destination file are about to be compared.
                // To skip comparing these files, simply set e.Skip = true.
                // To override the comparison result, set the e.ComparionResult property.
                _view.UpdateStatus(string.Format("Comparing file {0}...", System.IO.Path.GetFileName(e.SourcePath)));
                _view.UpdateProgress(e, true, true);
                break;

            case TransferState.Comparing:
                // Source file and destination file are being compared.
                _view.UpdateStatus(GetSpeedInfo("Comparing", e));
                _view.UpdateProgress(e, true, true);
                break;

            case TransferState.FileCompared:
                // Source file and destination file have been compared.
                // Comparison result is saved in the e.ComparisonResult property.
                _view.UpdateProgress(e, true, true);
                break;

                #endregion

                #region Uploading File Events

            case TransferState.StartUploadingFile:
                // Source file (local file) is about to be uploaded. Destination file is the remote file.
                // To skip uploading this file, simply set e.Skip = true.
                _view.UpdateStatus(string.Format("Uploading file {0}...", System.IO.Path.GetFileName(e.SourcePath)));
                _view.UpdateProgress(e, true, true);
                break;

            case TransferState.Uploading:
                // Source file is being uploaded to the remote server.
                _view.UpdateStatus(GetSpeedInfo("Uploading", e));
                _view.UpdateProgress(e, true, true);
                break;

            case TransferState.FileUploaded:
                // Source file has been uploaded.
                _view.UpdateProgress(e, true, true);
                break;

                #endregion

                #region Downloading File Events

            case TransferState.StartDownloadingFile:
                // Source file (remote file) is about to be downloaded.
                // To skip uploading this file, simply set e.Skip = true.
                _view.UpdateStatus(string.Format("Downloading file {0}...", System.IO.Path.GetFileName(e.SourcePath)));
                _view.UpdateProgress(e, true, true);
                break;

            case TransferState.Downloading:
                // Source file is being downloaded to the local disk.
                _view.UpdateStatus(GetSpeedInfo("Downloading", e));
                _view.UpdateProgress(e, true, true);
                break;

            case TransferState.FileDownloaded:
                // Remote file has been downloaded.
                _view.UpdateProgress(e, true, true);
                break;

                #endregion
            }
        }
Exemple #4
0
        public Setting(SettingInfoBase s)
        {
            InitializeComponent();

            _info = s;

            txtThrottle.Text                         = s.Get <int>(SettingInfo.Throttle).ToString();
            txtTimeout.Text                          = s.Get <int>(SettingInfo.Timeout).ToString();
            txtKeepAliveInterval.Text                = s.Get <int>(SettingInfo.KeepAlive).ToString();
            rbtAscii.Checked                         = s.Get <bool>(SettingInfo.AsciiTransfer);
            rbtBinary.Checked                        = !s.Get <bool>(SettingInfo.AsciiTransfer);
            tbProgress.Value                         = s.Get <int>(SettingInfo.ProgressUpdateInterval) / 50;
            chkRestoreProperties.Checked             = s.Get <bool>(SettingInfo.RestoreFileProperties);
            chkShowProgress.Checked                  = s.Get <bool>(SettingInfo.ShowProgressWhileDeleting);
            chkShowProgressWhileTransferring.Checked = s.Get <bool>(SettingInfo.ShowProgressWhileTransferring);

#if FTP
#if !SFTP
            tabControlExt.Controls.Remove(sftpPage);
#endif
            #region FTP
            chkSendABOR.CheckState         = GetState(s.Get <OptionValue>(FtpSettingInfo.SendAborCommand));
            chkSendSignals.Checked         = s.Get <bool>(FtpSettingInfo.SendAbortSignals);
            chkChDirBeforeListing.Checked  = s.Get <bool>(FtpSettingInfo.ChangeDirBeforeListing);
            chkChDirBeforeTransfer.Checked = s.Get <bool>(FtpSettingInfo.ChangeDirBeforeTransfer);
            chkCompress.Checked            = s.Get <bool>(FtpSettingInfo.Compress);
            chkSmartPath.Checked           = s.Get <bool>(FtpSettingInfo.SmartPath);
            #endregion
#endif

#if SFTP
#if !FTP
            tabControlExt.Controls.Remove(ftpPage);
#endif
            #region SFTP
            cbxServerOs.SelectedIndex = s.Get <int>(SftpSettingInfo.ServerOs);
            #endregion
#endif
        }
Exemple #5
0
        /// <summary>
        /// Initializes the form base on the provided LoginInfo that is loaded from the Registry.
        /// </summary>
        /// <param name="s">The LoginInfo object.</param>
        public Login(SettingInfoBase s)
        {
            InitializeComponent();

            _info = s;

            txtServer.Text    = s.Get <string>(LoginInfo.ServerName);
            txtPort.Text      = s.Get <int>(LoginInfo.ServerPort).ToString();
            txtUserName.Text  = s.Get <string>(LoginInfo.UserName);
            txtPassword.Text  = s.Get <string>(LoginInfo.Password);
            txtRemoteDir.Text = s.Get <string>(LoginInfo.RemoteDir);
            txtLocalDir.Text  = s.Get <string>(LoginInfo.LocalDir);

            chkUtf8Encoding.Checked = s.Get <bool>(LoginInfo.Utf8Encoding);

            txtProxyHost.Text            = s.Get <string>(LoginInfo.ProxyServer);
            txtProxyPort.Text            = s.Get <int>(LoginInfo.ProxyPort).ToString();
            txtProxyUser.Text            = s.Get <string>(LoginInfo.ProxyUser);
            txtProxyPassword.Text        = s.Get <string>(LoginInfo.ProxyPassword);
            txtProxyDomain.Text          = s.Get <string>(LoginInfo.ProxyDomain);
            cbxProxyType.SelectedIndex   = s.Get <int>(LoginInfo.ProxyType);
            cbxProxyMethod.SelectedIndex = s.Get <int>(LoginInfo.ProxyHttpAuthnMethod);

#if FTP
#if !SFTP
            sftp.Visible = false;
#endif
            #region FTP
            chkPasv.Checked                = s.Get <bool>(FtpLoginInfo.PasvMode);
            txtCertificate.Text            = s.Get <string>(FtpLoginInfo.Certificate);
            cbxSec.SelectedIndex           = s.Get <int>(FtpLoginInfo.SecurityMode);
            chkClearCommandChannel.Checked = s.Get <bool>(FtpLoginInfo.ClearCommandChannel);
            #endregion
#endif

#if SFTP
#if !FTP
            ftp.Visible    = false;
            cbxSec.Visible = false;

            // Remove FTP Proxy items.
            cbxProxyType.Items.RemoveAt(cbxProxyType.Items.Count - 1);
            cbxProxyType.Items.RemoveAt(cbxProxyType.Items.Count - 1);
            cbxProxyType.Items.RemoveAt(cbxProxyType.Items.Count - 1);
#endif
            #region SFTP
            chkCompress.Checked = s.Get <bool>(SftpLoginInfo.EnableCompression);
            txtPrivateKey.Text  = s.Get <string>(SftpLoginInfo.PrivateKey);
            #endregion
#endif

            switch (s.Get <TraceEventType>(LoginInfo.LogLevel))
            {
            case TraceEventType.Error:
                cbxLogLevel.SelectedIndex = 1;
                break;

            case TraceEventType.Information:
                cbxLogLevel.SelectedIndex = 2;
                break;

            case TraceEventType.Verbose:
                cbxLogLevel.SelectedIndex = 3;
                break;

            case TraceEventType.Transfer:
                cbxLogLevel.SelectedIndex = 4;
                break;

            default:     // None
                cbxLogLevel.SelectedIndex = 0;
                break;
            }

            _sites = SiteLoader.GetSites();

            if (_sites == null)
            {
                MessageBox.Show("FtpSites.xml not found", "Error", MessageBoxButtons.OK, MessageBoxIcon.Stop);
                return;
            }

            foreach (SiteInfo info in _sites)
            {
                cbxSites.Items.Add(info.Description);
            }
        }