コード例 #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);
            }
コード例 #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);
    }
コード例 #3
0
 protected override bool Skip(long bytesToSkip, out long bytesSkipped, CefResourceSkipCallback callback)
 {
     bytesSkipped = (long)CefErrorCode.Failed;
     return(false);
 }
コード例 #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);
 }
コード例 #5
0
 protected override bool Skip(long bytesToSkip, out long bytesSkipped, CefResourceSkipCallback callback)
 {
     bytesSkipped = 0;
     return(true);
 }
コード例 #6
0
 public override bool Skip(long bytesToSkip, ref long bytesSkipped, CefResourceSkipCallback callback)
 {
     return(_implementation.Skip(bytesToSkip, ref bytesSkipped, callback));
 }
コード例 #7
0
 protected override bool Skip(long bytesToSkip, out long bytesSkipped, CefResourceSkipCallback callback)
 {
     throw new NotImplementedException();
 }
コード例 #8
0
 protected internal unsafe override bool Skip(long bytesToSkip, ref long bytesSkipped, CefResourceSkipCallback callback)
 {
     return(_implementation.Skip(bytesToSkip, ref bytesSkipped, callback));
 }
コード例 #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);
        }