Differences
This shows you the differences between the selected revisions of the page.
| 2014-03-05 | 2014-04-24 | ||
| it's FileMask, not Include Mask (martin) | variable names distinct from class names as VB is case-insensitive (martin) | ||
| Line 149: | Line 149: | ||
| Try | Try | ||
| ' Setup session options | ' Setup session options | ||
| - | Dim sessionOptions As New SessionOptions | + | Dim mySessionOptions As New SessionOptions |
| - | With sessionOptions | + | With mySessionOptions |
| .Protocol = Protocol.Sftp | .Protocol = Protocol.Sftp | ||
| .HostName = "example.com" | .HostName = "example.com" | ||
| Line 158: | Line 158: | ||
| End With | End With | ||
| - | Using session As Session = New Session | + | Using mySession As Session = New Session |
| ' Connect | ' Connect | ||
| - | session.Open(sessionOptions) | + | mySession.Open(mySessionOptions) |
| Dim stamp As String = DateTime.Now.ToString("yyyyMMdd", CultureInfo.InvariantCulture) | Dim stamp As String = DateTime.Now.ToString("yyyyMMdd", CultureInfo.InvariantCulture) | ||
| Line 170: | Line 170: | ||
| ' You can achieve the same using: | ' You can achieve the same using: | ||
| - | ' session.SynchronizeDirectories( _ | + | ' mySession.SynchronizeDirectories( _ |
| ' SynchronizationMode.Local, localPath, remotePath, False, False, SynchronizationCriteria.Time, _ | ' SynchronizationMode.Local, localPath, remotePath, False, False, SynchronizationCriteria.Time, _ | ||
| ' New TransferOptions With { .FileMask = fileName }).Check | ' New TransferOptions With { .FileMask = fileName }).Check | ||
| - | If session.FileExists(remotePath) Then | + | If mySession.FileExists(remotePath) Then |
| Dim download As Boolean | Dim download As Boolean | ||
| If Not File.Exists(localPath) Then | If Not File.Exists(localPath) Then | ||
| Line 179: | Line 179: | ||
| download = True | download = True | ||
| Else | Else | ||
| - | Dim remoteWriteTime As DateTime = session.GetFileInfo(remotePath).LastWriteTime | + | Dim remoteWriteTime As DateTime = mySession.GetFileInfo(remotePath).LastWriteTime |
| Dim localWriteTime As DateTime = File.GetLastWriteTime(localPath) | Dim localWriteTime As DateTime = File.GetLastWriteTime(localPath) | ||
| Line 199: | Line 199: | ||
| If download Then | If download Then | ||
| ' Download the file and throw on any error | ' Download the file and throw on any error | ||
| - | session.GetFiles(remotePath, localPath).Check | + | mySession.GetFiles(remotePath, localPath).Check |
| Console.WriteLine("Download to backup done.") | Console.WriteLine("Download to backup done.") | ||