From db4457fe3f7f27d39f461f183055855b7aecfcf4 Mon Sep 17 00:00:00 2001 From: Jonathan Jenne Date: Thu, 29 Jul 2021 16:33:37 +0200 Subject: [PATCH] Windream: Add Function GetVectorData --- Modules.Windream/Windream.vb | 28 +++++++++++++++++++++++----- 1 file changed, 23 insertions(+), 5 deletions(-) diff --git a/Modules.Windream/Windream.vb b/Modules.Windream/Windream.vb index d00448da..574f54e7 100644 --- a/Modules.Windream/Windream.vb +++ b/Modules.Windream/Windream.vb @@ -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 + ''' ''' Gets an array of the actual vektorvalues of index, collated with the passed values ''' @@ -901,7 +918,7 @@ Public Class Windream ''' The new values as Array ''' True if duplicates shall be prevented ''' - 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)