Hi all.
Anybody see an issue with this code? I write the map file out encrypted and when I look at in Notepad++ you can see it is encrypted. But when I read it back in it comes is wrong.
Anybody see an issue with this code? I write the map file out encrypted and when I look at in Notepad++ you can see it is encrypted. But when I read it back in it comes is wrong.
B4X:
Sub Process_Globals
Private fx As JFX
Private Const PASSWORD0 As String = "xciFp987q"
Private Const PASSWORD1 As String = "jav!a"
Private const DEV0EMAIL As String = "lo@(W" '--- 3rd part of PW
Dim PASSWORD As String = PASSWORD0 & "7" & PASSWORD1 & "U" & DEV0EMAIL
End Sub
Sub SaveMapFiles(filename As String, m As Map,encreypted As Boolean)
SafeKill(File.DirApp,filename)
If encreypted Then
Dim raf As RandomAccessFile
raf.Initialize(File.DirApp,filename,False)
'raf.WriteB4XObject(m,raf.CurrentPosition)
raf.WriteEncryptedObject(m , PASSWORD,raf.CurrentPosition)
raf.Close
Else
File.WriteMap(File.DirApp,filename,m)
End If
End Sub
Sub LoadMapFile(filename As String,encreypted As Boolean) As Map
Dim m As Map : m.Initialize
If encreypted Then
Dim raf As RandomAccessFile
raf.Initialize(File.DirApp,filename,False)
'm = raf.ReadB4XObject(raf.CurrentPosition)
m = raf.ReadEncryptedObject(PASSWORD,raf.CurrentPosition)
raf.Close
Else
m = File.ReadMap(File.DirApp,filename)
End If
Return m
End Sub
Last edited: