Windream: Add Function GetVectorData

This commit is contained in:
Jonathan Jenne 2021-07-29 16:33:37 +02:00
parent e5b8df7ee8
commit db4457fe3f

View File

@ -893,6 +893,23 @@ Public Class Windream
End Try End Try
End Function End Function
Public Function GetVectorData(FilePath As String, IndexName As String, NewValues As Object, CheckDuplicates As Boolean) As String()
Try
Dim oWMObject = GetFileByPath(FilePath)
Dim oObjectArray As Object() = GetVektorData_Combined(oWMObject, IndexName, NewValues, CheckDuplicates)
Dim oStringArray As New List(Of String)
For Each oObjectValue In oObjectArray
oStringArray.Add(oObjectValue.ToString)
Next
Return oStringArray.ToArray
Catch ex As Exception
_logger.Error(ex)
Return Nothing
End Try
End Function
''' <summary> ''' <summary>
''' Gets an array of the actual vektorvalues of index, collated with the passed values ''' Gets an array of the actual vektorvalues of index, collated with the passed values
''' </summary> ''' </summary>
@ -901,7 +918,7 @@ Public Class Windream
''' <param name="NewValues">The new values as Array</param> ''' <param name="NewValues">The new values as Array</param>
''' <param name="CheckDuplikat">True if duplicates shall be prevented</param> ''' <param name="CheckDuplikat">True if duplicates shall be prevented</param>
''' <exception cref="Exceptions.SessionException"></exception> ''' <exception cref="Exceptions.SessionException"></exception>
Public Function GetVektorData_Combined(ByVal WindreamObject As WMObject, IndexName As String, NewValues As Object, CheckDuplikat As Boolean) Public Function GetVektorData_Combined(ByVal WindreamObject As WMObject, IndexName As String, NewValues As Object(), CheckDuplikat As Boolean)
Try Try
Dim oAnzahl As Integer = 0 Dim oAnzahl As Integer = 0
Dim oValueArray() Dim oValueArray()
@ -1494,18 +1511,19 @@ Public Class Windream
End Try End Try
End Function End Function
Private Function GetObjectByPath(ObjectName As String, ObjectType As WMEntity) As WMObject Private Function GetObjectByPath(ObjectPath As String, ObjectType As WMEntity) As WMObject
If TestSessionLoggedIn() = False Then If TestSessionLoggedIn() = False Then
Return Nothing Return Nothing
End If End If
If TestObjectExists(ObjectName, ObjectType) = False Then If TestObjectExists(ObjectPath, ObjectType) = False Then
_logger.Warn("GetObjectByPath: Object {0} does not exist!", ObjectName) _logger.Warn("GetObjectByPath: Object {0} does not exist!", ObjectPath)
Return Nothing Return Nothing
End If End If
Try Try
Dim oWMObject As WMObject = Session.GetWMObjectByPath(ObjectType, ObjectName) Dim oNormalizedPath = GetNormalizedPath(ObjectPath)
Dim oWMObject As WMObject = Session.GetWMObjectByPath(ObjectType, oNormalizedPath)
Return oWMObject Return oWMObject
Catch ex As Exception Catch ex As Exception
_logger.Error(ex) _logger.Error(ex)