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 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>
''' Gets an array of the actual vektorvalues of index, collated with the passed values
''' </summary>
@ -901,7 +918,7 @@ Public Class Windream
''' <param name="NewValues">The new values as Array</param>
''' <param name="CheckDuplikat">True if duplicates shall be prevented</param>
''' <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
Dim oAnzahl As Integer = 0
Dim oValueArray()
@ -1494,18 +1511,19 @@ Public Class Windream
End Try
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
Return Nothing
End If
If TestObjectExists(ObjectName, ObjectType) = False Then
_logger.Warn("GetObjectByPath: Object {0} does not exist!", ObjectName)
If TestObjectExists(ObjectPath, ObjectType) = False Then
_logger.Warn("GetObjectByPath: Object {0} does not exist!", ObjectPath)
Return Nothing
End If
Try
Dim oWMObject As WMObject = Session.GetWMObjectByPath(ObjectType, ObjectName)
Dim oNormalizedPath = GetNormalizedPath(ObjectPath)
Dim oWMObject As WMObject = Session.GetWMObjectByPath(ObjectType, oNormalizedPath)
Return oWMObject
Catch ex As Exception
_logger.Error(ex)