Differences
This shows you the differences between the selected revisions of the page.
2012-01-10 | 2012-01-11 | ||
toc + full example (martin) | using Session (martin) | ||
Line 59: | Line 59: | ||
sessionOptions.SshHostKey = "ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"; | sessionOptions.SshHostKey = "ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"; | ||
- | Session session = new Session(); | + | using (Session session = new Session()) |
+ | { | ||
+ | // Will continuously report progress of synchronization | ||
+ | session.FileTransferred += FileTransferred; | ||
- | ············// Will continuously report progress of synchronization | + | ················// Connect |
- | ···········session.FileTransferred += FileTransferred; | + | ···············session.Open(sessionOptions); |
- | ············// Connect | + | ················SynchronizationResult synchronizationResult; |
- | ···········session.Open(sessionOptions); | + | synchronizationResult = |
+ | ···················session.SynchronizeDirectories( | ||
+ | SynchronizationMode.Remote, @"d:\www", "/home/martin/public_html", false); | ||
- | SynchronizationResult synchronizationResult; | + | ················// Throw on any error |
- | synchronizationResult = | + | ···············synchronizationResult.Check(); |
- | session.SynchronizeDirectories( | + | } |
- | SynchronizationMode.Remote, @"d:\www", "/home/martin/public_html", false); | + | |
- | + | ||
- | ············// Throw on any error | + | |
- | ···········synchronizationResult.Check(); | + | |
} | } | ||
catch (Exception e) | catch (Exception e) |