using GameBackup3H3.DbOp;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace FTPop
{
public interface IFTP
{
///
/// 打开FTP
///
///
int Open(FTPInfo ftpinfo);
///
/// FTP是否打开着
///
///
bool IsOpen { get; }
///
/// 关闭FTP。
///
///
int Close();
///
/// 显示文件夹列表
///
///
///
List ListDirectory(string CurFolder,out string error);
///
/// 上传
///
///
///
///
int Upload(string localPath, string remotePath);
///
/// 下载
///
///
///
///
int Download(string remotePath, string localPath);
///
/// 删除文件
///
///
///
int DelFile(string remotePath);
///
/// 删除文件
///
///
///
int RemoveFiles(string remotePath);
///
/// 移动文件
///
///
///
int MoveFile(string fromPath,string toPath);
///
/// 文件是否存在
///
///
///
bool FileExists(string remotePath);
///
/// 文件大小
///
///
///
Int64 FileSize(string remotePath);
///
/// 文件最后修改时间
///
///
///
DateTime FileLastWriteTime(string remotePath);
///
/// 文件信息
///
///
///
RemoteFileInfo GetFileInfo(string remotePath);
///
/// 文件传输事件
///
event FileTransferProgressEventHandler FileTransferProgress;
}
public delegate void FileTransferProgressEventHandler(object sender, FileTransferProgressEventArgs e);
public sealed class FileTransferProgressEventArgs : EventArgs
{
///
/// 文件全路径
///
public string LocalPath { get; internal set; }
///
/// 当前文件进度
///
public double FileProgress { get; internal set; }
///
/// 当前传输速度
///
public double Speed { get; internal set; }
///
/// 是否完成
///
public bool IsComplete { get; internal set; } = false;
///
/// 是否要取消
///
public bool Cancel { get; set; }
}
///
/// 远程文件信息
///
public class RemoteFileInfo
{
public string Name { get; set; }
public string FullName { get; set; }
public long Length { get; set; }
public DateTime LastWriteTime { get; set; } = DateTime.MinValue;
public bool IsDirectory { get; set; }
public override string ToString()
{
return FullName;
}
}
}