B4J Question Request for a jRLIni working example

rwblinn

Well-Known Member
Licensed User
Longtime User
Hi Mashiane,

to know is that jRLIni has been developed way back in the early days of B4J in 2013/2014.
It was basically simulating a map key value pair (with put & get key) without the possibility of using INI sections.
The map functionality was not avialable in B4J first version.
In the mean time, maps have become an essential part of B4J.

Recommend not to use jRLIni, but use the standard B4X Map methods instead - will make a note at the jRLIni thread.
 
Upvote 0

FabioRome

Member
Licensed User
Longtime User
Hi

I kindly request a working example on how to usethe jRLINI library.

Thanks

B4X:
Private tmpINI As jRLIni
    UsaProxy.Initialize
    tmpINI.Initialize(File.DirApp, "config.cfg")
    UsaProxy.Host  = tmpINI.getKey("ProxyHost","PROXY")
    UsaProxy.Port = tmpINI.getKey( "ProxyPort","PROXY")
    UsaProxy.Scheme = tmpINI.getKey ("ProxySchema", "PROXY")
    UsaProxy.Username = tmpINI.getKey("ProxyUsername","PROXY")
    UsaProxy.Password = tmpINI.getKey("ProxyPassword", "PROXY")

config.cfg
B4X:
[PROXY]
ProxyHost=ip-number
ProxyPort=port-number
ProxySchema=http
ProxyUsername=name
ProxyPassword=password

Thank at rwblinn
 
Upvote 0

Peter Meares

Member
Licensed User
Longtime User
I used the JRLini functions and they are really simple. I have extracted the key bits from my code.

B4X:
Sub Process_Globals
    Private WMIni As jRLIni        ' Ini settings
End Sub

Sub AppStart (Args() As String)
    ' set things up
    WMIni.Initialize(File.DirApp, "WMIni.ini")
    Dim strDictFileName As String = "Dictionary.txt"       

' Save them with a date and time stamp, although there appears to one automatically added at top of file.
    WMIni.putKey("UpdateDateTime", DateTime.Date(DateTime.Now) & "-" & DateTime.Time(DateTime.Now))
    WMIni.putKey("Dictionary", strDictFileName)
' Save the keys
    WMIni.saveIni
' Clear the string to prove something was saved.
    strDictFileName = ""
    Log("Dictionary file = " & strDictFileName)
' Reload the Dictionary name
    strDictFileName = WMIni.getKey("Dictionary", "Not Found")
    Log("Dictionary file = " & strDictFileName)
End Sub

No need to set up the initial ini file, it all happens seamlessly. The WMini.ini file appears in the Objects folder. And the output looks like

#Thu Sep 21 16:33:59 BST 2017
Dictionary=Dictionary.txt
UpdateDateTime=09/21/2017-16\:33\:59

Nice and easy.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…