Renci.SshNet.Sftp.SftpSession.RequestReadDir C# (CSharp) Method

RequestReadDir() public method

Performs SSH_FXP_READDIR request
public RequestReadDir ( byte handle ) : SftpFileAttributes>[].KeyValuePair
handle byte The handle.
return SftpFileAttributes>[].KeyValuePair
        public KeyValuePair<string, SftpFileAttributes>[] RequestReadDir(byte[] handle)
        {
            SshException exception = null;

            KeyValuePair<string, SftpFileAttributes>[] result = null;

            using (var wait = new AutoResetEvent(false))
            {
                var request = new SftpReadDirRequest(ProtocolVersion, NextRequestId, handle,
                    response =>
                        {
                            result = response.Files;
                            wait.Set();
                        },
                    response =>
                        {
                            if (response.StatusCode != StatusCodes.Eof)
                            {
                                exception = GetSftpException(response);
                            }
                            wait.Set();
                        });

                SendRequest(request);

                WaitOnHandle(wait, OperationTimeout);
            }

            if (exception != null)
            {
                throw exception;
            }

            return result;
        }