Windream: Normalize paths

This commit is contained in:
Jonathan Jenne 2021-08-02 11:57:35 +02:00
parent 850cbb2973
commit bc4f6e42e6
2 changed files with 30 additions and 18 deletions

View File

@ -15,50 +15,50 @@ Public Class Helpers
INDEX_TYPE_VECTOR_TIME
}
Friend Shared Function ConvertVectorType(vType As Object, value As String)
Friend Shared Function ConvertVectorType(pIndexType As Integer, pValue As String)
Dim myArray
ReDim myArray(0)
Select Case vType
Select Case pIndexType
Case INDEX_TYPE_HASH ' 36865
'Umwandeln in String
myArray(0) = CStr(value)
myArray(0) = CStr(pValue)
Return myArray
Case INDEX_TYPE_VECTOR_STRING '4097
'Umwandeln in String
myArray(0) = CStr(value)
myArray(0) = CStr(pValue)
Return myArray
Case INDEX_TYPE_VECTOR_INTEGER '4098
'Umwandeln in Integer
myArray(0) = CInt(value.Replace(" ", ""))
myArray(0) = CInt(pValue.Replace(" ", ""))
Return myArray
Case INDEX_TYPE_VECTOR_FLOAT '4099
value = value.
pValue = pValue.
Replace(" ", "").
Replace(".", ",")
'Umwandeln in Double
myArray(0) = CDbl(value)
myArray(0) = CDbl(pValue)
Return myArray
Case INDEX_TYPE_VECTOR_BOOLEAN '4100
'Umwandeln in Boolean
myArray(0) = CBool(value)
myArray(0) = CBool(pValue)
Return myArray
Case INDEX_TYPE_VECTOR_DATE '4101
'Umwandeln in Date
myArray(0) = CDate(value)
myArray(0) = CDate(pValue)
Return myArray
Case INDEX_TYPE_VECTOR_INTEGER_64BIT '4107
myArray(0) = Convert.ToInt64(value)
myArray(0) = Convert.ToInt64(pValue)
Return myArray
Case INDEX_TYPE_VECTOR_DATE_TIME '4103
'Umwandeln in Datum Uhrzeit
Return value
Return pValue
Case 8204
'Umwandeln in Integer
myArray(0) = CInt(value.Replace(" ", ""))
myArray(0) = CInt(pValue.Replace(" ", ""))
Return myArray
Case Else
'Umwandeln in String
myArray(0) = CStr(value)
myArray(0) = CStr(pValue)
Return myArray
End Select
End Function

View File

@ -1,4 +1,8 @@
Imports WINDREAMLib
Imports System.IO
Imports System.IO.Path
Imports System.Text.RegularExpressions
Imports WINDREAMLib
Imports WINDREAMLib.WMCOMEvent
Imports WINDREAMLib.WMEntity
Imports WINDREAMLib.WMObjectEditMode
@ -6,10 +10,9 @@ Imports WMOBRWSLib
Imports WMOSRCHLib
Imports WMCNNCTDLLLib
Imports WMOTOOLLib
Imports System.IO
Imports System.IO.Path
Imports DigitalData.Modules.Logging
Imports System.Text.RegularExpressions
Imports DigitalData.Modules.Language
''' <module>Windream</module>
''' <version>0.0.0.2</version>
@ -165,6 +168,12 @@ Public Class Windream
Me.SessionServername = SessionServerName
Me.ClientBasePath = GetNormalizedBasePath(BasePath)
_logger.Debug("ClientBasePath: [{0}]", ClientBasePath)
_logger.Debug("ClientDriveLetter: [{0}]", ClientDriveLetter)
_logger.Debug("SessionServername: [{0}]", SessionServerName)
_logger.Debug("SessionUserName: [{0}]", SessionUserName)
_logger.Debug("SessionDomain: [{0}]", SessionDomain)
If ClientDriveLetter = String.Empty Then
UsesDriveLetter = False
End If
@ -766,7 +775,10 @@ Public Class Windream
End Function
Public Function GetNormalizedPath(Path As String) As String
Dim oNormalizedPath = GetCleanedPath(Path)
'Dim oNormalizedPath = GetCleanedPath(Path)
Dim oNormalizedPath = Language.Utils.RemoveInvalidCharacters(Path)
_logger.Debug("Normalizing Path: [{0}]", oNormalizedPath)
Try
' Convert any forward slashes / and double slashes \\ into backslashes \
' See: https://stackoverflow.com/questions/3144492/how-do-i-get-nets-path-combine-to-convert-forward-slashes-to-backslashes