Exemplo n.º 1
0
        //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);
        }
Exemplo n.º 2
0
        public int EndRead(IAsyncResult asyncResult, bool leaveInUse = false)
        {
            int i = RealStream.EndRead(asyncResult);

            InUse = leaveInUse;
            return(i);
        }
Exemplo n.º 3
0
        public long Seek(long offset, SeekOrigin origin)
        {
            long l = RealStream.Seek(offset, origin);

            InUse = false;
            return(l);
        }
Exemplo n.º 4
0
        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);
        }
Exemplo n.º 5
0
 public void EndWrite(IAsyncResult asyncResult, bool leaveInUse = false)
 {
     RealStream.EndWrite(asyncResult);
     InUse = leaveInUse;
 }
Exemplo n.º 6
0
 public IAsyncResult BeginWrite(byte[] array, int offset, int numBytes, AsyncCallback userCallback, object stateObject)
 {
     return(RealStream.BeginWrite(array, offset, numBytes, userCallback, stateObject));
 }
Exemplo n.º 7
0
 public async Task <int> ReadAsync(byte[] array, int offset, int numBytes)
 {
     return(await RealStream.ReadAsync(array, offset, numBytes));
 }
Exemplo n.º 8
0
 public void Write(byte[] array, int offset, int count)
 {
     RealStream.Write(array, offset, count);
     InUse = false;
 }
Exemplo n.º 9
0
 public void SetLength(long value, bool leaveInUse = false)
 {
     RealStream.SetLength(value);
     InUse = leaveInUse;
 }
Exemplo n.º 10
0
 public void EndWrite(IAsyncResult asyncResult)
 {
     RealStream.EndWrite(asyncResult);
     InUse = false;
 }
Exemplo n.º 11
0
 public void SetLength(long value)
 {
     RealStream.SetLength(value);
     InUse = false;
 }