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 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 Dim myArray
ReDim myArray(0) ReDim myArray(0)
Select Case vType Select Case pIndexType
Case INDEX_TYPE_HASH ' 36865 Case INDEX_TYPE_HASH ' 36865
'Umwandeln in String 'Umwandeln in String
myArray(0) = CStr(value) myArray(0) = CStr(pValue)
Return myArray Return myArray
Case INDEX_TYPE_VECTOR_STRING '4097 Case INDEX_TYPE_VECTOR_STRING '4097
'Umwandeln in String 'Umwandeln in String
myArray(0) = CStr(value) myArray(0) = CStr(pValue)
Return myArray Return myArray
Case INDEX_TYPE_VECTOR_INTEGER '4098 Case INDEX_TYPE_VECTOR_INTEGER '4098
'Umwandeln in Integer 'Umwandeln in Integer
myArray(0) = CInt(value.Replace(" ", "")) myArray(0) = CInt(pValue.Replace(" ", ""))
Return myArray Return myArray
Case INDEX_TYPE_VECTOR_FLOAT '4099 Case INDEX_TYPE_VECTOR_FLOAT '4099
value = value. pValue = pValue.
Replace(" ", ""). Replace(" ", "").
Replace(".", ",") Replace(".", ",")
'Umwandeln in Double 'Umwandeln in Double
myArray(0) = CDbl(value) myArray(0) = CDbl(pValue)
Return myArray Return myArray
Case INDEX_TYPE_VECTOR_BOOLEAN '4100 Case INDEX_TYPE_VECTOR_BOOLEAN '4100
'Umwandeln in Boolean 'Umwandeln in Boolean
myArray(0) = CBool(value) myArray(0) = CBool(pValue)
Return myArray Return myArray
Case INDEX_TYPE_VECTOR_DATE '4101 Case INDEX_TYPE_VECTOR_DATE '4101
'Umwandeln in Date 'Umwandeln in Date
myArray(0) = CDate(value) myArray(0) = CDate(pValue)
Return myArray Return myArray
Case INDEX_TYPE_VECTOR_INTEGER_64BIT '4107 Case INDEX_TYPE_VECTOR_INTEGER_64BIT '4107
myArray(0) = Convert.ToInt64(value) myArray(0) = Convert.ToInt64(pValue)
Return myArray Return myArray
Case INDEX_TYPE_VECTOR_DATE_TIME '4103 Case INDEX_TYPE_VECTOR_DATE_TIME '4103
'Umwandeln in Datum Uhrzeit 'Umwandeln in Datum Uhrzeit
Return value Return pValue
Case 8204 Case 8204
'Umwandeln in Integer 'Umwandeln in Integer
myArray(0) = CInt(value.Replace(" ", "")) myArray(0) = CInt(pValue.Replace(" ", ""))
Return myArray Return myArray
Case Else Case Else
'Umwandeln in String 'Umwandeln in String
myArray(0) = CStr(value) myArray(0) = CStr(pValue)
Return myArray Return myArray
End Select End Select
End Function 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.WMCOMEvent
Imports WINDREAMLib.WMEntity Imports WINDREAMLib.WMEntity
Imports WINDREAMLib.WMObjectEditMode Imports WINDREAMLib.WMObjectEditMode
@ -6,10 +10,9 @@ Imports WMOBRWSLib
Imports WMOSRCHLib Imports WMOSRCHLib
Imports WMCNNCTDLLLib Imports WMCNNCTDLLLib
Imports WMOTOOLLib Imports WMOTOOLLib
Imports System.IO
Imports System.IO.Path
Imports DigitalData.Modules.Logging Imports DigitalData.Modules.Logging
Imports System.Text.RegularExpressions Imports DigitalData.Modules.Language
''' <module>Windream</module> ''' <module>Windream</module>
''' <version>0.0.0.2</version> ''' <version>0.0.0.2</version>
@ -165,6 +168,12 @@ Public Class Windream
Me.SessionServername = SessionServerName Me.SessionServername = SessionServerName
Me.ClientBasePath = GetNormalizedBasePath(BasePath) 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 If ClientDriveLetter = String.Empty Then
UsesDriveLetter = False UsesDriveLetter = False
End If End If
@ -766,7 +775,10 @@ Public Class Windream
End Function End Function
Public Function GetNormalizedPath(Path As String) As String 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 Try
' Convert any forward slashes / and double slashes \\ into backslashes \ ' 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 ' See: https://stackoverflow.com/questions/3144492/how-do-i-get-nets-path-combine-to-convert-forward-slashes-to-backslashes