protected override void Dispose(bool disposing) { if (disposing) { ParentStream.Dispose(); } }
public override int Read(byte[] buffer, int offset, int count) { token.ThrowIfCancellationRequested(); int num = ParentStream.Read(buffer, offset, count); ReadCallback(num); return(num); }
public override async Task <int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { token.ThrowIfCancellationRequested(); CancellationTokenSource cancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(token, cancellationToken); int num = await ParentStream.ReadAsync(buffer, offset, count, cancellationTokenSource.Token); ReadCallback(num); return(num); }
public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { token.ThrowIfCancellationRequested(); CancellationTokenSource cancellationTokenSource = CancellationTokenSource.CreateLinkedTokenSource(token, cancellationToken); Task result = ParentStream.WriteAsync(buffer, offset, count, cancellationTokenSource.Token); WriteCallback(count); return(result); }
public override async Task <int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { _token.ThrowIfCancellationRequested(); var linked = CancellationTokenSource.CreateLinkedTokenSource(_token, cancellationToken); var readCount = await ParentStream.ReadAsync(buffer, offset, count, linked.Token); ReadCallback(readCount); return(readCount); }
public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { _token.ThrowIfCancellationRequested(); var linked = CancellationTokenSource.CreateLinkedTokenSource(_token, cancellationToken); var task = ParentStream.WriteAsync(buffer, offset, count, linked.Token); WriteCallback(count); return(task); }
public override long Seek(long offset, SeekOrigin origin) { token.ThrowIfCancellationRequested(); try { return(ParentStream.Seek(offset, origin)); } catch (Exception e) { if (exceptionMapper != null) { exceptionMapper(e); } throw e; } }
public override void SetLength(long value) { token.ThrowIfCancellationRequested(); try { ParentStream.SetLength(value); } catch (Exception e) { if (exceptionMapper != null) { exceptionMapper(e); } throw e; } }
public override void Write(byte[] buffer, int offset, int count) { token.ThrowIfCancellationRequested(); try { ParentStream.Write(buffer, offset, count); } catch (Exception e) { if (exceptionMapper != null) { exceptionMapper(e); } throw e; } WriteCallback(count); }
public override int Read(byte[] buffer, int offset, int count) { token.ThrowIfCancellationRequested(); try { var readCount = ParentStream.Read(buffer, offset, count); ReadCallback(readCount); return(readCount); } catch (Exception e) { if (exceptionMapper != null) { exceptionMapper(e); } throw e; } }
public override long Seek(long offset, SeekOrigin origin) { if (origin == SeekOrigin.Begin || origin == SeekOrigin.End) { offset += startPosition; } if (origin == SeekOrigin.End) { offset += Length; origin = SeekOrigin.Begin; } ParentStream.Seek(offset, origin); return(Position); }
public override Task WriteAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { token.ThrowIfCancellationRequested(); var linked = CancellationTokenSource.CreateLinkedTokenSource(token, cancellationToken); var task = default(Task); try { task = ParentStream.WriteAsync(buffer, offset, count, linked.Token); } catch (Exception e) { if (exceptionMapper != null) { exceptionMapper(e); } throw e; } WriteCallback(count); return(task); }
public override async Task <int> ReadAsync(byte[] buffer, int offset, int count, CancellationToken cancellationToken) { token.ThrowIfCancellationRequested(); var linked = CancellationTokenSource.CreateLinkedTokenSource(token, cancellationToken); int readCount; try { readCount = await ParentStream.ReadAsync(buffer, offset, count, linked.Token); } catch (Exception e) { if (exceptionMapper != null) { exceptionMapper(e); } throw e; } ReadCallback(readCount); return(readCount); }
public override void Write(byte[] buffer, int offset, int count) { ParentStream.Write(buffer, offset, count); }
public override void SetLength(long value) { ParentStream.SetLength(value); }
public override void SetLength(long value) { token.ThrowIfCancellationRequested(); ParentStream.SetLength(value); }
public override void Flush() { ParentStream.Flush(); }
public override Task FlushAsync(CancellationToken cancellationToken) { return(ParentStream.FlushAsync(cancellationToken)); }
public override int Read(byte[] buffer, int offset, int count) { return(ParentStream.Read(buffer, offset, count)); }
public override long Seek(long offset, SeekOrigin origin) { token.ThrowIfCancellationRequested(); return(ParentStream.Seek(offset, origin)); }
public override long Seek(long offset, SeekOrigin origin) { return(ParentStream.Seek(offset, origin)); }
public override void Write(byte[] buffer, int offset, int count) { token.ThrowIfCancellationRequested(); ParentStream.Write(buffer, offset, count); WriteCallback(count); }
public override int Read(byte[] buffer, int offset, int count) { count = Math.Min((int)Math.Max(Length - Position, (long)0), count); return(ParentStream.Read(buffer, offset, count)); }