@@ -66,36 +66,23 @@ public async Task ConnectFTP(string? ftpName, bool anonymous, string? username,
6666 {
6767 try
6868 {
69- // create an FTP client and specify the host, username and password
70- // (delete the credentials to use the "anonymous" account)
69+ // create an FTP client and specify the host, username and password
7170 if ( anonymous )
7271 {
7372 username = "anonymous" ;
74- password = "" ;
73+ password = "anonymous " ;
7574 }
7675 _ftpClient = new AsyncFtpClient ( ftpName , username , password ) ;
7776
78- // connect to the server and automatically detect working FTP settings
77+ // TODO: process possible exceptions
7978 await _ftpClient . AutoConnect ( ) ;
8079
81- // get a list of files and directories in the "/htdocs" folder
82- foreach ( FtpListItem item in await _ftpClient . GetListing ( "/htdocs" ) )
83- {
84- // if this is a file
85- if ( item . Type == FtpObjectType . File )
86- {
87- // get the file size
88- long size = await _ftpClient . GetFileSize ( item . FullName ) ;
89-
90- // calculate a hash for the file on the server side (default algorithm)
91- FtpHash hash = await _ftpClient . GetChecksum ( item . FullName ) ;
92- }
93-
94- // get modified date/time of the file or folder
95- DateTime time = await _ftpClient . GetModifiedTime ( item . FullName ) ;
96-
80+ FoldersFilesList . Clear ( ) ;
9781
98- // TODO: add to FilesFoldersList
82+ // get a list of files and directories in the root folder
83+ foreach ( FtpListItem item in await _ftpClient . GetListing ( "/" ) )
84+ {
85+ FoldersFilesList . Add ( new FileViewModel ( item . FullName , item . Type == FtpObjectType . Directory ) ) ;
9986 }
10087 Mode = Mode . FTP ;
10188 }
0 commit comments