Sub Process_Globals
End Sub
Sub Globals
Dim SFTP1 As SFtp
Dim RAFile As RandomAccessFile
End Sub
Sub Activity_Create(FirstTime As Boolean)
Dim Inhalt As String
If FirstTime Then
SFTP1.Initialize("SFTP1","Username","Password","SFTPserver",22)
Log("SFTP initialized.")
End If
GetIPFile
Inhalt = ReadFile
DeleteFile
End Sub
Sub SFTP1_PromptYesNo (Message As String)
SFTP1.SetPromptResult(True)
Log("Fingerprint question passed.")
End Sub
Sub GetIPFile
SFTP1.DownloadFile("Downloadpath",File.DirRootExternal,"Test.txt")
Log("Download requested.")
End Sub
Sub ReadFile As String
Dim a As String
Dim i As Long
RAFile.Initialize(File.DirRootExternal,"Test.txt",True)
a="":i=0
Do While i<>RAFile.Size
a = a & Chr(RAFile.ReadUnsignedByte(i))
i=i+1
Loop
Log(i & " Bytes read.")
RAFile.Close
Return a
End Sub
Sub DeleteFile
File.Delete(File.DirRootExternal,"Test.txt")
Log("internal file deleted.")
End Sub
Sub SFTP1_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 SFTP1_DownloadCompleted (ServerPath As String, Success As Boolean)
Log(ServerPath & ", Success=" & Success)
If Success = False Then
Log(LastException.Message)
End If
End Sub