using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; namespace System { /// Manipulates arrays of primitive types. /// 2 // Token: 0x02000642 RID: 1602 [ComVisible(true)] public static class Buffer { /// Returns the number of bytes in the specified array. /// The number of bytes in the array. /// An array. /// /// is null. /// /// is not a primitive. /// 1 // Token: 0x06003B63 RID: 15203 RVA: 0x000CA5FC File Offset: 0x000C87FC public static int ByteLength(Array array) { if (array == null) { throw new ArgumentNullException("array"); } int num = Buffer.ByteLengthInternal(array); if (num < 0) { throw new ArgumentException(Locale.GetText("Object must be an array of primitives.")); } return num; } /// Retrieves the byte at a specified location in a specified array. /// Returns the byte in the array. /// An array. /// A location in the array. /// /// is not a primitive. /// /// is null. /// /// is negative or greater than the length of . /// 1 // Token: 0x06003B64 RID: 15204 RVA: 0x000CA63C File Offset: 0x000C883C public static byte GetByte(Array array, int index) { if (index < 0 || index >= Buffer.ByteLength(array)) { throw new ArgumentOutOfRangeException("index", Locale.GetText("Value must be non-negative and less than the size of the collection.")); } return Buffer.GetByteInternal(array, index); } /// Assigns a specified value to a byte at a particular location in a specified array. /// An array. /// A location in the array. /// A value to assign. /// /// is not a primitive. /// /// is null. /// /// is negative or greater than the length of . /// 1 // Token: 0x06003B65 RID: 15205 RVA: 0x000CA670 File Offset: 0x000C8870 public static void SetByte(Array array, int index, byte value) { if (index < 0 || index >= Buffer.ByteLength(array)) { throw new ArgumentOutOfRangeException("index", Locale.GetText("Value must be non-negative and less than the size of the collection.")); } Buffer.SetByteInternal(array, index, (int)value); } /// Copies a specified number of bytes from a source array starting at a particular offset to a destination array starting at a particular offset. /// The source buffer. /// The zero-based byte offset into . /// The destination buffer. /// The zero-based byte offset into . /// The number of bytes to copy. /// /// or is null. /// /// or is not an array of primitives.-or- The length of is less than plus .-or- The length of is less than plus . /// /// , , or is less than 0. /// 1 // Token: 0x06003B66 RID: 15206 RVA: 0x000CA6B0 File Offset: 0x000C88B0 public static void BlockCopy(Array src, int srcOffset, Array dst, int dstOffset, int count) { if (src == null) { throw new ArgumentNullException("src"); } if (dst == null) { throw new ArgumentNullException("dst"); } if (srcOffset < 0) { throw new ArgumentOutOfRangeException("srcOffset", Locale.GetText("Non-negative number required.")); } if (dstOffset < 0) { throw new ArgumentOutOfRangeException("dstOffset", Locale.GetText("Non-negative number required.")); } if (count < 0) { throw new ArgumentOutOfRangeException("count", Locale.GetText("Non-negative number required.")); } if (!Buffer.BlockCopyInternal(src, srcOffset, dst, dstOffset, count) && (srcOffset > Buffer.ByteLength(src) - count || dstOffset > Buffer.ByteLength(dst) - count)) { throw new ArgumentException(Locale.GetText("Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.")); } } // Token: 0x06003B67 RID: 15207 [MethodImpl(MethodImplOptions.InternalCall)] private static extern int ByteLengthInternal(Array array); // Token: 0x06003B68 RID: 15208 [MethodImpl(MethodImplOptions.InternalCall)] private static extern byte GetByteInternal(Array array, int index); // Token: 0x06003B69 RID: 15209 [MethodImpl(MethodImplOptions.InternalCall)] private static extern void SetByteInternal(Array array, int index, int value); // Token: 0x06003B6A RID: 15210 [MethodImpl(MethodImplOptions.InternalCall)] internal static extern bool BlockCopyInternal(Array src, int src_offset, Array dest, int dest_offset, int count); } }