Validates and loads a member lists file that is in the LST format. A flag determines whether SetVBScriptMemberListRules loads after validation or validates without loading.
SetVBScriptMemberListRules returns arrays that contain the line numbers, severity levels, descriptions, contents, and details of the lines in a member lists file that do not pass validation. These arrays have a one-to-one correspondence, with one item for each line that does not pass validation.
<HsvSystemInfo>.SetVBScriptMemberListRules varabRules, vbScanOnly, pvbErrorsWereFound, pvbWarningsWereFound, pvbInfoWasProvided, pvaralErrorLineNumbers, pvaralErrorSeverity, pvarabstrErrorDescriptions, pvarabstrErrorVBScript, pvarabstrErrorDetails
The following example creates a log file that lists the line numbers, descriptions, and details for any validation messages of an error level. Various Visual Basic methods convert the rules file to a Variant array of bytes, which is then passed to SetVBScriptMemberListRules; note that SetVBScriptMemberListRules is set to validate without loading. If the pvbErrorsWereFound argument returns TRUE, the example loops through the pvaralErrorSeverity argument’s array to find items flagged with an error severity level. For each such item, the corresponding items returned in the pvaralErrorLineNumbers, pvarabstrErrorDescriptions, and pvarabstrErrorDetails arguments are concatenated to the vLogText variable. vLogText’s value is then written to the log file, which is created with various Visual Basic methods.
Dim cSysInfo As HsvSystemInfo, vFileName, lFile As Long
Dim lSize As Long, vaRules, bytaRules() As Byte
Dim bErrs As Boolean, bWarnings As Boolean, bInfo As Boolean
Dim valLines, valSeverity, vasDescs, vasErr, vasDetails
Dim vLogText, iFile As Integer
'm_cHsvSession is an HsvSession object reference
Set cSysInfo = m_cHsvSession.SystemInfo
vFileName = "C:\Program Files\Acme\AppMemLists.lst"
lFile = FreeFile
lSize = FileLen(vFileName)
Open vFileName For Binary Access Read As #lFile
ReDim bytaRules(lSize)
Get #lFile, , bytaRules
Close #lFile
vaRules = bytaRules
cSysInfo.SetVBScriptMemberListRules vaRules, True, bErrs, _
bWarnings, bInfo, valLines, valSeverity, vasDescs, _
vasErr, vasDetails
If bErrs = True Then
For i = LBound(valLines) To UBound(valLines)
If valSeverity(i) = 1 Then
vLogText = vLogText & "Line #: " & valLines(i) & _
vbCrLf & " Description: " & vasDescs(i) & vbCrLf _
& " Details: " & vasDetails(i) & vbCrLf & vbCrLf
End If
Next i
iFile = FreeFile
Open "C:\Program Files\Acme\listErrors.log" For Output _
As #iFile
Print #iFile, vLogText
Close #iFile
End If