Пример #1
0
        static void Main(string[] args)
        {
            var user       = args[0];
            var chatRoom   = args[1];
            var serverName = args.Length > 2
                ? args[3]
                : "ubuntustore.cloudapp.net";

            IPAddress[] ipAddresses = Dns.GetHostAddresses(serverName);
            Chatter.Init(ipAddresses.First().ToString());
            Chatter.Subscribe(
                chatRoom,
                OnRecieved);
            while (Running)
            {
                if (Chatter.Connected)
                {
                    var message = System.Console.ReadLine();
                    if (message == "!q")
                    {
                        Running = false;
                    }
                    else
                    {
                        Chatter.SendMessage(message, user, chatRoom);
                    }
                }
                else
                {
                    Thread.Sleep(100);
                }
            }
        }