Sub Process_Globals
Dim FTP As FTP
End Sub
Sub Globals
Dim btn_download As Button
Dim btn_list As Button
Dim btn_Upload As Button
Dim Button1 As Button
Dim Button2 As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.Title= "Use the Menu to Download the JPG Files"
Activity.AddMenuItem("Download JPG Files","menuLIST")
End Sub
Sub Activity_Resume
If FTP.IsInitialized Then FTP.closenow
FTP.Initialize("FTP", "FTP.secureftp-test.com", 21, "test", "test")
End Sub
Sub Activity_Pause (UserClosed As Boolean)
FTP.Close
End Sub
Sub menuLIST_Click
Msgbox("File will be stored in: " & File.DirRootExternal,"")
ToastMessageShow("Checking for FTP List now",False)
FTP.PassiveMode = True
FTP.List("./")
End Sub
Sub FTP_ListCompleted (ServerPath As String, Success As Boolean, Folders() As FTPEntry, Files() As FTPEntry)
Log(ServerPath)
If Success = False Then
Log(LastException)
Else
For i = 0 To Folders.Length - 1
ToastMessageShow(Folders(i).Name,False)
Log(Folders(i).Name)
Next
For i = 0 To Files.Length - 1
Log(Files(i).Name & ", " & Files(i).Size & ", " & DateTime.Date(Files(i).Timestamp))
ToastMessageShow(Files(i).Name & ", " & Files(i).Size & ", " & DateTime.Date(Files(i).Timestamp),False)
If Files(i).Name.EndsWith(".xml") Then FTP.DownloadFile(Files(i).Name, False, File.DirRootExternal, Files(i).Name)
Next
End If
End Sub
Sub FTP_DownloadProgress (ServerPath As String, TotalDownloaded As Long, Total As Long)
Dim s As String
s = "Downloaded " & Round(TotalDownloaded / 1000) & "KB"
If Total > 0 Then s = s & " out of " & Round(Total / 1000) & "KB"
Log(s)
End Sub
Sub FTP_DownloadCompleted (ServerPath As String, Success As Boolean)
Log(ServerPath & ", Success=" & Success)
If Success = False Then Log(LastException.Message)
End Sub