flatten grouped results, add try..catch blocks at crititcal places

This commit is contained in:
Jonathan Jenne
2019-06-18 13:55:52 +02:00
parent 8127760eff
commit 617315667c
2 changed files with 76 additions and 27 deletions

View File

@@ -1,4 +1,5 @@
Imports System.Collections.Generic
Imports System.Linq
Imports System.Reflection
Imports System.Text.RegularExpressions
Imports DigitalData.Modules.Logging
@@ -87,6 +88,38 @@ Public Class PropertyValues
Return New List(Of Object) From {Obj}
End Function
Public Function GetFinalPropValue(List As List(Of Object)) As List(Of Object)
Dim oResult As New List(Of Object)
For Each Item In List
Dim oItemValue = DoGetFinalPropValue(Item)
If Not IsNothing(oItemValue) Then
oResult.Add(oItemValue)
End If
Next
Return oResult
End Function
Private Function DoGetFinalPropValue(Value As Object) As String
If TypeOf Value Is List(Of Object) Then
Dim oList = DirectCast(Value, List(Of Object))
Dim oCount = oList.Count
Select Case oCount
Case 0
Return Nothing
Case Else
Return DoGetFinalPropValue(oList.First())
End Select
Return DoGetFinalPropValue(Value)
Else
Return Value.ToString
End If
End Function
Private Function GetIndex(Prop As String) As Integer
If Regex.IsMatch(Prop, _indexPattern) Then
Dim oMatch = _indexRegex.Match(Prop)