From cbc603cbb7336ea1d3e9f6f4523f05270112bca0 Mon Sep 17 00:00:00 2001 From: Digital Data - Marlon Schreiber Date: Mon, 27 Apr 2020 14:16:32 +0200 Subject: [PATCH] MS WINDREAM MOdule --- Modules.Windream/My Project/AssemblyInfo.vb | 2 +- Modules.Windream/Windream.vb | 66 +++++++++++++++++---- 2 files changed, 54 insertions(+), 14 deletions(-) diff --git a/Modules.Windream/My Project/AssemblyInfo.vb b/Modules.Windream/My Project/AssemblyInfo.vb index a81c9e3d..db7df557 100644 --- a/Modules.Windream/My Project/AssemblyInfo.vb +++ b/Modules.Windream/My Project/AssemblyInfo.vb @@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices ' übernehmen, indem Sie "*" eingeben: ' - + diff --git a/Modules.Windream/Windream.vb b/Modules.Windream/Windream.vb index b7d30b6e..50866a63 100644 --- a/Modules.Windream/Windream.vb +++ b/Modules.Windream/Windream.vb @@ -66,7 +66,31 @@ Imports System.Text.RegularExpressions ''' This class should not be instanciated directly. Instead, ConnectionBuilder should be used. ''' Public Class Windream - +#Region "+++++ Konstanten +++++" + Protected Const WMObjectEditModeObject = &H1F + Protected Const WMObjectStreamOpenModeReadWrite = 2 + Protected Const WMEntityObjectType = 10 + Protected Const WMEntityDocument = 1 + + Public Const WMObjectVariableValueTypeUndefined = 0 + Public Const WMObjectVariableValueTypeString = 1 + Public Const WMObjectVariableValueTypeInteger = 2 + Public Const WMObjectVariableValueTypeFloat = 3 + Public Const WMObjectVariableValueTypeBoolean = 4 + Public Const WMObjectVariableValueTypeDate = 5 + Public Const WMObjectVariableValueTypeFixedPoint = 6 + Public Const WMObjectVariableValueTypeTimeStamp = 7 + Public Const WMObjectVariableValueTypeCurrency = 8 + Public Const WMObjectVariableValueTypeTime = 9 + Public Const WMObjectVariableValueTypeVariant = 10 + Public Const WMObjectVariableValueTypeMask = &HFFF + Public Const WMObjectVariableValueFlagMask = &HFFFFF000 + Public Const WMObjectVariableValueTypeVector = &H1000 + Public Const WMObjectVariableValueTypeFulltext = &H2000 + Public Const WMObjectVariableValueTypeDefaultValue = &H4000 + + Public Const WMObjectEditModeIndexEdit = &H3DA +#End Region #Region "Private Properties" Private ReadOnly _logger As Logger Private ReadOnly _logConfig As LogConfig @@ -311,6 +335,7 @@ Public Class Windream Next ' Indexarray zurückgeben + oIndicies.Sort() 'Return aIndexNames Return oIndicies @@ -420,10 +445,14 @@ Public Class Windream .aServerName = ServerName } End If + If UserName IsNot Nothing Then + If UserName <> String.Empty Then + _logger.Info("Impersonated Login: {0}", oImpersonation) + _logger.Info("Username: {0}", IIf(UserName IsNot Nothing, UserName, Environment.UserName)) + _logger.Info("Domain: {0}", IIf(Domain IsNot Nothing, Domain, Environment.UserDomainName)) + End If + End If - _logger.Info("Impersonated Login: {0}", oImpersonation) - _logger.Info("Username: {0}", IIf(UserName IsNot Nothing, UserName, Environment.UserName)) - _logger.Info("Domain: {0}", IIf(Domain IsNot Nothing, Domain, Environment.UserDomainName)) Try oSession = oConnect.Login(oCredentials) @@ -578,7 +607,7 @@ Public Class Windream End Try End Function - Public Function NewFolder(Path As String) As Boolean + Public Function NewFolder(Path As String, pExtension As String) As Boolean If Not TestSessionLoggedIn() Then Return False End If @@ -591,6 +620,9 @@ Public Class Windream For Each oFolder In oFolders + If oFolder.ToString.EndsWith(pExtension) Then + Exit For + End If oCurrentPath = Combine(oCurrentPath, oFolder) If TestFolderExists(oCurrentPath) = False Then @@ -731,20 +763,28 @@ Public Class Windream Dim oNormalizedPath = GetCleanedPath(Path) Try - If UsesDriveLetter Then - ' Remove Driveletter eg. W:\ - If oNormalizedPath.StartsWith($"{ClientDriveLetter}:\") Then + 'If UsesDriveLetter Then + ' Remove Driveletter eg. W:\ + If oNormalizedPath.StartsWith($"{ClientDriveLetter}:\") Then + _logger.Debug($"Replacing ClientDriveLetter: [{ClientDriveLetter}]") oNormalizedPath = oNormalizedPath.Substring(ClientDriveLetter.Length + 2) End If - Else - If oNormalizedPath.ToLower.StartsWith(ClientBasePath.ToLower) Then + 'Else + If oNormalizedPath.ToLower.StartsWith(ClientBasePath.ToLower) Then + _logger.Debug($"Replacing ClientBasePath: [{ClientBasePath}]") ' Remove Windream Base Path eg. \\windream\objects\ oNormalizedPath = oNormalizedPath.Substring(ClientBasePath.Length - 1) End If - End If + 'End If oNormalizedPath = oNormalizedPath.Replace("\\", "\") _logger.Debug($"oNormalizedPath: [{oNormalizedPath}]") + If oNormalizedPath.Contains(":") Then + _logger.Info($"oNormalizedPath still contains a drive name!!") + _logger.Info($"Check Your config ClientDriveLetter [{ClientDriveLetter}] // ClientBasePath [{ClientBasePath}]") + oNormalizedPath = oNormalizedPath.Substring(3) + _logger.Debug($"oNormalizedPath after Substring: [{oNormalizedPath}]") + End If Return oNormalizedPath Catch ex As Exception _logger.Warn($"Unexpected error in GetNormalizedPath - oNormalizedPath [{oNormalizedPath}] - Error: [{ex.Message}]") @@ -1012,8 +1052,8 @@ Public Class Windream Dim oWMObject As WMObject = GetFileByPath(Path) If oWMObject Is Nothing Then - _logger.Warn("Error RemoveFile (oWMObject is nothing)") - Return False + _logger.Debug("File so far not existing in WM") + Return True End If _logger.Info($"Deleting WMObject [{Path}]") oWMObject.Delete()