Estoy tratando de adaptar el código de este ejemplo:
https://www.b4x.com/android/forum/threads/secured-assets-encrypt-your-assets-files.35589/#content
Cambiando DoEvents por Wait For y Sleep de la siguiente manera:
¿Lo veis correcto?
https://www.b4x.com/android/forum/threads/secured-assets-encrypt-your-assets-files.35589/#content
Cambiando DoEvents por Wait For y Sleep de la siguiente manera:
B4X:
Private Sub UnpackEncryptedAssets(StoreName As String, Password As String, Version As Int)
File.MakeDir(File.DirInternal, Version)
UpdatedAssetsFolder = File.Combine(File.DirInternal, Version)
If File.Exists(UpdatedAssetsFolder, "store.db") Then
Return
End If
'delete old versions
For i = 1 To Version - 1
If File.Exists(File.DirInternal, i) Then
For Each f As String In File.ListFiles(File.Combine(File.DirInternal, i))
File.Delete(File.Combine(File.DirInternal, i), f)
Next
File.Delete(File.DirInternal, i)
End If
Next
'ProgressDialogShow("Preparing resource files...") 'Quito esta línea
'DoEvents
File.Copy(File.DirAssets, StoreName, UpdatedAssetsFolder, "store.db")
Wait For File_Complete
Dim kvs As KeyValueStore
kvs.Initialize(UpdatedAssetsFolder, "store.db")
For Each key As String In kvs.ListKeys
Dim blob() As Byte = kvs.GetEncryptedObject(key, Password)
Log(key & ": " & blob.Length)
Dim out As OutputStream = File.OpenOutput(UpdatedAssetsFolder, key, False)
out.WriteBytes(blob, 0, blob.Length)
out.Close
Sleep(0) 'DoEvents
Next
'ProgressDialogHide 'Quito esta línea
End Sub
¿Lo veis correcto?