本文整理汇总了C#中SftpClient.EndSynchronizeDirectories方法的典型用法代码示例。如果您正苦于以下问题:C# SftpClient.EndSynchronizeDirectories方法的具体用法?C# SftpClient.EndSynchronizeDirectories怎么用?C# SftpClient.EndSynchronizeDirectories使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SftpClient
的用法示例。
在下文中一共展示了SftpClient.EndSynchronizeDirectories方法的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: EndSynchronizeDirectoriesTest
public void EndSynchronizeDirectoriesTest()
{
ConnectionInfo connectionInfo = null; // TODO: Initialize to an appropriate value
SftpClient target = new SftpClient(connectionInfo); // TODO: Initialize to an appropriate value
IAsyncResult asyncResult = null; // TODO: Initialize to an appropriate value
IEnumerable<FileInfo> expected = null; // TODO: Initialize to an appropriate value
IEnumerable<FileInfo> actual;
actual = target.EndSynchronizeDirectories(asyncResult);
Assert.AreEqual(expected, actual);
Assert.Inconclusive("Verify the correctness of this test method.");
}