bool IResourceHandler.Skip(long bytesToSkip, out long bytesSkipped, IResourceSkipCallback callback)
        {
            //We don't need the callback, as it's an unmanaged resource we should dispose it (could wrap it in a using statement).
            callback.Dispose();

            //No Stream or Stream cannot seek then we indicate failure
            if (stream == null || !stream.CanSeek)
            {
                //Indicate failure
                bytesSkipped = -2;

                return(false);
            }

            if (stream.Position == (stream.Length - 1))
            {
                bytesSkipped = 0;

                return(true);
            }

            var oldPosition = stream.Position;

            var position = stream.Seek(bytesToSkip, SeekOrigin.Current);

            bytesSkipped = position - oldPosition;

            return(true);
        }
Ejemplo n.º 2
0
        bool IResourceHandler.Skip(long bytesToSkip, out long bytesSkipped, IResourceSkipCallback callback)
        {
            //We don't need the callback, as it's an unmanaged resource we should dispose it (could wrap it in a using statement).
            callback.Dispose();

            //No Stream or Stream cannot seek then we indicate failure
            if (Stream == 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);
        }
Ejemplo n.º 3
0
 bool IResourceHandler.Skip(long bytesToSkip, out long bytesSkipped, IResourceSkipCallback callback)
 {
     bytesSkipped = -2; // ERR_FAILED
     callback.Dispose();
     return(false);
 }