Пример #1
0
        public IRemoteFileSystem Create()
        {
            ComponentPro.Net.Sftp client = new ComponentPro.Net.Sftp();

            client.SetMultipleFilesAttributesCompleted += client_SetMultipleFilesAttributesCompleted;
            client.HostKeyVerifying += client_CheckingFingerprint;

            _client = client;

            return(client);
        }
Пример #2
0
        public void ApplyLoginSettings(SettingInfoBase settings)
        {
            ComponentPro.Net.Sftp sftp = (ComponentPro.Net.Sftp)_client;

            string proxyServer = _loginSettings.Get <string>(LoginInfo.ProxyServer);
            int    proxyPort   = _loginSettings.Get <int>(LoginInfo.ProxyPort);

            if (!string.IsNullOrEmpty(proxyServer) && proxyPort > 0)
            {
                WebProxyEx proxy = new WebProxyEx();
                sftp.Proxy = proxy;

                proxy.Server               = proxyServer;
                proxy.Port                 = proxyPort;
                proxy.UserName             = _loginSettings.Get <string>(LoginInfo.ProxyUser);
                proxy.Password             = _loginSettings.Get <string>(LoginInfo.ProxyPassword);
                proxy.Domain               = _loginSettings.Get <string>(LoginInfo.ProxyDomain);
                proxy.ProxyType            = _loginSettings.Get <ProxyType>(LoginInfo.ProxyType);
                proxy.AuthenticationMethod = _loginSettings.Get <ProxyHttpConnectAuthMethod>(LoginInfo.ProxyHttpAuthnMethod);
            }

            sftp.Config.CompressionEnabled = _loginSettings.Get <bool>(SftpLoginInfo.EnableCompression);
        }