importzugferdfiles: fix conversion error
This commit is contained in:
parent
15c33b843e
commit
2e19d878e0
@ -288,12 +288,16 @@ Public Class ImportZUGFeRDFiles
|
||||
ToDictionary(Function(Item) Item.Key,
|
||||
Function(Item) Item.Value)
|
||||
|
||||
_logger.Debug("Found {0} default properties.", oDefaultProperties.Count)
|
||||
|
||||
' PropertyMap items with `IsGrouped = True` are grouped by group scope
|
||||
Dim oGroupedProperties = args.PropertyMap.
|
||||
Where(Function(Item) Item.Value.IsGrouped = True).
|
||||
ToLookup(Function(Item) Item.Value.GroupScope, ' Lookup key is group scope
|
||||
Function(Item) Item)
|
||||
|
||||
_logger.Debug("Found {0} properties grouped in {1} group(s)", args.PropertyMap.Count - oDefaultProperties.Count, oGroupedProperties.Count)
|
||||
|
||||
' Iterate through groups to get group scope and group items
|
||||
For Each oGroup In oGroupedProperties
|
||||
Dim oGroupScope = oGroup.Key
|
||||
@ -355,7 +359,10 @@ Public Class ImportZUGFeRDFiles
|
||||
|
||||
' Iterate through default properties
|
||||
For Each Item As KeyValuePair(Of String, XmlItemProperty) In oDefaultProperties
|
||||
Dim oPropertyValue As String = PropertyValues.GetPropValue(oDocument, Item.Key)
|
||||
Dim oPropertyValueList As List(Of Object) = PropertyValues.GetPropValue(oDocument, Item.Key)
|
||||
Dim oPropertyValue = oPropertyValueList.
|
||||
DefaultIfEmpty(New List(Of Object) From {Nothing}).
|
||||
First()
|
||||
Dim oPropertyDescription As String = Item.Value.Description
|
||||
|
||||
If String.IsNullOrEmpty(oPropertyValue) Then
|
||||
|
||||
@ -6,18 +6,7 @@ Public Class PropertyValues
|
||||
Private Shared _indexPattern = "\((\d+)\)"
|
||||
Private Shared _indexRegex As New Regex(_indexPattern)
|
||||
|
||||
Public Shared Function GetPropValues(Obj As Object, PropertyName As String)
|
||||
Dim oResult As Object = GetPropValue(Obj, PropertyName)
|
||||
|
||||
' Wrap the result of `GetPropValue` in a list if a single Value is returned
|
||||
If TypeOf oResult Is List(Of Object) Then
|
||||
Return oResult
|
||||
Else
|
||||
Return New List(Of Object) From {oResult}
|
||||
End If
|
||||
End Function
|
||||
|
||||
Public Shared Function GetPropValue(Obj As Object, PropertyName As String)
|
||||
Public Shared Function GetPropValue(Obj As Object, PropertyName As String) As List(Of Object)
|
||||
Dim oNameParts As String() = PropertyName.Split("."c)
|
||||
|
||||
If IsNothing(Obj) Then
|
||||
@ -78,7 +67,7 @@ Public Class PropertyValues
|
||||
End If
|
||||
Next
|
||||
|
||||
Return Obj
|
||||
Return New List(Of Object) From {Obj}
|
||||
End Function
|
||||
|
||||
Private Shared Function GetIndex(Prop As String) As Integer
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user