本文整理汇总了C#中SftpClient.EndListDirectory方法的典型用法代码示例。如果您正苦于以下问题:C# SftpClient.EndListDirectory方法的具体用法?C# SftpClient.EndListDirectory怎么用?C# SftpClient.EndListDirectory使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SftpClient
的用法示例。
在下文中一共展示了SftpClient.EndListDirectory方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Test_Sftp_Call_EndListDirectory_Twice
public void Test_Sftp_Call_EndListDirectory_Twice()
{
using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
{
sftp.Connect();
var ar = sftp.BeginListDirectory("/", null, null);
var result = sftp.EndListDirectory(ar);
var result1 = sftp.EndListDirectory(ar);
}
}
示例2: Test_Sftp_Ensure_Async_Delegates_Called_For_BeginFileUpload_BeginFileDownload_BeginListDirectory
public void Test_Sftp_Ensure_Async_Delegates_Called_For_BeginFileUpload_BeginFileDownload_BeginListDirectory()
{
using (var sftp = new SftpClient(Resources.HOST, Resources.USERNAME, Resources.PASSWORD))
{
sftp.Connect();
string remoteFileName = Path.GetRandomFileName();
string localFileName = Path.GetRandomFileName();
bool uploadDelegateCalled = false;
bool downloadDelegateCalled = false;
bool listDirectoryDelegateCalled = false;
IAsyncResult asyncResult;
// Test for BeginUploadFile.
CreateTestFile(localFileName, 1);
using (var fileStream = File.OpenRead(localFileName))
{
asyncResult = sftp.BeginUploadFile(fileStream, remoteFileName, delegate(IAsyncResult ar)
{
sftp.EndUploadFile(ar);
uploadDelegateCalled = true;
}, null);
while (!asyncResult.IsCompleted)
{
Thread.Sleep(500);
}
}
File.Delete(localFileName);
Assert.IsTrue(uploadDelegateCalled, "BeginUploadFile");
// Test for BeginDownloadFile.
asyncResult = null;
using (var fileStream = File.OpenWrite(localFileName))
{
asyncResult = sftp.BeginDownloadFile(remoteFileName, fileStream, delegate(IAsyncResult ar)
{
sftp.EndDownloadFile(ar);
downloadDelegateCalled = true;
}, null);
while (!asyncResult.IsCompleted)
{
Thread.Sleep(500);
}
}
File.Delete(localFileName);
Assert.IsTrue(downloadDelegateCalled, "BeginDownloadFile");
// Test for BeginListDirectory.
asyncResult = null;
asyncResult = sftp.BeginListDirectory(sftp.WorkingDirectory, delegate(IAsyncResult ar)
{
sftp.EndListDirectory(ar);
listDirectoryDelegateCalled = true;
}, null);
while (!asyncResult.IsCompleted)
{
Thread.Sleep(500);
}
Assert.IsTrue(listDirectoryDelegateCalled, "BeginListDirectory");
}
}
示例3: EndListDirectoryTest
public void EndListDirectoryTest()
{
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<SftpFile> expected = null; // TODO: Initialize to an appropriate value
IEnumerable<SftpFile> actual;
actual = target.EndListDirectory(asyncResult);
Assert.AreEqual(expected, actual);
Assert.Inconclusive("Verify the correctness of this test method.");
}