Const TimeZoneParameterName As String = "TimeZone"
Const SD_BaseTypeParameterName As String = "StartDate_BaseType"
Const SD_BaseValueParameterName As String = "StartDate_BaseValue"
Const SD_OffsetTypeParameterName As String = "StartDate_OffsetType"
Const SD_OffsetValueParameterName As String = "StartDate_OffsetValue"
Const ED_BaseTypeParameterName As String = "EndDate_BaseType"
Const ED_BaseValueParameterName As String = "EndDate_BaseValue"
Const ED_OffsetTypeParameterName As String = "EndDate_OffsetType"
Const ED_OffsetValueParameterName As String = "EndDate_OffsetValue"
Const IsRelativeTimeSupported As Boolean = True
Const TimeTypeParameterName As String = "TimeType"
Const TimeWeekMapParameterName As String = "TimeWeekMap"
Const DataAggregationParameterName As String = "DataAggregation"
Const TD_BaseValueParameterName As String = "EndDateTrend_BaseValue"
Dim LocTables As System.Collections.Generic.Dictionary(Of String, Microsoft.EnterpriseManagement.Reporting.XmlStringTable)
Dim ReportTimeZone As Microsoft.EnterpriseManagement.Reporting.TimeZoneCoreInformation
Dim ReportStartDate As DateTime
Dim ReportEndDate As DateTime
Dim ReportEndDateTrend1 as DateTime
Dim ReportEndDateTrend2 as DateTime
Dim ReportTime As Microsoft.EnterpriseManagement.Reporting.ParameterProcessor.RelativeTime
Dim ReportCulture As System.Globalization.CultureInfo
Dim ParameterProcessor As Microsoft.EnterpriseManagement.Reporting.ParameterProcessor
Protected Overrides Sub OnInit()
LocTables = new System.Collections.Generic.Dictionary(Of String, Microsoft.EnterpriseManagement.Reporting.XmlStringTable)()
ReportTimeZone = Nothing
ReportStartDate = DateTime.MinValue
ReportEndDate = DateTime.MinValue
ReportTime = Nothing
ReportCulture = System.Globalization.CultureInfo.GetCultureInfo(Report.User("Language"))
ParameterProcessor = New Microsoft.EnterpriseManagement.Reporting.ParameterProcessor(ReportCulture)
End Sub
'''''''''''''''''''''''''''''''''
'ComTrade aggregate custom code
'''''''''''''''''''''''''''''''''
Public values1 As New System.Collections.ArrayList
Public values2 As New System.Collections.ArrayList
Public values3 As New System.Collections.ArrayList
Public values4 As New System.Collections.ArrayList
Public values5 As New System.Collections.ArrayList
Public values6 As New System.Collections.ArrayList
Public samples1 As New System.Collections.ArrayList
Public samples2 As New System.Collections.ArrayList
Public samples3 As New System.Collections.ArrayList
Public samples4 As New System.Collections.ArrayList
Public samples5 As New System.Collections.ArrayList
Public samples6 As New System.Collections.ArrayList
Function CTInitValues() as Decimal
values1.Clear()
values2.Clear()
values3.Clear()
values4.Clear()
values5.Clear()
values6.Clear()
samples1.Clear()
samples2.Clear()
samples3.Clear()
samples4.Clear()
samples5.Clear()
samples6.Clear()
CTInitValues = 0.0
End Function
Function CTAddValue(newValue As Object, newSamples as Object, index as Integer) As Object
Dim values
Dim samples
If index = 1 Then
values = values1
samples = samples1
ElseIf index = 2 Then
values = values2
samples = samples2
ElseIf index = 3 Then
values = values3
samples = samples3
ElseIf index = 4 Then
values = values4
samples = samples4
ElseIf index = 5 Then
values = values5
samples = samples5
Else
values = values6
samples = samples6
End If
values.Add(newValue)
samples.Add(newSamples)
CTAddValue = newValue
End Function
Function CTGetAvgOfValues(index as Integer) As Decimal
Dim values
Dim samples
If index = 1 Then
values = values1
samples = samples1
ElseIf index = 2 Then
values = values2
samples = samples2
ElseIf index = 3 Then
values = values3
samples = samples3
ElseIf index = 4 Then
values = values4
samples = samples4
ElseIf index = 5 Then
values = values5
samples = samples5
Else
values = values6
samples = samples6
End If
Dim sumValues
Dim cnt
Dim OneItemAvg
cnt = 0
sumValues = 0
For Each OneItemAvg in values
If OneItemAvg is Nothing Then
'do nothing with NULL
Else
cnt = cnt + 1
sumValues = sumValues + OneItemAvg
End If
Next
If cnt > 0 Then
CTGetAvgOfValues = (sumValues / cnt) * 1.0
Else
CTGetAvgOfValues = 0.0
End If
End Function
''''''''''''''''''''''''''''''''''
' down time functions
''''''''''''''''''''''''''''''''''
Const DownTimeParameterName As String = "DownTime"
Dim DownTimeTable As System.Collections.Generic.List(Of Integer)
Public Enum StateIntervalType
Red = 0
Green = 1
Yellow = 2
White = 3
Gray = 4
Black = 5
Blue = 6
ServiceGray = 7
End Enum
Public Function IsDownTime(time As StateIntervalType)
Select Case time
Case StateIntervalType.Red
Return True
Case StateIntervalType.Green
Return False
Case Else
If IsNothing(DownTimeTable) Then
DownTimeTable = New System.Collections.Generic.List(Of Integer)()
Dim val As String
For Each val in Report.Parameters(DownTimeParameterName).Value
DownTimeTable.Add(CInt(val))
Next
End If
Return DownTimeTable.Contains(CInt(time))
End Select
End Function
Public Function FormatTimeInterval(ByVal TimeInSeconds As Integer) As String
Dim Hours, Minutes, Seconds As Integer
Hours = Math.Floor(TimeInSeconds / 3600)
Minutes = Math.Floor((TimeInSeconds Mod 3600) / 60)
Seconds = TimeInSeconds Mod 60
Return FormatString("{0}:{1}:{2}", Hours.ToString(), Minutes.ToString("00"), Seconds.ToString("00"))
End Function
Public Function FormatChartLabel(ByVal LabelValue As Double, ByVal FormatCode As String, ByVal LowThreshold As Double, ByVal HighThreshold As Double, ByVal PointsCount As Double, ByVal PointsThreshold As Double) As String
Dim Result As String
If ((PointsCount <= PointsThreshold) And ((LowThreshold < 0) Or (LabelValue > LowThreshold)) And ((HighThreshold < 0) Or (LabelValue < HighThreshold))) Then
Result = LabelValue.ToString(FormatCode, ReportCulture)
Else
Result = String.Empty
End If
Return Result
End Function
Public Function GetYAxisLabel() As String
return Report.Parameters(YAxis_Label).Value
End Function
Public Function GetReportName() As String
return Report.Parameters(ReportName).Value
End Function
Public Function GetReportDescription() As String
return Report.Parameters(ReportDescription).Value
End Function
Public Function GetCallingManagementGroupId() As String
Return Microsoft.EnterpriseManagement.Reporting.ReportingConfiguration.ManagementGroupId
End Function
Public Function GetReportLocLanguageCode() As String
Return ReportCulture.ThreeLetterWindowsLanguageName
End Function
Public Function GetLocTable(Name As String) As Microsoft.EnterpriseManagement.Reporting.XmlStringTable
Dim LocTable As Microsoft.EnterpriseManagement.Reporting.XmlStringTable
If Not LocTables.TryGetValue(Name, LocTable) Then
LocTable = New Microsoft.EnterpriseManagement.Reporting.XmlStringTable(LocTableStringQuery, Report.Parameters(Name).Value)
LocTables.Add(Name, LocTable)
End If
Return LocTable
End Function
'''''''''''''''''''''''''''''''''''
'' ComTrade Functions
'''''''''''''''''''''''''''''''''''
Public Function GetDistinctValuesAsString(parameter As Object) As String
Dim exitString
exitString = ""
Dim items As Object() = parameter
System.Array.Sort(items)
Dim k As Integer = 0
For i As Integer = 0 To items.Length - 1
If i > 0 AndAlso items(i).Equals(items(i - 1)) Then
Continue For
End If
items(k) = items(i)
exitString = exitString + ", " + items(k)
k += 1
Next
Dim unique As [String]() = New [String](k - 1) {}
System.Array.Copy(items, 0, unique, 0, k)
'Return unique
Return exitString
End Function
Public Function GetReportTimeZone() As Microsoft.EnterpriseManagement.Reporting.TimeZoneCoreInformation
If IsNothing(ReportTimeZone) Then ReportTimeZone = Microsoft.EnterpriseManagement.Reporting.TimeZoneCoreInformation.FromValueString(Report.Parameters(TimeZoneParameterName).Value)
Return ReportTimeZone
End Function
Public Function ToDbDate(ByVal DateValue As DateTime) As DateTime
return GetReportTimeZone.ToUniversalTime(DateValue)
End Function
Public Function ToReportDate(ByVal DateValue As DateTime) As DateTime
return GetReportTimeZone.ToLocalTime(DateValue)
End Function
Public Function DisplayDate(ByVal DateValue As DateTime) as DateTime
return DateValue
End Function
Public Function IsNull(InValue, DefaultValue) as Double
return InValue
'if InValue IS System.DBNull.value then
' return InValue
'else
' return DefaultValue
'end if
End Function
Public Function Comtrade_isBusinessDay(DayOfWeek as Integer) As Integer
If DayOfWeek = 1 Then
return HLS_searchTimeWeekMap("Monday")
Else If DayOfWeek = 2 Then
return HLS_searchTimeWeekMap("Tuesday")
Else If DayOfWeek = 3 Then
return HLS_searchTimeWeekMap("Wednesday")
Else If DayOfWeek = 4 Then
return HLS_searchTimeWeekMap("Thursday")
Else If DayOfWeek = 5 Then
return HLS_searchTimeWeekMap("Friday")
Else If DayOfWeek = 6 Then
return HLS_searchTimeWeekMap("Saturday")
Else If DayOfWeek = 7 Then
return HLS_searchTimeWeekMap("Sunday")
Else
return -1
End If
End Function
Private Function HLS_searchTimeWeekMap(ss as String) as Integer
For Each vrstica As System.Object In Report.Parameters(TimeWeekMapParameterName).Value
If UCase(vrstica) = UCase(ss) Then
return 1
End If
Next
return 0
End Function
Public Function Comtrade_isBusinessTimeType() As Integer
If Report.Parameters(TimeTypeParameterName).Value = "Business" Then
return 1
Else
return 0
End If
End Function
Public Function Comtrade_IsBusinessHoursType() As Boolean
If Comtrade_isBusinessTimeType() = 1 Then
Return True
Else
Return False
End If
End Function
Public Function GetReportStartDate2() As DateTime
ReportStartDate = Convert.ToDateTime(Report.Parameters(SD_BaseValueParameterName).Value)
return ReportStartDate
End Function
Public Function GetReportEndDate2() As DateTime
ReportEndDate = Convert.ToDateTime(Report.Parameters(ED_BaseValueParameterName).Value)
return ReportEndDate
End Function
Public Function GetReportEndDateTrend() As DateTime
ReportEndDateTrend1 = Convert.ToDateTime(Report.Parameters(TD_BaseValueParameterName).Value)
ReportEndDateTrend2 = Convert.ToDateTime(Report.Parameters(ED_BaseValueParameterName).Value)
if ReportEndDateTrend1 > ReportEndDateTrend2
return ReportEndDateTrend1
else
return ReportEndDateTrend2
end if
End Function
Public Function GetReportStartDate() As DateTime
If (ReportStartDate = DateTime.MinValue) Then
If (IsRelativeTimeSupported) Then
ReportStartDate = ParameterProcessor.GetDateTime(ToReportDate(DateTime.UtcNow), Report.Parameters(SD_BaseTypeParameterName).Value, Report.Parameters(SD_BaseValueParameterName).Value, Report.Parameters(SD_OffsetTypeParameterName).Value, Report.Parameters(SD_OffsetValueParameterName).Value, Report.Parameters(TimeTypeParameterName).Value)
Else
ReportStartDate = ParameterProcessor.GetDateTime(ToReportDate(DateTime.UtcNow), Report.Parameters(SD_BaseTypeParameterName).Value, Report.Parameters(SD_BaseValueParameterName).Value, Report.Parameters(SD_OffsetTypeParameterName).Value, Report.Parameters(SD_OffsetValueParameterName).Value)
End if
'If (CInt(Report.Parameters(DataAggregationParameterName).Value) > 0) Then
'ReportStartDate = ReportStartDate.Date
'End If
End If
return ReportStartDate
End Function
'do not use business hour conversion, we need busines hours in SQL QUERY
Public Function GetReportStartDate2DB() As DateTime
If (ReportStartDate = DateTime.MinValue) Then
If False Then 'If (IsRelativeTimeSupported) Then
ReportStartDate = ParameterProcessor.GetDateTime(ToReportDate(DateTime.UtcNow), Report.Parameters(SD_BaseTypeParameterName).Value, Report.Parameters(SD_BaseValueParameterName).Value, Report.Parameters(SD_OffsetTypeParameterName).Value, Report.Parameters(SD_OffsetValueParameterName).Value, Report.Parameters(TimeTypeParameterName).Value)
Else
ReportStartDate = ParameterProcessor.GetDateTime(ToReportDate(DateTime.UtcNow), Report.Parameters(SD_BaseTypeParameterName).Value, Report.Parameters(SD_BaseValueParameterName).Value, Report.Parameters(SD_OffsetTypeParameterName).Value, Report.Parameters(SD_OffsetValueParameterName).Value)
End if
End If
return ReportStartDate
End Function
'do not use business hour conversion, we need busines hours in SQL QUERY
Public Function GetReportEndDate2DB() As DateTime
If (ReportEndDate = DateTime.MinValue) Then
If False Then 'If (IsRelativeTimeSupported) Then
ReportEndDate = ParameterProcessor.GetDateTime(ToReportDate(DateTime.UtcNow), Report.Parameters(ED_BaseTypeParameterName).Value, Report.Parameters(ED_BaseValueParameterName).Value, Report.Parameters(ED_OffsetTypeParameterName).Value, Report.Parameters(ED_OffsetValueParameterName).Value, Report.Parameters(TimeTypeParameterName).Value)
If IsBusinessHours(GetReportTimeFilter()) Then ReportEndDate = ReportCulture.Calendar.AddDays(ReportEndDate, 1)
Else
ReportEndDate = ParameterProcessor.GetDateTime(ToReportDate(DateTime.UtcNow), Report.Parameters(ED_BaseTypeParameterName).Value, Report.Parameters(ED_BaseValueParameterName).Value, Report.Parameters(ED_OffsetTypeParameterName).Value, Report.Parameters(ED_OffsetValueParameterName).Value)
End if
End If
return ReportEndDate
End Function
Public Function GetReportEndDate() As DateTime
If (ReportEndDate = DateTime.MinValue) Then
If (IsRelativeTimeSupported) Then
ReportEndDate = ParameterProcessor.GetDateTime(ToReportDate(DateTime.UtcNow), Report.Parameters(ED_BaseTypeParameterName).Value, Report.Parameters(ED_BaseValueParameterName).Value, Report.Parameters(ED_OffsetTypeParameterName).Value, Report.Parameters(ED_OffsetValueParameterName).Value, Report.Parameters(TimeTypeParameterName).Value)
'If IsBusinessHours(GetReportTimeFilter()) Then ReportEndDate = ReportCulture.Calendar.AddDays(ReportEndDate, 1)
Else
ReportEndDate = ParameterProcessor.GetDateTime(ToReportDate(DateTime.UtcNow), Report.Parameters(ED_BaseTypeParameterName).Value, Report.Parameters(ED_BaseValueParameterName).Value, Report.Parameters(ED_OffsetTypeParameterName).Value, Report.Parameters(ED_OffsetValueParameterName).Value)
End if
'If (CInt(Report.Parameters(DataAggregationParameterName).Value) > 0) Then
'ReportEndDate = ReportEndDate.Date
'End If
End If
return ReportEndDate
End Function
Public Function GetReportTimeFilter2() As Microsoft.EnterpriseManagement.Reporting.ParameterProcessor.RelativeTime
ReportTime = New Microsoft.EnterpriseManagement.Reporting.ParameterProcessor.RelativeTime(Report.Parameters(TimeTypeParameterName).Value, Report.Parameters(SD_BaseValueParameterName).Value, Report.Parameters(ED_BaseValueParameterName).Value, CStr(Join(Report.Parameters(TimeWeekMapParameterName).Value, ",")))
return ReportTime
End Function
Public Function GetReportTimeFilter() As Microsoft.EnterpriseManagement.Reporting.ParameterProcessor.RelativeTime
If IsNothing(ReportTime) Then
If (CInt(Report.Parameters(DataAggregationParameterName).Value) = 0)
ReportTime = New Microsoft.EnterpriseManagement.Reporting.ParameterProcessor.RelativeTime(Report.Parameters(TimeTypeParameterName).Value, Report.Parameters(SD_BaseValueParameterName).Value, Report.Parameters(ED_BaseValueParameterName).Value, CStr(Join(Report.Parameters(TimeWeekMapParameterName).Value, ",")))
Else
ReportTime = New Microsoft.EnterpriseManagement.Reporting.ParameterProcessor.RelativeTime(Microsoft.EnterpriseManagement.Reporting.ParameterProcessor.RelativeTimeType.Regular, Report.Parameters(SD_BaseValueParameterName).Value, Report.Parameters(ED_BaseValueParameterName).Value, CStr(Join(Report.Parameters(TimeWeekMapParameterName).Value, ",")))
End if
End If
return ReportTime
End Function
Public Function IsBusinessHours(Value As Microsoft.EnterpriseManagement.Reporting.ParameterProcessor.RelativeTime) As Boolean
return (Not IsNothing(Value)) And (Value.TimeType = Microsoft.EnterpriseManagement.Reporting.ParameterProcessor.RelativeTimeType.Business)
End Function
Public Function FormatDateTime(Format As String, Value As DateTime) As String
return Value.ToString(Format, ReportCulture)
End Function
Public Function FormatNumber(Format As String, Value As Decimal) As String
if IsDBNull(Value) then
return "-"
else
return Value.ToString(Format, ReportCulture)
end if
End Function
Public Function FormatString(Format As String, ParamArray Values() as Object) As String
return String.Format(ReportCulture, Format, Values)
End Function
Public Function NullFormatString(Format As String, Value as String) As String
return IIF(String.IsNullOrEmpty(Value), String.Empty, String.Format(ReportCulture, Format, Value))
End Function
Public Function GetDrilledObjectTypesPathVector(ObjPath As String, DrilledObj As String) As String
Dim found, a, x
Dim newObjPath
newObjPath = ""
found = False
a = Split(ObjPath, ",")
For Each x In a
If found Then
newObjPath = newObjPath + "," + x
End If
If x = DrilledObj And found = False Then
found = True
newObjPath = DrilledObj
End If
Next
return newObjPath
End Function
Public Function GetNextDrilledDownObjectTypes(DrilledObjVector As String)
Dim found
Dim newObjPath
Dim a, x
newObjPath = ""
found = False
a = Split(DrilledObjVector, ",")
For Each x In a
If found Then
If newObjPath = "" Then
newObjPath = newObjPath + x
Else
newObjPath = newObjPath + "," + x
End If
End If
'skip the first one
If found = False Then
found = True
End If
Next
return newObjPath
End Function
Public Function GetCurrentDrilledDownObjectType(DrilledObjVector As String)
Dim found
Dim newObjPath
Dim a, x
newObjPath = ""
found = False
a = Split(DrilledObjVector, ",")
For Each x In a
'skip the first one
If found = False Then
found = True
newObjPath = newObjPath + x
End If
Next
return newObjPath
End Function
Public Function FormatBusinessHours2(Format As String, Value As Microsoft.EnterpriseManagement.Reporting.ParameterProcessor.RelativeTime) As String
Dim result As String
If Comtrade_isBusinessTimeType = 1 Then
Dim firstDay As DayOfWeek
Dim days As System.Collections.Generic.List(Of String)
firstDay = ReportCulture.DateTimeFormat.FirstDayOfWeek
days = new System.Collections.Generic.List(Of String)()
For loopDay As DayOfWeek = DayOfWeek.Sunday To DayOfWeek.Saturday
Dim day As DayOfWeek
day = CType((CInt(loopDay) + CInt(firstDay)) Mod 7, DayOfWeek)
If value.WeekMap.Contains(day) Then days.Add(ReportCulture.DateTimeFormat.GetAbbreviatedDayName(day))
Next loopDay
result = FormatString(Format, DateTime.Today.Add(Value.StartTime).ToString(ReportCulture.DateTimeFormat.ShortTimePattern), DateTime.Today.Add(Value.EndTime).ToString(ReportCulture.DateTimeFormat.ShortTimePattern), String.Join(",", days.ToArray()))
Else
result = String.Empty
End if
return result
End Function
Public Function FormatBusinessHours(Format As String, Value As Microsoft.EnterpriseManagement.Reporting.ParameterProcessor.RelativeTime) As String
Dim result As String
If IsBusinessHours(Value) Then
Dim firstDay As DayOfWeek
Dim days As System.Collections.Generic.List(Of String)
firstDay = ReportCulture.DateTimeFormat.FirstDayOfWeek
days = new System.Collections.Generic.List(Of String)()
For loopDay As DayOfWeek = DayOfWeek.Sunday To DayOfWeek.Saturday
Dim day As DayOfWeek
day = CType((CInt(loopDay) + CInt(firstDay)) Mod 7, DayOfWeek)
If value.WeekMap.Contains(day) Then days.Add(ReportCulture.DateTimeFormat.GetAbbreviatedDayName(day))
Next loopDay
result = FormatString(Format, DateTime.Today.Add(Value.StartTime).ToString(ReportCulture.DateTimeFormat.ShortTimePattern), DateTime.Today.Add(Value.EndTime).ToString(ReportCulture.DateTimeFormat.ShortTimePattern), String.Join(",", days.ToArray()))
Else
result = String.Empty
End if
return result
End Function
Public Function BuildXmlValueList(ByVal ValueList() As Object) As String
Return Microsoft.EnterpriseManagement.Reporting.MultiValueParameter.ToXml("Data", "Value", ValueList)
End Function
REM ----------------------------------------
Public Enum DataAggregationType
Hourly = 0
Daily = 1
End Enum
Public Enum AggregationType
None = 0
Daily = 1
Weekly = 2
Monthly = 3
Yearly = 4
End Enum
Public Function FormatAggregatedTimeValue(ByVal TimeValue As DateTime, ByVal AggType As AggregationType, ByVal DataAggType As DataAggregationType) As Long
Dim Result As Long
Select Case (AggType)
Case AggregationType.Daily
If DataAggType = DataAggregationType.Daily Then
Result = TimeValue.Ticks
Else
Result = TimeValue.Hour
End If
Case AggregationType.Weekly
Result = CInt(TimeValue.DayOfWeek)
Case AggregationType.Monthly
Result = TimeValue.Day
Case AggregationType.Yearly
Result = TimeValue.Month
Case Else
Result = TimeValue.Ticks
End Select
Return Result
End Function
Public Function FormatAggregatedTimeValueLabel2(ByVal TimeValue As DateTime, DataAggType As Integer) As String
Dim Result As String
Select Case (DataAggType)
Case 0
Result = TimeValue.ToString("G", ReportCulture)
Case 1
Result = TimeValue.ToString("d", ReportCulture)
Case 2
Result = TimeValue.ToString("MMMM yyyy", ReportCulture)
Case 3
Result = TimeValue.ToString("yyyy", ReportCulture)
Case Else
Result = TimeValue.ToString("G", ReportCulture)
'Case AggregationType.Weekly
' Result = ReportCulture.DateTimeFormat.GetDayName(TimeValue.DayOfWeek)
'Case AggregationType.Yearly
' Result = ReportCulture.DateTimeFormat.GetMonthName(TimeValue.Month)
End Select
Return Result
End Function
Public Function FormatAggregatedTimeValueLabel(ByVal TimeValue As DateTime, ByVal AggType As AggregationType, ByVal DataAggType As DataAggregationType) As String
Dim Result As String
Select Case (AggType)
Case AggregationType.Daily
If DataAggType = DataAggregationType.Daily Then
Result = TimeValue.ToString("d", ReportCulture)
Else
Result = TimeValue.ToString("t", ReportCulture)
End If
Case AggregationType.Weekly
Result = ReportCulture.DateTimeFormat.GetDayName(TimeValue.DayOfWeek)
Case AggregationType.Monthly
Result = TimeValue.Day.ToString()
Case AggregationType.Yearly
Result = ReportCulture.DateTimeFormat.GetMonthName(TimeValue.Month)
Case Else
If DataAggType = DataAggregationType.Daily Then
Result = TimeValue.ToString("d", ReportCulture)
Else
Result = TimeValue.ToString("G", ReportCulture)
End If
End Select
Return Result
End Function
Public Function Options_SplitByObject(ByVal OptionsXml As String, ByVal ObjectTag As String, ByVal ObjectsXml As String) As String
Dim Xml, ListXml As System.Xml.XmlDocument
Xml = New System.Xml.XmlDocument()
Xml.LoadXml(OptionsXml)
ListXml = New System.Xml.XmlDocument()
ListXml.LoadXml(ObjectsXml)
Dim Format As System.Text.StringBuilder
Format = New System.Text.StringBuilder("<Value><" +ObjectTag+ ">{0}</" +ObjectTag+ ">")
For Each Node As System.Xml.XmlNode In Xml.DocumentElement.ChildNodes
If Node.Name <> ObjectTag Then Format.Append(Node.OuterXml)
Next
Format.Append("</Value>")
Dim Result As System.Text.StringBuilder
Result = New System.Text.StringBuilder()
For Each ObjectNode As System.Xml.XmlNode In ListXml.DocumentElement.ChildNodes
Result.Append(String.Format(Format.ToString(), ObjectNode.InnerText))
Next
Return Result.ToString()
End Function
Public Function Options_GetObjectList(ByVal OptionsXml As String) As String()
Dim Xml As System.Xml.XmlDocument
Xml = New System.Xml.XmlDocument()
Xml.LoadXml(OptionsXml)
Dim Result As System.Collections.Generic.List(Of String)
Result = New System.Collections.Generic.List(Of String)
For Each ObjectNode As System.Xml.XmlNode In Xml.SelectNodes("/Value/Object")
Result.Add(ObjectNode.InnerText)
Next
Return Result.ToArray()
End Function
REM ----------------------------------------
Public Dim CurrentObjectList As String
Public Dim CurrentInstanceList As String
Public Function InitList(ByRef List As String) As String
List = String.Empty
Return List
End Function
Public Function AddListItem(ByRef List As String, Item as String) As String
List = List + Item
Return List
End Function