public static bool WaitForPacket(RealmServerPacket packet, PacketConfirmation confirmation, int timeOut) { bool isBusy = true; Packet.Instance.Sniffer.AddAsyncListener(packet, delegate(object sender, PacketEventArgs args) { Type t = args.Packet.GetType(); if (confirmation(args.Packet)) isBusy = false; }); DateTime start = DateTime.Now; while (isBusy) { if (((TimeSpan)DateTime.Now.Subtract(start)).TotalMilliseconds > timeOut) return false; System.Threading.Thread.Sleep(10); } return true; } public static bool WaitForPacket(GameServerPacket packet, PacketConfirmation confirmation, int timeOut) { bool isBusy = true; Packet.Instance.Sniffer.AddAsyncListener(packet, delegate(object sender, PacketEventArgs args) { Type t = args.Packet.GetType(); if (confirmation(args.Packet)) isBusy = false; }); DateTime start = DateTime.Now; while (isBusy) { if (((TimeSpan)DateTime.Now.Subtract(start)).TotalMilliseconds > timeOut) return false; System.Threading.Thread.Sleep(10); } return true; }