Beispiel #1
0
        public unsafe override int ReadByte()
        {
            if (this.aH == IntPtr.Zero)
            {
                throw new ObjectDisposedException(null);
            }
            byte result;
            int  num = MacOSXVirtualFileStream.VirtualFileStream_Read(this.aH, (IntPtr)((void *)(&result)), 1);

            if (num < 0)
            {
                throw new IOException("Reading file failed.");
            }
            if (num == 0)
            {
                return(-1);
            }
            this.ah++;
            return((int)result);
        }
Beispiel #2
0
        public override int ReadUnmanaged(IntPtr buffer, int count)
        {
            if (this.aH == IntPtr.Zero)
            {
                throw new ObjectDisposedException(null);
            }
            if (count < 0)
            {
                throw new ArgumentOutOfRangeException("count");
            }
            if (count == 0)
            {
                return(0);
            }
            int num = MacOSXVirtualFileStream.VirtualFileStream_Read(this.aH, buffer, count);

            if (num < 0)
            {
                throw new IOException("Reading file failed.");
            }
            this.ah += num;
            return(num);
        }