Exemplo n.º 1
0
        /// <exception cref="WinrtCifs.Smb.SmbException"></exception>
        public virtual int Read(byte[] b, int off, int len)
        {
            if (len <= 0)
            {
                return(0);
            }
            long start = _fp;

            // ensure file is open
            if (_file.IsOpen() == false)
            {
                _file.Open(_openFlags, 0, SmbFile.AttrNormal, _options);
            }
            int r;
            int n;
            SmbComReadAndXResponse response = new SmbComReadAndXResponse(b, off);

            do
            {
                r = len > _readSize ? _readSize : len;
                _file.Send(new SmbComReadAndX(_file.Fid, _fp, r, null), response);
                if ((n = response.DataLength) <= 0)
                {
                    return((int)((_fp - start) > 0L ? _fp - start : -1));
                }
                _fp          += n;
                len          -= n;
                response.Off += n;
            }while (len > 0 && n == r);
            return((int)(_fp - start));
        }
Exemplo n.º 2
0
 public virtual bool IsOpen()
 {
     return(_file.IsOpen());
 }