public IAsyncResult BeginSynchronizeDirectories(string sourcePath, string destinationPath, string searchPattern, AsyncCallback asyncCallback, object state)
{
if (sourcePath == null)
throw new ArgumentNullException("sourcePath");
if (destinationPath.IsNullOrWhiteSpace())
throw new ArgumentException("destDir");
var asyncResult = new SftpSynchronizeDirectoriesAsyncResult(asyncCallback, state);
ThreadAbstraction.ExecuteThread(() =>
{
try
{
var result = InternalSynchronizeDirectories(sourcePath, destinationPath, searchPattern, asyncResult);
asyncResult.SetAsCompleted(result, false);
}
catch (Exception exp)
{
asyncResult.SetAsCompleted(exp, false);
}
});
return asyncResult;
}