Exemple #1
0
        public override void Download(FileInf file)
        {
            var client = new FtpClient
            {
                Host        = Server,
                Port        = Port,
                Credentials = new NetworkCredential(User, Password)
            };

            client.EncryptionMode = _encryptionMode;

            client.Connect();
            client.SetWorkingDirectory(Path);

            ProtocolFTP.DownloadFile(client, file);

            client.Disconnect();
        }
Exemple #2
0
        public override void Upload(FileInf file)
        {
            var client = new FtpClient
            {
                Host        = Server,
                Port        = Port,
                Credentials = new NetworkCredential(User, Password),
            };

            client.ValidateCertificate += OnValidateCertificate;
            client.DataConnectionType   = FtpDataConnectionType.PASV;
            client.EncryptionMode       = _encryptionMode;

            client.Connect();
            client.SetWorkingDirectory(Path);

            ProtocolFTP.UploadFile(client, file);

            client.Disconnect();
        }
Exemple #3
0
        public override FileInf[] List()
        {
            var files = new List <FileInf>();

            var client = new FtpClient
            {
                Host        = Server,
                Port        = Port,
                Credentials = new NetworkCredential(User, Password)
            };

            client.DataConnectionType = FtpDataConnectionType.PASV;
            client.EncryptionMode     = _encryptionMode;

            client.Connect();
            client.SetWorkingDirectory(Path);

            var ftpFiles = ProtocolFTP.ListFiles(client);

            client.Disconnect();

            return(files.ToArray());
        }