Beispiel #1
0
        /// <summary>
        /// Writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.
        /// </summary>
        /// <param name="buffer">An array of bytes. This method copies count bytes from buffer to the current stream.</param>
        /// <param name="offset">The zero-based byte offset in buffer at which to begin copying bytes to the current stream.</param>
        /// <param name="count">The number of bytes to be written to the current stream.</param>
        unsafe public override void Write(byte[] buffer, int offset, int count)
        {
            if (!CanWrite)
            {
                throw new NotImplementedException("Stream open for reading only");
            }

            byte[] temp;

            if (offset == 0)
            {
                temp = buffer;
            }
            else
            {
                temp = new byte[count];
                Buffer.BlockCopy(buffer, offset, temp, 0, count);
            }

            int ret = MobileDevice.AFCFileRefWrite(phone.AFCHandle, handle, temp, (uint)count);
        }