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

RequestStat() private method

Performs SSH_FXP_STAT request.
private RequestStat ( string path, bool nullOnError = false ) : SftpFileAttributes
path string The path.
nullOnError bool if set to true returns null instead of throwing an exception.
return SftpFileAttributes
        internal SftpFileAttributes RequestStat(string path, bool nullOnError = false)
        {
            SshException exception = null;

            SftpFileAttributes attributes = null;

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

                SendRequest(request);

                WaitOnHandle(wait, OperationTimeout);
            }

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

            return attributes;
        }