Example #1
0
        public override unsafe int Read(byte[] buffer, int offset, int count)
        {
            byte[] buffer2;
            if (!this.CanRead)
            {
                throw new NotImplementedException("Stream open for writing only");
            }
            if (offset == 0)
            {
                buffer2 = buffer;
            }
            else
            {
                buffer2 = new byte[count];
            }
            uint len  = (uint)count;
            int  num2 = MobileDevice.AFCFileRefRead(this.phone.AFCHandle, this.handle, buffer2, ref len);

            if (num2 != 0)
            {
                throw new IOException("AFCFileRefRead error = " + num2.ToString());
            }
            if (buffer2 != buffer)
            {
                Buffer.BlockCopy(buffer2, 0, buffer, offset, (int)len);
            }
            return((int)len);
        }