本文整理汇总了C#中SftpClient.BeginSynchronizeDirectories方法的典型用法代码示例。如果您正苦于以下问题:C# SftpClient.BeginSynchronizeDirectories方法的具体用法?C# SftpClient.BeginSynchronizeDirectories怎么用?C# SftpClient.BeginSynchronizeDirectories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SftpClient
的用法示例。
在下文中一共展示了SftpClient.BeginSynchronizeDirectories方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test_Sftp_BeginSynchronizeDirectories
public void Test_Sftp_BeginSynchronizeDirectories()
{
RemoveAllFiles();
using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
{
sftp.Connect();
string uploadedFileName = Path.GetTempFileName();
string sourceDir = Path.GetDirectoryName(uploadedFileName);
string destDir = "/";
string searchPattern = Path.GetFileName(uploadedFileName);
var asyncResult = sftp.BeginSynchronizeDirectories(sourceDir,
destDir,
searchPattern,
null,
null
);
// Wait for the WaitHandle to become signaled.
asyncResult.AsyncWaitHandle.WaitOne(1000);
var upLoadedFiles = sftp.EndSynchronizeDirectories(asyncResult);
Assert.IsTrue(upLoadedFiles.Count() > 0);
foreach (var file in upLoadedFiles)
{
Debug.WriteLine(file.FullName);
}
// Close the wait handle.
asyncResult.AsyncWaitHandle.Close();
sftp.Disconnect();
}
}
示例2: BeginSynchronizeDirectoriesTest
public void BeginSynchronizeDirectoriesTest()
{
ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
SftpClient target = new SftpClient(connectionInfo); // TODO: Initialize to an appropriate value
string sourcePath = string.Empty; // TODO: Initialize to an appropriate value
string destinationPath = string.Empty; // TODO: Initialize to an appropriate value
string searchPattern = string.Empty; // TODO: Initialize to an appropriate value
AsyncCallback asyncCallback = null; // TODO: Initialize to an appropriate value
object state = null; // TODO: Initialize to an appropriate value
IAsyncResult expected = null; // TODO: Initialize to an appropriate value
IAsyncResult actual;
actual = target.BeginSynchronizeDirectories(sourcePath, destinationPath, searchPattern, asyncCallback, state);
Assert.AreEqual(expected, actual);
Assert.Inconclusive("Verify the correctness of this test method.");
}