예제 #1
0
        private void Respond()
        {
            Message message = default(Message);

            while (true)
            {
                if (messageQueue.TryDequeue(out message))
                {
                    //saveThese.Save(message);
                    if (message.privateMessage)
                    {
                        Console.WriteLine(message.DisplayPrivateMessage());
                        SendPrivateMessage(message);
                    }
                    else
                    {
                        Console.WriteLine(message.Display());
                        foreach (string person in allClients.Keys)
                        {
                            if (allClients[person].endChat.HasValue)
                            {
                                removeClients.Add(client.UserId, client);
                            }
                            else
                            {
                                allClients[person].Send(message.Display());
                            }
                        }
                    }
                    RemoveClientsAndNotify();
                }
            }
        }