Ejemplo n.º 1
0
            protected override bool Skip(long bytesToSkip, out long bytesSkipped, CefResourceSkipCallback callback)
            {
                if (!_stream.CanSeek)
                {
                    bytesSkipped = -2;
                    return(false);
                }

                bytesSkipped = _stream.Seek(bytesToSkip, SeekOrigin.Begin);
                return(true);
            }
Ejemplo n.º 2
0
    protected override bool Skip(long bytesToSkip, out long bytesSkipped, CefResourceSkipCallback callback)
    {
        //No Stream or Stream cannot seek then we indicate failure
        if (Stream is null || !Stream.CanSeek)
        {
            //Indicate failure
            bytesSkipped = -2;

            return(false);
        }

        bytesSkipped = bytesToSkip;

        Stream.Seek(bytesToSkip, SeekOrigin.Current);

        //If data is available immediately set bytesSkipped to the number of of bytes skipped and return true.
        return(true);
    }
 protected override bool Skip(long bytesToSkip, out long bytesSkipped, CefResourceSkipCallback callback)
 {
     bytesSkipped = (long)CefErrorCode.Failed;
     return(false);
 }
Ejemplo n.º 4
0
 protected internal sealed override bool Skip(long bytesToSkip, ref long bytesSkipped, CefResourceSkipCallback callback)
 {
     if (bytesToSkip < 0)
     {
         bytesSkipped = (long)CefErrorCode.Failed;
         return(false);
     }
     bytesSkipped = Math.Min(_data.Length - _offset, bytesToSkip);
     if (bytesSkipped == 0)
     {
         return(false);
     }
     _offset += (int)bytesSkipped;
     return(true);
 }
 protected override bool Skip(long bytesToSkip, out long bytesSkipped, CefResourceSkipCallback callback)
 {
     bytesSkipped = 0;
     return(true);
 }
Ejemplo n.º 6
0
 public override bool Skip(long bytesToSkip, ref long bytesSkipped, CefResourceSkipCallback callback)
 {
     return(_implementation.Skip(bytesToSkip, ref bytesSkipped, callback));
 }
Ejemplo n.º 7
0
 protected override bool Skip(long bytesToSkip, out long bytesSkipped, CefResourceSkipCallback callback)
 {
     throw new NotImplementedException();
 }
Ejemplo n.º 8
0
 protected internal unsafe override bool Skip(long bytesToSkip, ref long bytesSkipped, CefResourceSkipCallback callback)
 {
     return(_implementation.Skip(bytesToSkip, ref bytesSkipped, callback));
 }
Ejemplo n.º 9
0
        protected internal sealed override bool Skip(long bytesToSkip, ref long bytesSkipped, CefResourceSkipCallback callback)
        {
            if (bytesToSkip < 0)
            {
                bytesSkipped = (long)CefErrorCode.Failed;
                return(false);
            }
            if (_stream.CanSeek)
            {
                long currentPos = _stream.Position;
                bytesSkipped = _stream.Seek(bytesToSkip, SeekOrigin.Current) - currentPos;
                return(bytesSkipped > 0);
            }
            var buffer = new byte[BufferSize];

            SkipBytesInternal(Task.FromResult(buffer.Length), new SkipState {
                Buffer       = new byte[buffer.Length],
                BytesToSkip  = bytesToSkip,
                BytesSkipped = -buffer.Length,
                Callback     = callback,
            });
            bytesSkipped = 0;
            return(true);
        }