Ejemplo n.º 1
0
        public bool Equals(Nfs3ReadResult other)
        {
            if (other == null)
            {
                return(false);
            }

            return(other.Status == Status &&
                   object.Equals(other.FileAttributes, FileAttributes) &&
                   other.Count == Count
#if !NET20
                   && Enumerable.SequenceEqual(other.Data, Data)
#endif
                   && other.Eof == Eof);
        }
Ejemplo n.º 2
0
        public Nfs3ReadResult Read(Nfs3FileHandle fileHandle, long position, int count)
        {
            Nfs3ReadResult result = _nfsClient.Read(fileHandle, position, count);

            if (result.FileAttributes != null)
            {
                _cachedAttributes[fileHandle] = result.FileAttributes;
            }

            if (result.Status == Nfs3Status.Ok)
            {
                return(result);
            }
            throw new Nfs3Exception(result.Status);
        }
Ejemplo n.º 3
0
        public override int Read(byte[] buffer, int offset, int count)
        {
            int            numToRead  = (int)Math.Min(_client.FileSystemInfo.ReadMaxBytes, count);
            Nfs3ReadResult readResult = _client.Read(_handle, _position, numToRead);

            int toCopy = Math.Min(count, readResult.Count);

            Array.Copy(readResult.Data, 0, buffer, offset, toCopy);

            if (readResult.Eof)
            {
                _length = _position + readResult.Count;
            }

            _position += toCopy;
            return(toCopy);
        }