public void Send(IPacket packet) { ConsoleColor color = Console.ForegroundColor; Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine((WMSG)packet.Code); Console.ForegroundColor = color; lock (this) { Stream data = GetStream(); Stream head = cryptor.EncryptStream(data); WriteSize(head, packet); WriteCode(head, packet); packet.WriteBody(data); } }