// Helper void GetOffsetRange(int id, int[] table, int chunklen, out int start, out int bound) { if (id < 0 || id >= table.Length) { throw ExHelp.Range("Id {0} is out of range (max {1})", id, table.Length); } start = table[id]; if (id < table.Length - 1) { bound = table[id + 1]; } else { bound = table[0] + chunklen; } }
public static int[] ReadRawInts(BinaryReader br, int count) { if (count < 0) { throw ExHelp.Range("Raw int count: {0}", count); } int[] res = new int[count]; byte[] b = br.ReadBytes(count * 4); for (int i = 0; i < count; i++) { res[i] = BitConverter.ToInt32(b, i * 4); } Debug("read {0} raw ints", count); return(res); }