Exemplo n.º 1
0
        public override FileInf[] List()
        {
            List <FileInf> files = new List <FileInf>();

            FtpClient client = new FtpClient();

            client.Host               = this.Server;
            client.Port               = this.Port;
            client.Credentials        = new NetworkCredential(this.User, this.Password);
            client.DataConnectionType = FtpDataConnectionType.PASV;
            client.EncryptionMode     = this._encryptionMode;

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

            FileInf[] ftpFiles = PluginFTP.ListFiles(client, this.Task.Id);
            files.AddRange(ftpFiles);

            foreach (var file in files)
            {
                this.Task.InfoFormat("[PluginFTPS] file {0} found on {1}.", file.Path, this.Server);
            }

            client.Disconnect();


            return(files.ToArray());
        }
Exemplo n.º 2
0
        public override void Download(FileInf file)
        {
            FtpClient client = new FtpClient();

            client.Host           = this.Server;
            client.Port           = this.Port;
            client.Credentials    = new NetworkCredential(this.User, this.Password);
            client.EncryptionMode = this._encryptionMode;

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

            PluginFTP.DownloadFile(client, file, this.Task);
            this.Task.InfoFormat("[PluginFTPS] file {0} downloaded from {1}.", file.Path, this.Server);

            client.Disconnect();
        }
Exemplo n.º 3
0
        public override void Upload(FileInf file)
        {
            FtpClient client = new FtpClient();

            client.Host                 = this.Server;
            client.Port                 = this.Port;
            client.Credentials          = new NetworkCredential(this.User, this.Password);
            client.ValidateCertificate += OnValidateCertificate;
            client.DataConnectionType   = FtpDataConnectionType.PASV;
            client.EncryptionMode       = this._encryptionMode;

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

            PluginFTP.UploadFile(client, file);
            this.Task.InfoFormat("[PluginFTPS] file {0} sent to {1}.", file.Path, this.Server);

            client.Disconnect();
        }