func Init fvar(old, classpath) var(id) id = ini_ old = block.select(BLK_CLASS) if (sys.gvarfind('ini_is_set') = -1) gvar(ini_is_set) classpath=replace(sys.codedir() & 'classes\clsIni.vbs','\\','\\\\') println(code(file2str(classpath))) end block.select(BLK_GLOB) println('Dim ', id) block.select(BLK_OBJ) println('Set ', id,' = New Ini') block.select(old) end func doRead(_data) println(id, '.Filename = ', Filename) println(id, '.Section = ', Section) println(id, '.Key = ', Key) if(Type) event(onResult, id && '.Value') else event(onResult, 'CInt(' && id && '.Value)') end end func doWrite(_data) println(id, '.Filename = ', Filename) println(id, '.Section = ', Section) println(id, '.Key = ', Key) println(id, '.Value = ', Value) end func doSectionNames(_data) include('regexp') println(id, '.Filename = ', Filename) println('re.Pattern = "\[\w{1,}]"') println('re.IgnoreCase = True') println('re.Global = True') println('Set ', Matches, ' = re.Execute(', id, '.Content())') println('For Each ', Match, ' in ', Matches) block.inclvl() println(res, ' = Mid(', Match, '.Value, 2)') println(res, ' = Left(', res, ', Len(', res, ')-1)') event(onSectionNames, res) block.declvl() println('Next') end func doSectionData(_data) include('regexp') println(id, '.Filename = ', Filename) println('re.Pattern = "\[" & ', Section, ' & "]"') println('re.IgnoreCase = True') println('re.Global = False') println(res, ' = ', id, '.ContentArray()') println('For ', i, '=0 To UBound(', res, ')-1') block.inclvl() println('If re.Test(', res, '(', i, ')) Then Exit For') block.declvl() println('Next') println('For ', j, '=', i, '+1 To UBound(', res, ')-1') block.inclvl() println('re.Pattern = "\[\w{1,}]"') println('If re.Test(', res, '(', j, ')) Then Exit For') println('re.Pattern = "^(;|\s{0,});"') print('If (Not re.Test(', res, '(', j, ')) And Len(Trim(', res, '(', j, ')))) Then ') event(onSectionData, res && '(' && j && ')') block.declvl() println('Next') end func doDeleteKey(_data) include('regexp') println(id, '.Filename = ', Filename) println('re.Pattern = "\[" & ', Section, ' & "]"') println('re.IgnoreCase = True') println('re.Global = False') println(res, ' = ', id, '.ContentArray()') println(buffer, ' = ""') println('For ', i, '=0 To UBound(', res, ')-1') block.inclvl() println(buffer, ' = ', buffer, ' & ', res, '(', i, ') & vbCrLf') println('If re.Test(', res, '(', i, ')) Then Exit For') block.declvl() println('Next') println('For ', j, '=', i, '+1 To UBound(', res, ')-1') block.inclvl() println('re.Pattern = "\[\w{1,}]"') println('If re.Test(', res, '(', j, ')) Then Exit For') println('re.Pattern = "^(;|\s{0,});"') println('If (Not re.Test(', res, '(', j, ')) And Len(Trim(', res, '(', j, ')))) Then') block.inclvl() println('re.Pattern = ', Key) println('If Not re.Test(', res, '(', j, ')) Then') block.inclvl() println(buffer, ' = ', buffer, ' & ', res, '(', j, ') & vbCrLf') block.declvl() println('End If') block.declvl() println('Else') block.inclvl() println(buffer, ' = ', buffer, ' & ', res, '(', j, ') & vbCrLf') block.declvl() println('End If') block.declvl() println('Next') println('For ', i, '=', j, ' To UBound(', res, ')-1') block.inclvl() println(buffer, ' = ', buffer, ' & ', res, '(', i, ') & vbCrLf') block.declvl() println('Next') println(id, '.Content() = ', buffer) end func doEraseSection(_data) include('regexp') println(id, '.Filename = ', Filename) println('re.Pattern = "\[" & ', Section, ' & "]"') println('re.IgnoreCase = True') println('re.Global = False') println(res, ' = ', id, '.ContentArray()') println(buffer, ' = ""') println('For ', i, '=0 To UBound(', res, ')-1') block.inclvl() println('If re.Test(', res, '(', i, ')) Then Exit For') println(buffer, ' = ', buffer, ' & ', res, '(', i, ') & vbCrLf') block.declvl() println('Next') println('For ', j, '=', i, '+1 To UBound(', res, ')-1') block.inclvl() println('re.Pattern = "\[\w{1,}]"') println('If re.Test(', res, '(', j, ')) Then Exit For') println('re.Pattern = "^(;|\s{0,});"') println('If (re.Test(', res, '(', j, ')) Or Len(Trim(', res, '(', j, ')))=0) Then') block.inclvl() println(buffer, ' = ', buffer, ' & ', res, '(', j, ') & vbCrLf') block.declvl() println('End If') block.declvl() println('Next') println('For ', i, '=', j, ' To UBound(', res, ')-1') block.inclvl() println(buffer, ' = ', buffer, ' & ', res, '(', i, ') & vbCrLf') block.declvl() println('Next') println(id, '.Content() = ', buffer) end func doClearAll(_data) println(id, '.Filename = ', Filename) println(id, '.Content() = ""') end