Renci.SshNet.SftpClient.BeginSynchronizeDirectories C# (CSharp) Method

BeginSynchronizeDirectories() public method

Begins the synchronize directories.
is null. is null or contains only whitespace.
public BeginSynchronizeDirectories ( string sourcePath, string destinationPath, string searchPattern, AsyncCallback asyncCallback, object state ) : IAsyncResult
sourcePath string The source path.
destinationPath string The destination path.
searchPattern string The search pattern.
asyncCallback AsyncCallback The async callback.
state object The state.
return IAsyncResult
        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;
        }