49 lines
1.7 KiB
VB.net
49 lines
1.7 KiB
VB.net
Public Class ConnectionBuilder
|
|
Implements IConnectionBuilder
|
|
|
|
Private LogFactory As NLog.LogFactory
|
|
Private SessionReconnect As Boolean = False
|
|
Private DriveLetter As String = "W"
|
|
Private Support64Bit As Boolean = False
|
|
Private ServerName As String = Nothing
|
|
Private UserName As String = Nothing
|
|
Private Password As String = Nothing
|
|
Private Domain As String = Nothing
|
|
|
|
Public Sub New(LogFactory As NLog.LogFactory)
|
|
Me.LogFactory = LogFactory
|
|
End Sub
|
|
|
|
Public Function WithSessionReconnect() As IConnectionBuilder Implements IConnectionBuilder.WithSessionReconnect
|
|
SessionReconnect = True
|
|
Return Me
|
|
End Function
|
|
|
|
Public Function WithDriveLetter(driveLetter As String) As IConnectionBuilder Implements IConnectionBuilder.WithDriveLetter
|
|
Me.DriveLetter = driveLetter
|
|
Return Me
|
|
End Function
|
|
|
|
Public Function With64BitSupport() As IConnectionBuilder Implements IConnectionBuilder.With64BitSupport
|
|
Support64Bit = True
|
|
Return Me
|
|
End Function
|
|
|
|
Public Function WithServerName(serverName As String) As IConnectionBuilder Implements IConnectionBuilder.WithServerName
|
|
Me.ServerName = serverName
|
|
Return Me
|
|
End Function
|
|
|
|
Public Function WithImpersonation(userName As String, password As String, domain As String) As IConnectionBuilder Implements IConnectionBuilder.WithImpersonation
|
|
Me.UserName = userName
|
|
Me.Password = password
|
|
Me.Domain = domain
|
|
Return Me
|
|
End Function
|
|
|
|
Public Function Connect() As Windream2 Implements IConnectionBuilder.Connect
|
|
Return New Windream2(LogFactory, SessionReconnect, DriveLetter, Support64Bit, ServerName, UserName, Password, Domain)
|
|
End Function
|
|
|
|
End Class
|