This commit is contained in:
Jonathan Jenne 2020-04-27 14:17:12 +02:00
commit 29600e0a5e
2 changed files with 53 additions and 13 deletions

View File

@ -31,5 +31,5 @@ Imports System.Runtime.InteropServices
' übernehmen, indem Sie "*" eingeben: ' übernehmen, indem Sie "*" eingeben:
' <Assembly: AssemblyVersion("1.0.*")> ' <Assembly: AssemblyVersion("1.0.*")>
<Assembly: AssemblyVersion("1.0.0.4")> <Assembly: AssemblyVersion("1.0.0.5")>
<Assembly: AssemblyFileVersion("1.0.0.0")> <Assembly: AssemblyFileVersion("1.0.0.0")>

View File

@ -66,7 +66,31 @@ Imports System.Text.RegularExpressions
''' This class should not be instanciated directly. Instead, ConnectionBuilder should be used. ''' This class should not be instanciated directly. Instead, ConnectionBuilder should be used.
''' </remarks> ''' </remarks>
Public Class Windream 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" #Region "Private Properties"
Private ReadOnly _logger As Logger Private ReadOnly _logger As Logger
Private ReadOnly _logConfig As LogConfig Private ReadOnly _logConfig As LogConfig
@ -311,6 +335,7 @@ Public Class Windream
Next Next
' Indexarray zurückgeben ' Indexarray zurückgeben
oIndicies.Sort()
'Return aIndexNames 'Return aIndexNames
Return oIndicies Return oIndicies
@ -420,10 +445,14 @@ Public Class Windream
.aServerName = ServerName .aServerName = ServerName
} }
End If End If
If UserName IsNot Nothing Then
If UserName <> String.Empty Then
_logger.Info("Impersonated Login: {0}", oImpersonation) _logger.Info("Impersonated Login: {0}", oImpersonation)
_logger.Info("Username: {0}", IIf(UserName IsNot Nothing, UserName, Environment.UserName)) _logger.Info("Username: {0}", IIf(UserName IsNot Nothing, UserName, Environment.UserName))
_logger.Info("Domain: {0}", IIf(Domain IsNot Nothing, Domain, Environment.UserDomainName)) _logger.Info("Domain: {0}", IIf(Domain IsNot Nothing, Domain, Environment.UserDomainName))
End If
End If
Try Try
oSession = oConnect.Login(oCredentials) oSession = oConnect.Login(oCredentials)
@ -578,7 +607,7 @@ Public Class Windream
End Try End Try
End Function 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 If Not TestSessionLoggedIn() Then
Return False Return False
End If End If
@ -591,6 +620,9 @@ Public Class Windream
For Each oFolder In oFolders For Each oFolder In oFolders
If oFolder.ToString.EndsWith(pExtension) Then
Exit For
End If
oCurrentPath = Combine(oCurrentPath, oFolder) oCurrentPath = Combine(oCurrentPath, oFolder)
If TestFolderExists(oCurrentPath) = False Then If TestFolderExists(oCurrentPath) = False Then
@ -731,20 +763,28 @@ Public Class Windream
Dim oNormalizedPath = GetCleanedPath(Path) Dim oNormalizedPath = GetCleanedPath(Path)
Try Try
If UsesDriveLetter Then 'If UsesDriveLetter Then
' Remove Driveletter eg. W:\ ' Remove Driveletter eg. W:\
If oNormalizedPath.StartsWith($"{ClientDriveLetter}:\") Then If oNormalizedPath.StartsWith($"{ClientDriveLetter}:\") Then
_logger.Debug($"Replacing ClientDriveLetter: [{ClientDriveLetter}]")
oNormalizedPath = oNormalizedPath.Substring(ClientDriveLetter.Length + 2) oNormalizedPath = oNormalizedPath.Substring(ClientDriveLetter.Length + 2)
End If End If
Else 'Else
If oNormalizedPath.ToLower.StartsWith(ClientBasePath.ToLower) Then If oNormalizedPath.ToLower.StartsWith(ClientBasePath.ToLower) Then
_logger.Debug($"Replacing ClientBasePath: [{ClientBasePath}]")
' Remove Windream Base Path eg. \\windream\objects\ ' Remove Windream Base Path eg. \\windream\objects\
oNormalizedPath = oNormalizedPath.Substring(ClientBasePath.Length - 1) oNormalizedPath = oNormalizedPath.Substring(ClientBasePath.Length - 1)
End If End If
End If 'End If
oNormalizedPath = oNormalizedPath.Replace("\\", "\") oNormalizedPath = oNormalizedPath.Replace("\\", "\")
_logger.Debug($"oNormalizedPath: [{oNormalizedPath}]") _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 Return oNormalizedPath
Catch ex As Exception Catch ex As Exception
_logger.Warn($"Unexpected error in GetNormalizedPath - oNormalizedPath [{oNormalizedPath}] - Error: [{ex.Message}]") _logger.Warn($"Unexpected error in GetNormalizedPath - oNormalizedPath [{oNormalizedPath}] - Error: [{ex.Message}]")
@ -1012,8 +1052,8 @@ Public Class Windream
Dim oWMObject As WMObject = GetFileByPath(Path) Dim oWMObject As WMObject = GetFileByPath(Path)
If oWMObject Is Nothing Then If oWMObject Is Nothing Then
_logger.Warn("Error RemoveFile (oWMObject is nothing)") _logger.Debug("File so far not existing in WM")
Return False Return True
End If End If
_logger.Info($"Deleting WMObject [{Path}]") _logger.Info($"Deleting WMObject [{Path}]")
oWMObject.Delete() oWMObject.Delete()