예제 #1
0
        /// <summary>
        /// Writes the content of a buffer into a LargeObject.
        /// </summary>
        /// <param name="buffer">The buffer.</param>
        /// <param name="largeObject">The large object.</param>
        /// <param name="rpu">The rpu.</param>
        /// <param name="caller">The calling object.</param>
        /// <remarks>Documented by Dev02, 2008-08-08</remarks>
        private void BufferToLargeObject(byte[] buffer, LargeObject largeObject, StatusMessageReportProgress rpu, object caller)
        {
            largeObject.Seek(0);

            int offset = 0;
            int size = buffer.Length;
            StatusMessageEventArgs args = new StatusMessageEventArgs(StatusMessageType.CreateMediaProgress, buffer.Length);
            while (offset < size)
            {
                largeObject.Write(buffer, offset, Math.Min(chunkSize, size - offset));
                offset += chunkSize;
                args.Progress = offset;
                if (rpu != null)
                    rpu(args, caller);
            }
        }
예제 #2
0
        /// <summary>
        /// Gets the contents of a LargeObject into a buffer.
        /// </summary>
        /// <param name="largeObject">The large object.</param>
        /// <returns></returns>
        /// <remarks>Documented by Dev02, 2008-08-08</remarks>
        private byte[] LargeObjectToBuffer(LargeObject largeObject)
        {
            largeObject.Seek(0);
            int size = largeObject.Size();
            byte[] buffer = new byte[size];

            int offset = 0;
            while (offset < size)
            {
                largeObject.Read(buffer, offset, Math.Min(chunkSize, size - offset));
                offset += chunkSize;
            }

            return buffer;
        }
예제 #3
0
        /// <summary>
        /// Writes the content of a buffer into a LargeObject.
        /// </summary>
        /// <param name="buffer">The buffer.</param>
        /// <param name="largeObject">The large object.</param>
        /// <remarks>Documented by Dev02, 2008-08-08</remarks>
        private void BufferToLargeObject(byte[] buffer, LargeObject largeObject)
        {
            largeObject.Seek(0);

            int offset = 0;
            int size = buffer.Length;
            while (offset < size)
            {
                largeObject.Write(buffer, offset, Math.Min(chunkSize, size - offset));
                offset += chunkSize;
            }
        }