Пример #1
0
        public static void Main(string[] args)
        {
            //TODO: Implement better command line handling.
            #if DEBUG
            args = new string[]
            {
                "gamea.clashofclans.com",
                "9339"
            };
            #endif
            var port = -1;
            var address = (IPAddress)null;
            if (!TryGetPort(args, out port))
                return;
            if (!TryGetIPAddress(args, out address))
                return;

            Configuration = ClientConfiguration.LoadConfiguration("clientConfig.xml");
            Client = new CoCClient();
            Client.Login += OnLogin;
            Client.ChatMessage += OnChatMessage;
            Client.Avatar.ID = Configuration.UserID;
            Client.Avatar.Token = Configuration.UserToken;

            Console.WriteLine("Connecting to {0}:{1}...", address, port);
            Client.Connect(new IPEndPoint(address, port));

            while (true)
            {
                var command = Console.ReadLine();
                if (command[0] == '/')
                    Console.WriteLine("TODO: Handle command.");
                else
                //Client.SendChatMessage(command);
                {
                    Client.SendPacket(new AllianceChatMessageClientPacket()
                    {
                        Message = command
                    });
                }
            }
        }