|
|
|
|
@@ -66,7 +66,31 @@ Imports System.Text.RegularExpressions
|
|
|
|
|
''' This class should not be instanciated directly. Instead, ConnectionBuilder should be used.
|
|
|
|
|
''' </remarks>
|
|
|
|
|
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()
|
|
|
|
|
|