/// <summary> /// Reads a chunk ID and chunk size. /// </summary> /// <returns>The chunk ID at the current location.</returns> protected short ReadFileChunk(BinaryMemoryReader reader) { // get the chunk id short id = reader.ReadInt16(); // read the length for this chunk currentChunkLength = reader.ReadInt32(); return(id); }
/// <summary> /// Reads a specified number of integers and copies them into the destination pointer. /// </summary> /// <param name="count">Number of values to read.</param> /// <param name="dest">Pointer to copy the values into.</param> protected void ReadInts(BinaryMemoryReader reader, int count, IntPtr dest) { // blast the data into the buffer unsafe { int *pointer = (int *)dest.ToPointer(); for (int i = 0; i < count; i++) { pointer[i] = reader.ReadInt32(); } } }
protected int ReadInt(BinaryMemoryReader reader) { return(reader.ReadInt32()); }