Hi guys!
this is my library for Ini files read... would you like handle your app config with Ini file simply? Or are you a old Windows Ini files nostalgic guy simply? well... this library is for you! :sign0060:
below you can find documentation:
any criticism, advice or suggestion is welcome!
(any donation is welcome too!) :sign0161:
happy coding!
this is my library for Ini files read... would you like handle your app config with Ini file simply? Or are you a old Windows Ini files nostalgic guy simply? well... this library is for you! :sign0060:
below you can find documentation:
B4X:
'Initializes the object and loads the specified Ini file
Public Sub Initialize(Dir As String, Filename As String)
'Loads the Ini file. It can be the same as specified in Initialize or another
Public Sub Load(Dir As String, Filename As String)
'Logs the entire internal data structure
Public Sub Debug
'Returns a string value from Ini file at specified Section and Key
'If value not found, returns NotFoundReturnValue
Public Sub Get(Section As String, Key As String, NotFoundReturnValue As String) As String
'Returns a List object from Ini file at specified Section and Key
'Value of Key in Ini file must be a standard list in format KeyName = { 1, 2, 3 }
'If value not found, returns Null
Public Sub GetList(Section As String, Key As String) As List
'Returns a string value indexed by Index from Ini file at specified Section and Key
'Value of Key in Ini file must be a standard list in format KeyName = { 1, 2, 3 }
'List can be a mixed list like KeyName = { , 1, two, 3.0, false }
'Index is zero based and must be in 0 > Index > List.Size - 1 range. Index out of range returns NotFoundReturnValue
'If value not found, returns NotFoundReturnValue
Public Sub GetIndex(Section As String, Key As String, Index As Int, NotFoundReturnValue As String) As String
'Returns a boolean value from Ini file at specified Section and Key
'Returns False to any value other than "True" string (case unsensitive)
'If value not found, returns False
Public Sub GetBoolean(Section As String, Key As String) As Boolean
'Returns a boolean value indexed by Index from Ini file at specified Section and Key
'Value of Key in Ini file must be a standard list in format KeyName = { 1, 2, 3 }
'List can be a mixed list like KeyName = { , 1, two, 3.0, false }
'Index is zero based and must be in 0 > Index > List.Size - 1 range. Index out of range returns False
'If value not found, returns False
Public Sub GetIndexBoolean(Section As String, Key As String, Index As Int) As Boolean
'Returns a int value from Ini file at specified Section and Key
'If value not found, returns NotFoundReturnValue
Public Sub GetInt(Section As String, Key As String, NotFoundReturnValue As Int) As Int
'Returns a int value indexed by Index from Ini file at specified Section and Key
'Value of Key in Ini file must be a standard list in format KeyName = { 1, 2, 3 }
'List can be a mixed list like KeyName = { , 1, two, 3.0, false }
'Index is zero based and must be in 0 > Index > List.Size - 1 range. Index out of range returns NotFoundReturnValue
'If value not found, returns NotFoundReturnValue
Public Sub GetIndexInt(Section As String, Key As String, Index As Int, NotFoundReturnValue As Int) As Int
'Returns a double value from Ini file at specified Section and Key
'If value not found, returns NotFoundReturnValue
Public Sub GetDouble(Section As String, Key As String, NotFoundReturnValue As Double) As Double
'Returns a double value indexed by Index from Ini file at specified Section and Key
'Value of Key in Ini file must be a standard list in format KeyName = { 1, 2, 3 }
'List can be a mixed list like KeyName = { , 1, two, 3.0, false }
'Index is zero based and must be in 0 > Index > List.Size - 1 range. Index out of range returns NotFoundReturnValue
'If value not found, returns NotFoundReturnValue
Public Sub GetIndexDouble(Section As String, Key As String, Index As Int, NotFoundReturnValue As Double) As Double
'Returns a float value from Ini file at specified Section and Key
'If value not found, returns NotFoundReturnValue
Public Sub GetFloat(Section As String, Key As String, NotFoundReturnValue As Float) As Float
'Returns a float value indexed by Index from Ini file at specified Section and Key
'Value of Key in Ini file must be a standard list in format KeyName = { 1, 2, 3 }
'List can be a mixed list like KeyName = { , 1, two, 3.0, false }
'Index is zero based and must be in 0 > Index > List.Size - 1 range. Index out of range returns NotFoundReturnValue
'If value not found, returns NotFoundReturnValue
Public Sub GetIndexFloat(Section As String, Key As String, Index As Int, NotFoundReturnValue As Float) As Float
'Checks if Value is contained in list object from Ini file at specified Section and Key
'Returns the index of value in list if found, else returns -1
Public Sub IsIn(Section As String, Key As String, Value As String) As Int
any criticism, advice or suggestion is welcome!
(any donation is welcome too!) :sign0161:
happy coding!