Example #1
0
        private FileSystemItem CreateModel(IFtpListItem item, string path)
        {
            if (item.Type == FtpFileSystemObjectType.Directory && !path.EndsWith("/"))
            {
                path += "/";
            }
            ItemType type;

            switch (item.Type)
            {
            case FtpFileSystemObjectType.File:
                type = ItemType.File;
                break;

            case FtpFileSystemObjectType.Directory:
                type = ItemType.Directory;
                break;

            case FtpFileSystemObjectType.Link:
                type = ItemType.Link;
                break;

            default:
                throw new NotSupportedException("Invalid FTP item type: " + item.Type);
            }
            return(new FileSystemItem
            {
                Name = item.Name,
                Type = type,
                Date = item.Modified,
                Path = path,
                FullPath = string.Format("{0}:/{1}", Connection.Name, path),
                Size = item.Type == FtpFileSystemObjectType.Directory ? null : (long?)item.Size
            });
        }
Example #2
0
 private FileSystemItem CreateModel(IFtpListItem item, string path)
 {
     if (item.Type == FtpFileSystemObjectType.Directory && !path.EndsWith("/")) path += "/";
     ItemType type;
     switch (item.Type)
     {
         case FtpFileSystemObjectType.File:
             type = ItemType.File;
             break;
         case FtpFileSystemObjectType.Directory:
             type = ItemType.Directory;
             break;
         case FtpFileSystemObjectType.Link:
             type = ItemType.Link;
             break;
         default:
             throw new NotSupportedException("Invalid FTP item type: " + item.Type);
     }
     return new FileSystemItem
                {
                    Name = item.Name,
                    Type = type,
                    Date = item.Modified,
                    Path = path,
                    FullPath = string.Format("{0}:/{1}", _connection.Name, path),
                    Size = item.Type == FtpFileSystemObjectType.Directory ? null : (long?)item.Size
                };
 }