Granados.Poderosa.SFTP.SFTPClient.GetFileInformations C# (CSharp) Method

GetFileInformations() public method

Get file informations.
Operation failed. Timeout has occured. Invalid status An exception which was thrown while processing the response.
public GetFileInformations ( string path, bool lstat ) : Granados.Poderosa.SFTP.SFTPFileAttributes
path string File path.
lstat bool Specifies to use lstat. Symbolic link is not followed and informations about the symbolic link are returned.
return Granados.Poderosa.SFTP.SFTPFileAttributes
        public SFTPFileAttributes GetFileInformations(string path, bool lstat)
        {
            CheckStatus();

            uint requestId = ++_requestId;

            byte[] pathData = _encoding.GetBytes(path);
            SFTPPacket packet =
                new SFTPPacket(lstat ? SFTPPacketType.SSH_FXP_LSTAT : SFTPPacketType.SSH_FXP_STAT)
                        .WriteUInt32(requestId)
                        .WriteAsString(pathData);

            bool result = false;
            SFTPFileAttributes attributes = null;

            _eventHandler.ClearResponseBuffer();
            Transmit(packet);
            _eventHandler.WaitResponse(
                delegate(SFTPPacketType packetType, SSHDataReader dataReader) {
                    if (packetType == SFTPPacketType.SSH_FXP_STATUS) {
                        SFTPClientErrorException exception = SFTPClientErrorException.Create(dataReader);
                        if (exception.ID == requestId) {
                            throw exception;
                        }
                    }
                    else if (packetType == SFTPPacketType.SSH_FXP_ATTRS) {
                        uint id = dataReader.ReadUInt32();
                        if (id == requestId) {
                            attributes = ReadFileAttributes(dataReader);
                            result = true;   // Ok, received SSH_FXP_ATTRS
                            return true;    // processed
                        }
                    }

                    return false;   // ignored
                },
                _protocolTimeout
            );

            // sanity check
            if (!Volatile.Read(ref result)) {
                throw new SFTPClientException("Missing SSH_FXP_ATTRS");
            }

            return attributes;
        }