Created
July 28, 2018 20:14
-
-
Save skenderbeu/771e3295411ce3f441d9e500ebe1a71a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public void FTPZippedFile(some params....) | |
{ | |
//create and set variables | |
var fallback = Policy | |
.Handle<SessionRemoteException>() | |
.Fallback((ex)=> SendEmail(ex.Message)); | |
var fileUploadResult = fallback.Execute(() => | |
UploadFile(zipFileName, fullzipFilepath, | |
transOptions, sessionOptions)); | |
// do soemthing with result | |
} | |
public string UploadFile(string zipFileName, string fullZipFilePath, | |
TransferOptions transOptions, SessionOptions sessionOptions) | |
{ | |
using (var session = new Session()) | |
{ | |
session.Open(sessionOptions); | |
return session.PutFiles( | |
zipFileName, | |
fullZipFilePath, | |
false, | |
transOptions); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment