예제 #1
0
        public static FTPFile CreateFromPath(string path, int accountId)
        {
            FTPFile file = new FTPFile(accountId);

            file.fullName = path;
            file.name     = PathExt.GetName(path);
            return(file);
        }
예제 #2
0
        public static FTPFile CreateFromServerCall(edtFTPFile fileInfo, string baseDir, int accountId)
        {
            var file = new FTPFile(accountId);

            file.LastModifiedTime = fileInfo.LastModified;
            file.IsDirectory      = fileInfo.Dir;
            file.Size             = FileSize.CreateFromBytes(fileInfo.Size);
            file.name             = fileInfo.Name;
            file.fullName         = PathExt.Combine(baseDir, fileInfo.Name, false);

            return(file);
        }
예제 #3
0
파일: FTPFile.cs 프로젝트: kkalinowski/nex
        public static FTPFile CreateFromServerCall(edtFTPFile fileInfo, string baseDir, int accountId)
        {
            var file = new FTPFile(accountId);
            file.LastModifiedTime = fileInfo.LastModified;
            file.IsDirectory = fileInfo.Dir;
            file.Size = FileSize.CreateFromBytes(fileInfo.Size);
            file.name = fileInfo.Name;
            file.fullName = PathExt.Combine(baseDir, fileInfo.Name, false);

            return file;
        }
예제 #4
0
파일: FTPFile.cs 프로젝트: kkalinowski/nex
 public static FTPFile CreateFromPath(string path, int accountId)
 {
     FTPFile file = new FTPFile(accountId);
     file.fullName = path;
     file.name = PathExt.GetName(path);
     return file;
 }
예제 #5
0
        public override IEnumerable <IDirectoryViewItem> GetDirectoryContent(string dirPath)
        {
            var content = new List <IDirectoryViewItem>();

            if (!IsRootPath(dirPath))
            {
                content.Add(new MoveUpObject());
            }

            var infos    = connection.GetFileInfos(dirPath);
            var ftpFiles = infos.Where(x => x.Name != "." && x.Name != "..").Select(x => FTPFile.CreateFromServerCall(x, dirPath, account.Id)).OrderByDescending(x => x.IsDirectory);

            content.AddRange(ftpFiles);

            connection.ChangeWorkingDirectory(dirPath);
            return(content);
        }
예제 #6
0
 public void Download(FTPFile file, string destination)
 {
     connection.DownloadFile(destination, file.Name);
 }
예제 #7
0
 public override void LoadDirectory(string dirPath)
 {
     Items.Clear();
     Items.AddRange(GetDirectoryContent(dirPath));
     CurrentPlace = FTPFile.CreateFromPath(dirPath, account.Id);
 }