//private long _lastEndOfFileOffset = -1; public long Seek(long offset, SeekOrigin origin, bool leaveInUse = false) { //#if (_Linux) // // linux doesn't expand the file if seek-ed beyond eof... // if (RealStream.Length < offset) // RealStream.SetLength(offset); //#endif InUse = true; long l = RealStream.Seek(offset, origin); //if (origin == SeekOrigin.End && offset >= 0) //{ // if (l < _lastEndOfFileOffset + offset) // { // l = _lastEndOfFileOffset + offset; // RealStream.Seek(l, SeekOrigin.Begin); // } // _lastEndOfFileOffset = l; //} if (!leaveInUse) { InUse = leaveInUse; } return(l); }
public int EndRead(IAsyncResult asyncResult, bool leaveInUse = false) { int i = RealStream.EndRead(asyncResult); InUse = leaveInUse; return(i); }
public long Seek(long offset, SeekOrigin origin) { long l = RealStream.Seek(offset, origin); InUse = false; return(l); }
public int Read([In, Out] byte[] array, int offset, int count) { int i; if (count <= (int)512) //DataBlockSize.Minimum) { i = RealStream.Read(array, offset, count); } else { IAsyncResult iar = RealStream.BeginRead(array, offset, count, null, null); if (!iar.IsCompleted) { iar.AsyncWaitHandle.WaitOne(); } i = RealStream.EndRead(iar); } InUse = false; return(i); }
public void EndWrite(IAsyncResult asyncResult, bool leaveInUse = false) { RealStream.EndWrite(asyncResult); InUse = leaveInUse; }
public IAsyncResult BeginWrite(byte[] array, int offset, int numBytes, AsyncCallback userCallback, object stateObject) { return(RealStream.BeginWrite(array, offset, numBytes, userCallback, stateObject)); }
public async Task <int> ReadAsync(byte[] array, int offset, int numBytes) { return(await RealStream.ReadAsync(array, offset, numBytes)); }
public void Write(byte[] array, int offset, int count) { RealStream.Write(array, offset, count); InUse = false; }
public void SetLength(long value, bool leaveInUse = false) { RealStream.SetLength(value); InUse = leaveInUse; }
public void EndWrite(IAsyncResult asyncResult) { RealStream.EndWrite(asyncResult); InUse = false; }
public void SetLength(long value) { RealStream.SetLength(value); InUse = false; }