private int ExtractEvents() { //sequence of bytes indicates the start of the collection of events. var eventDataStart = FindByteSequence(new List <byte>() { 20, 128, 255, 255, 255, 255, 255, 255 }); if (eventDataStart.Count != 1) { return(-1); } //extracts all events from area, which are all 18 bytes long. Complex events are stored afterwards, with the event entries here //likely being an index for them. Complex events not currently handled. int id = 0; int count = 0; while (true) { int parentOffset = eventDataStart[0] + 2 + (18 * count); byte[] eventData = new byte[18]; for (int i = 0; i < 18; i++) { eventData[i] = ReadByte(parentOffset + i); } id = eventData[EventOffsets.Id]; /* * if (id == 0) * { * count++; * continue; * } * if (id == count - 1) * { * count++; * continue; * }*/ if (id != count) { break; } var nEvent = new EventObject(this, parentOffset); EventData.AddMappedObject(nEvent); count++; } return(eventDataStart[0] + 2 + (18 * count)); }