public void HandleOut(BNCSPacket packet) { int offset = 0; switch ((PacketIDConstants)packet.ID) { case PacketIDConstants.SID_CHATCOMMAND: string text = readString(packet.Data, ref offset); if (null != OnCommand) OnCommand(packet.Timestamp, text); break; } }
public void HandleIn(BNCSPacket packet) { int offset = 0; switch ((PacketIDConstants)packet.ID) { case PacketIDConstants.SID_CHATEVENT: /* http://www.bnetdocs.org/?op=packet&pid=307 */ UInt32 Event = readDWord(packet.Data, ref offset); offset = 0x18; string username = readString(packet.Data, ref offset); string text = readString(packet.Data, ref offset); switch (Event) { case 0x01: case 0x02: if (null != OnJoin) OnJoin(packet.Timestamp, username); break; case 0x03: if (null != OnLeave) OnLeave(packet.Timestamp, username); break; case 0x04: HandleWhisper(packet.Timestamp, username, text); break; case 0x05: if (null != OnTalk) OnTalk(packet.Timestamp, username, text); break; case 0x07: if (null != OnEnter) OnEnter(packet.Timestamp, text); break; case 0x17: if (null != OnEmote) OnEmote(packet.Timestamp, username, text); break; } break; } }