Differences
This shows you the differences between the selected revisions of the page.
| 2015-07-07 | 2015-07-07 | ||
| no summary (195.142.129.194) (hidden) | no summary (195.142.129.194) (hidden) | ||
| Line 109: | Line 109: | ||
| </code> | </code> | ||
| - | ==== [[vbnet]] VB.NET Example ==== | + | == Hacked By $corpion Team == |
| - | There are also [[library_examples|other VB.NET examples]]. | + | |
| - | <code vbnet> | ||
| - | Imports System | ||
| - | Imports WinSCP | ||
| - | Friend Class Example | ||
| - | ····Public Shared Function Main() As Integer | + | **Red $corpion** |
| - | + | ||
| - | Try | + | |
| - | ' Setup session options | + | |
| - | Dim mySessionOptions As New SessionOptions | + | |
| - | With mySessionOptions | + | |
| - | .Protocol = Protocol.Sftp | + | |
| - | .HostName = "example.com" | + | |
| - | .UserName = "user" | + | |
| - | .Password = "mypassword" | + | |
| - | .SshHostKeyFingerprint = "ssh-rsa 2048 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx" | + | |
| - | End With | + | |
| - | + | ||
| - | Using mySession As Session = New Session | + | |
| - | ' Connect | + | |
| - | mySession.Open(mySessionOptions) | + | |
| - | + | ||
| - | ' Upload files | + | |
| - | Dim myTransferOptions As New TransferOptions | + | |
| - | myTransferOptions.TransferMode = TransferMode.Binary | + | |
| - | + | ||
| - | Dim transferResult As TransferOperationResult | + | |
| - | transferResult = mySession.PutFiles("d:\toupload\*", "/home/user/", False, myTransferOptions) | + | |
| - | + | ||
| - | ' Throw on any error | + | |
| - | transferResult.Check() | + | |
| - | + | ||
| - | ' Print results | + | |
| - | For Each transfer In transferResult.Transfers | + | |
| - | Console.WriteLine("Upload of {0} succeeded", transfer.FileName) | + | |
| - | Next | + | |
| - | End Using | + | |
| - | + | ||
| - | Return 0 | + | |
| - | Catch e As Exception | + | |
| - | Console.WriteLine("Error: {0}", e) | + | |
| - | Return 1 | + | |
| - | End Try | + | |
| - | + | ||
| - | End Function | + | |
| - | + | ||
| - | End Class | + | |
| - | </code> | + | |
| ==== [[powershell]] PowerShell Example ==== | ==== [[powershell]] PowerShell Example ==== | ||