Class<? extends GeneratedMessage> topClazz = PacketTypes.DEMO.get(kind);
if (topClazz == null) {
log.warn("unknown top level message of kind {}", kind);
continue;
}
GeneratedMessage message = PacketTypes.parse(topClazz, data);
full = false;
if (message instanceof CDemoPacket) {
es = CodedInputStream.newInstance(((CDemoPacket) message).getData().toByteArray());
state = State.EMBED;
continue;
} else if (message instanceof CDemoSendTables) {
es = CodedInputStream.newInstance(((CDemoSendTables) message).getData().toByteArray());
state = State.EMBED;
continue;
} else if (message instanceof CDemoFullPacket) {
CDemoFullPacket fullMessage = (CDemoFullPacket)message;
es = CodedInputStream.newInstance(fullMessage.getPacket().getData().toByteArray());
state = State.EMBED;
full = true;
if (!isFiltered(CDemoStringTables.class)) {
return genPeek(fullMessage.getStringTable());
}
} else if (!isFiltered(message.getClass())) {
return genPeek(message);
}
continue;
case EMBED:
if (es.isAtEnd()) {
es = null;
state = State.TOP;
continue;
}
int subKind = es.readRawVarint32();
int subSize = es.readRawVarint32();
byte[] subData = es.readRawBytes(subSize);
Class<? extends GeneratedMessage> subClazz = PacketTypes.EMBED.get(subKind);
if (subClazz == null) {
log.warn("unknown embedded message of kind {}", subKind);
continue;
}
GeneratedMessage subMessage = PacketTypes.parse(subClazz, subData);
if (subMessage instanceof CNETMsg_Tick) {
tick = ((CNETMsg_Tick) subMessage).getTick();
border = border.addNetTickBorder();
if (!isFiltered(CNETMsg_Tick.class)) {
return genPeek(subMessage);
}
} else if (subMessage instanceof CSVCMsg_UserMessage) {
if (!isFiltered(CSVCMsg_UserMessage.class)) {
CSVCMsg_UserMessage userMessage = (CSVCMsg_UserMessage) subMessage;
Class<? extends GeneratedMessage> umClazz = PacketTypes.USERMSG.get(userMessage.getMsgType());
if (umClazz == null) {
log.warn("unknown usermessage of kind {}", userMessage.getMsgType());
continue;
} else if (!isFiltered(umClazz)) {
return genPeek(PacketTypes.parse(umClazz, userMessage.getMsgData().toByteArray()));
}
}
} else if (!isFiltered(subMessage.getClass())) {
return genPeek(subMessage);
}
continue;
}
}