diff --git a/Modules.Windream/ConnectionBuilder.vb b/Modules.Windream/ConnectionBuilder.vb index 5997db69..17c8def6 100644 --- a/Modules.Windream/ConnectionBuilder.vb +++ b/Modules.Windream/ConnectionBuilder.vb @@ -1,5 +1,7 @@ Imports NLog Imports DigitalData.Modules.Logging +Imports DigitalData.Modules.Windream +Imports DigitalData.Modules.Language Public Class ConnectionBuilder Implements IConnectionBuilder @@ -61,6 +63,15 @@ Public Class ConnectionBuilder Return Me End Function + Public Function WithWindreamObjectsOrDriveLetter(BasePath As String, DriveLetter As String) As IConnectionBuilder Implements IConnectionBuilder.WithWindreamObjectsOrDriveLetter + If Utils.NotNull(BasePath, Nothing) IsNot Nothing Then + Return WithWindreamObjects(BasePath) + ElseIf Utils.NotNull(DriveLetter, Nothing) IsNot Nothing Then + Return WithDriveLetter(DriveLetter) + Else + Return WithWindreamObjects() + End If + End Function ''' ''' Sets flag in Windream class to indicate 64-bit support diff --git a/Modules.Windream/IConnectionBuilder.vb b/Modules.Windream/IConnectionBuilder.vb index 0dbca2cc..236843b1 100644 --- a/Modules.Windream/IConnectionBuilder.vb +++ b/Modules.Windream/IConnectionBuilder.vb @@ -3,6 +3,7 @@ Function WithDriveLetter(driveLetter As String) As IConnectionBuilder Function WithWindreamObjects() As IConnectionBuilder Function WithWindreamObjects(BasePath As String) As IConnectionBuilder + Function WithWindreamObjectsOrDriveLetter(BasePath As String, DriveLetter As String) As IConnectionBuilder Function With64BitSupport() As IConnectionBuilder Function WithServerName(serverName As String) As IConnectionBuilder Function WithImpersonation(userName As String, password As String, domain As String) As IConnectionBuilder diff --git a/Modules.Windream/Windream.vb b/Modules.Windream/Windream.vb index b5b134b0..b9d9f5e7 100644 --- a/Modules.Windream/Windream.vb +++ b/Modules.Windream/Windream.vb @@ -133,7 +133,7 @@ Public Class Windream Me.ClientDriveLetter = ClientDriveLetter Me.ClientSupports64Bit = ClientSupport64Bit Me.SessionServername = SessionServerName - Me.ClientBasePath = BasePath + Me.ClientBasePath = GetNormalizedBasePath(BasePath) _sessionUsername = SessionUserName _sessionPassword = SessionPassword @@ -760,6 +760,18 @@ Public Class Windream End Try End Function + Public Function GetNormalizedPath(Path As String) As String + Dim oNormalizedPath = GetCleanedPath(Path) + + If ClientDriveLetter <> String.Empty And Path.ToUpper().StartsWith(ClientDriveLetter.ToUpper) Then + oNormalizedPath = Path.Substring(2) + ElseIf Path.ToLower.StartsWith(ClientBasePath) Then + oNormalizedPath = Path.Substring(ClientBasePath.Length) + End If + + Return oNormalizedPath + End Function + ''' ''' Returns the result of a search file ''' @@ -1282,16 +1294,12 @@ Public Class Windream #End Region #Region "Private Methods" - Private Function GetNormalizedPath(Path As String) As String - Dim oNormalizedPath = GetCleanedPath(Path) - - If Not Path.StartsWith("\") And Path.ToUpper().StartsWith(ClientDriveLetter.ToUpper) Then - oNormalizedPath = Path.Substring(2) - ElseIf Path.ToLower.StartsWith(ClientBasePath) Then - oNormalizedPath = Path.Substring(ClientBasePath.Length) + Private Function GetNormalizedBasePath(BasePath As String) As String + If BasePath.EndsWith("\") Then + Return BasePath + Else + Return BasePath & "\" End If - - Return oNormalizedPath End Function Private Function GetCleanedPath(Path As String) As String diff --git a/Modules.Windream/Windream.vbproj b/Modules.Windream/Windream.vbproj index 72801a2c..0c45f1f1 100644 --- a/Modules.Windream/Windream.vbproj +++ b/Modules.Windream/Windream.vbproj @@ -136,6 +136,10 @@ + + {d3c8cfed-d6f6-43a8-9bdf-454145d0352f} + Language + {903b2d7d-3b80-4be9-8713-7447b704e1b0} Logging