'Static code module
Sub Process_Globals
Dim SettingsMap As Map
Dim myPassword As String = "myPasswordForSettigsMap"
End Sub
Sub LoadSettings( Dir As String, FileName As String)
If Dir="" Or FileName="" Then
LogError( "Empty Dir or FileName")
Return
End If
Dim raf As RandomAccessFile
raf.Initialize( Dir, FileName, False)
SettingsMap = raf.ReadEncryptedObject( myPassword, raf.CurrentPosition)
raf.Close
End Sub
Sub SaveSettings( Dir As String, FileName As String)
If Dir="" Or FileName="" Then
LogError( "Empty Dir or FileName")
Return
End If
Dim raf As RandomAccessFile
raf.Initialize( Dir, FileName, False)
raf.WriteEncryptedObject( SettingsMap, myPassword, raf.CurrentPosition)
raf.Close
End Sub
Sub Test
SettingsMap.Initialize
'Set and Save
SettingsMap.Put( "B4J", "is good")
Log( SettingsMap.GetDefault( "B4J", "is better"))
SaveSettings( File.DirApp, "settings.conf")
'Load and Get
LoadSettings( File.DirApp, "settings.conf")
Log( SettingsMap.GetDefault( "B4J", "is better"))
'Set and Save
SettingsMap.Put( "B4J", "is the Best")
Log( SettingsMap.GetDefault( "B4J", "is better"))
SaveSettings( File.DirApp, "settings.conf")
End Sub