public PointerData(PointerDataType dataType, BinaryReader reader, Dictionary <string, object> options) : base(dataType) { if (!options.ContainsKey("offset")) { throw new Exception("Wrong parameters for reading ListData"); } RefType = dataType.RefType; Length = RefType.PointerWidth; // moving to start of pointer so that RefType can read it's own options from that point Offset = (int)options["offset"]; reader.BaseStream.Seek(DatContainer.DataSectionOffset + Offset, SeekOrigin.Begin); // only RefType knows how to read it's parameters var refParams = RefType.ReadPointer(reader); var listDataType = RefType as ListDataType; if (listDataType != null) { RefData = (Length == 8) ? TypeFactory.CreateData(listDataType, reader, refParams) : TypeFactory64.CreateData(listDataType, reader, refParams); //8 or 16 } else { RefData = (Length == 4) ? TypeFactory.CreateData(RefType, reader, refParams) : TypeFactory64.CreateData(RefType, reader, refParams); //4 or 8 } DatContainer.DataPointers[Offset] = this; }
private static extern void indexPointer(PointerDataType type, int stride, IntPtr array);
private static extern void vertexPointer(int size, PointerDataType type, int stride, IntPtr array);
static extern void colorPointer(int size, PointerDataType type, int stride, IntPtr array);