Windream: Normalize BasePath
This commit is contained in:
parent
dd0f99ebda
commit
81a06966b5
@ -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
|
||||
|
||||
''' <summary>
|
||||
''' Sets flag in Windream class to indicate 64-bit support
|
||||
|
||||
@ -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
|
||||
|
||||
@ -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
|
||||
|
||||
''' <summary>
|
||||
''' Returns the result of a search file
|
||||
''' </summary>
|
||||
@ -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
|
||||
|
||||
@ -136,6 +136,10 @@
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Modules.Language\Language.vbproj">
|
||||
<Project>{d3c8cfed-d6f6-43a8-9bdf-454145d0352f}</Project>
|
||||
<Name>Language</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Modules.Logging\Logging.vbproj">
|
||||
<Project>{903b2d7d-3b80-4be9-8713-7447b704e1b0}</Project>
|
||||
<Name>Logging</Name>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user