public AIChunk(BinaryReader reader) { type = reader.ReadInt16(); switch (type) { case 1: type1Data = new Type1(); type1Data.ReadFromFile(reader); break; case 4: type4Data = new Type4(); type4Data.ReadFromFile(reader); break; case 7: type7Data = new Type7(); type7Data.ReadFromFile(reader); break; case 8: type8Data = new Type8(); type8Data.ReadFromFile(reader); type8Int = reader.ReadInt32(); break; case 9: type8Data = new Type8(); type8Data.ReadFromFile(reader); break; case 11: type11Data = new Type11(); type11Data.ReadFromFile(reader); break; default: throw new Exception("Unknown type"); } }