Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Threading;
- using System.Net;
- using XML_Base_Library.Ftp;
- using System.Collections;
- namespace XML_Base
- {
- class FtpUtil
- {
- private string username, password, FilePath, FileName, DownloadPath, serverip;
- private int port;
- private Queue q = new Queue(11);
- public FtpUtil(IPAddress serverIp, int Port, string username, string password)
- {
- this.username = username;
- this.password = password;
- this.serverip = serverIp.ToString();
- this.port = Port;
- //ftpClient.AutoChecksumValidation = HashingFunction.Crc32;
- }
- private void GetFile()
- {
- FtpClient ftpClient = new FtpClient(serverip, port);
- ftpClient.FileTransferType = TransferType.Binary;
- ftpClient.DataTransferMode = TransferMode.Passive;
- ftpClient.Open(username, password);
- ftpClient.GetFile(FilePath + FileName, DownloadPath + this.FileName, FileAction.Create);
- ftpClient.Close();
- }
- public void Download(string FileName, string FilePath, string DownloadPath)
- {
- this.FileName = FileName;
- this.FilePath = FilePath;
- this.DownloadPath = DownloadPath;
- q.Enqueue(FilePath + FileName);
- Thread new1 = new Thread(new ThreadStart(GetFile));
- new1.Start();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement