<?xml version="1.0"?>
<component>

<registration
	description="GetIniFunctions"
	progid="GetIniFunctions.WSC"
	version="1.00"
	classid="{08ec2e91-7810-41e7-ab84-7e343f0bad83}"
>
</registration>

<public>
	<method name="GetIniLineOptionValue">
		<PARAMETER name="strLine"/>
	</method>
	<method name="GetIniSectionOptionValue">
		<PARAMETER name="SectionNameOfIni"/>
		<PARAMETER name="OptionName"/>
		<PARAMETER name="ScriptPath"/>
	</method>
</public>

<script language="VBScript">
<![CDATA[

'Global Values:
Dim OptionValue, OptionName

function GetIniLineOptionValue(strLine)
Dim  CurrentSymbol
Set TrimObj = CreateObject("MyTrimFunctions.WSC") 
 LengthOfLine = Len(strLine)
 EqualPosition = 1
 i=2
If LengthOfLine>3 Then
 CurrentSymbol = Left(strLine,1)
 Do While CurrentSymbol <> "=" AND i <= LengthOfLine
  CurrentSymbol = Mid(strLine,i,1)
  EqualPosition = i
  i = i+1
  
 Loop
 If EqualPosition<LengthOfLine AND EqualPosition>1 Then
  OptionName = TrimObj.MyLRTrim(Left(strLine,EqualPosition-1))
  OptionValue = TrimObj.MyLRTrim(Right(strLine,(LengthOfLine-(EqualPosition))))
  If  OptionValue = "" Then
  OptionValue = "OptionFalse" 
  End If
  GetIniLineOptionValue = 1
 Else 
  GetIniLineOptionValue = 0
 End If
End If
end function

function GetIniSectionOptionValue(SectionNameOfIni, OptionNameToGet, ScriptFolderPath)

Dim CurrentString, filesys, readfile, folder
Set TrimObj = CreateObject("MyTrimFunctions.WSC")  
Set filesys = CreateObject("Scripting.FileSystemObject") 
Set readfile = filesys.OpenTextFile(ScriptFolderPath&"\Video\stream.ini", 1, false)
GetIniSectionOptionValue = "SectionFalse" 
Do While readfile.AtEndOfStream <> TRUE

CurrentString = TrimObj.MyLRTrim(readfile.ReadLine)
If Left(CurrentString,1)="[" AND CurrentString = SectionNameOfIni Then
GetIniSectionOptionValue = "OptionFalse"
 If readfile.AtEndOfStream = FALSE AND OptionNameToGet <> "False" Then
  CurrentString = readfile.ReadLine
  Do While Left(CurrentString,1) <> "[" 
   Select Case SectionNameOfIni
   Case "[LocalUsersAndGroupsToCreate]"
    If GetIniLineOptionValue(CurrentString)=1 AND OptionName = OptionNameToGet Then    
     GetIniSectionOptionValue = OptionValue
    End If 
   Case "[UsingSchedule]"
    If GetIniLineOptionValue(CurrentString)=1 AND OptionName = OptionNameToGet Then    
     GetIniSectionOptionValue = OptionValue
    End If 
   Case "[ArchiveScriptPaths]"
    If GetIniLineOptionValue(CurrentString)=1 AND OptionName = OptionNameToGet Then 
     GetIniSectionOptionValue = OptionValue
    End If	
   Case "[LocalUsersAndGroupsToCreate]"
    If GetIniLineOptionValue(CurrentString)=1 AND OptionName = OptionNameToGet  Then    
     GetIniSectionOptionValue = OptionValue
    End If
   Case "[PathsForShortCuts]"
    If GetIniLineOptionValue(CurrentString)=1 AND OptionName = OptionNameToGet Then 
     GetIniSectionOptionValue = OptionValue
    End If
   Case Else
    GetIniLineOptionValue(CurrentString)
    If GetIniLineOptionValue(CurrentString)=1 AND OptionName = OptionNameToGet Then 
     'MsgBox("OptionName:"&OptionName )
     GetIniSectionOptionValue = OptionValue
    End If
   End Select 
   If readfile.AtEndOfStream = FALSE Then
    CurrentString = readfile.ReadLine	
   Else
    CurrentString="[" 
   End If
  Loop
 End If
End If

Loop

end function

]]>
</script>

</component>
