Dim jp As JSONParser
jp.Initialize(sRes)
Dim mU As Map
mU.Initialize
mU = jp.NextObject
Dim su As StringUtils
For Each k As String In mU.Keys
If k.StartsWith("file") Then
Dim sFile As String = su.DecodeUrl(mU.Get(k), "UTF8")
If File.Exists(rp.GetSafeDirDefaultExternal("Dnlds"), sFile.SubString(sFile.indexof("/") + 1)) Then
'
Else
Dim hj As HttpJob
hj.Initialize("", Me)
hj.Download(su.DecodeUrl(mU.Get("URL"), "UTF8") & sFile)
Log(su.DecodeUrl(mU.Get("URL"), "UTF8") & sFile)
wait for (hj) JobDone(job As HttpJob)
If job.Success Then
Dim b() As Byte = CommonFunctions2.GetByteArrayFromInputStream(job.GetInputStream)
CommonFunctions2.BytesToFile(rp.GetSafeDirDefaultExternal("Dnlds"), sFile.SubString(sFile.indexof("/") + 1), b)
Else
Dim hj2 As HttpJob
hj2.Initialize("", Me)
hj2.Download("http://www.server2.com/images/" & sFile.SubString(sFile.indexof("/") + 1))
wait for (hj2) JobDone(job2 As HttpJob)
If job2.Success Then
Dim b() As Byte = CommonFunctions2.GetByteArrayFromInputStream(job.GetInputStream)
CommonFunctions2.BytesToFile(rp.GetSafeDirDefaultExternal("Guide"), sFile.SubString(sFile.indexof("/") + 1), b)
Else
'
End If
job2.Release
hj2.Release
End If
job.Release
hj.Release
End If
End If
Next