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

RequestReadLink() private method

Performs SSH_FXP_READLINK request.
private RequestReadLink ( string path, bool nullOnError = false ) : SftpFileAttributes>[].KeyValuePair
path string The path.
nullOnError bool if set to true returns null instead of throwing an exception.
return SftpFileAttributes>[].KeyValuePair
        internal KeyValuePair<string, SftpFileAttributes>[] RequestReadLink(string path, bool nullOnError = false)
        {
            if (ProtocolVersion < 3)
            {
                throw new NotSupportedException(string.Format(CultureInfo.CurrentCulture, "SSH_FXP_READLINK operation is not supported in {0} version that server operates in.", ProtocolVersion));
            }

            SshException exception = null;

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

            using (var wait = new AutoResetEvent(false))
            {
                var request = new SftpReadLinkRequest(ProtocolVersion, NextRequestId, path, Encoding,
                    response =>
                        {
                            result = response.Files;
                            wait.Set();
                        },
                    response =>
                        {
                            exception = GetSftpException(response);
                            wait.Set();
                        });

                SendRequest(request);

                WaitOnHandle(wait, OperationTimeout);
            }

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

            return result;
        }