Ejemplo n.º 1
0
        public static void Main(string[] args)
        {
#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.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 message = Console.ReadLine();
                Client.SendChatMessage(message); //TODO: Handle stuff interms of commands.
            }
        }
Ejemplo n.º 2
0
 public KeepAliveManager(CoCClient client)
 {
     Client = client;
     NextKeepAlive = DateTime.Now;
     LastKeepAlive = DateTime.MaxValue;
     KeepAliveThread = new Thread(UpdateKeepAlives);
 }
Ejemplo n.º 3
0
        public static void Main(string[] args)
        {
            #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.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 message = Console.ReadLine();
                Client.SendChatMessage(message); //TODO: Handle stuff interms of commands.
            }
        }
Ejemplo n.º 4
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;

            Kernal = new StandardKernel();
            Kernal.Load(Assembly.GetExecutingAssembly());

            Console.WriteLine("Starting proxy server...");
            ProxyService = Kernal.Get<IProxyService>();
            ProxyService.Start();

            // TODO: Setup visitor design pattern so that 1 or more implementations can be notified of these events.
            Configuration = ClientConfiguration.LoadConfiguration("clientConfig.xml");
            Client = new CoCClient();
            Client.Login += OnLogin;
            Client.ChatMessage += OnChatMessage;
            Client.AllianceInfo += ProxyService.OnAllianceInfo;
            Client.Avatar.ID = Configuration.UserID;
            Client.Avatar.Token = Configuration.UserToken;

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

            Console.WriteLine("Waiting for commands..");

            while (true)
            {
                var input = Console.ReadLine();

                if (string.IsNullOrWhiteSpace(input))
                    continue;

                if (input[0] == '/')
                {
                    var command = input.Substring(1).Split(' ');

                    switch (command[0])
                    {
                        case "a":
                            Client.SendAllianceInfoRequest(long.Parse(command[1]));
                            break;
                    }
                }
                else
                    Client.SendChatMessage(input);
            }
        }
Ejemplo n.º 5
0
 public KeepAliveManager(CoCClient client)
 {
     Client          = client;
     NextKeepAlive   = DateTime.Now;
     LastKeepAlive   = DateTime.MaxValue;
     KeepAliveThread = new Thread(UpdateKeepAlives);
 }
Ejemplo n.º 6
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);
                }
            }
        }
Ejemplo n.º 7
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
                    });
                }
            }
        }
Ejemplo n.º 8
0
        public static void Main(string[] args)
        {
            #if DEBUG
            args = new string[]
            {
                "52.24.108.178",
                "9339"
            };
            #endif
            Client = new CoCClient();
            Client.ChatMessage += OnChatMessage;
            var ipAddresses = Dns.GetHostAddresses(args[0]);
            var port = int.Parse(args[1]);
            var endPoint = new IPEndPoint(ipAddresses[0], port);
            Console.WriteLine("Connecting to {0}...", endPoint.Address);
            Client.Connect(endPoint);

            while (true)
            {
                var message = Console.ReadLine();
                Client.SendChatMessage(message);
            }
        }
Ejemplo n.º 9
0
        public static void Main(string[] args)
        {
#if DEBUG
            args = new string[]
            {
                "52.24.108.178",
                "9339"
            };
#endif
            Client              = new CoCClient();
            Client.ChatMessage += OnChatMessage;
            var ipAddresses = Dns.GetHostAddresses(args[0]);
            var port        = int.Parse(args[1]);
            var endPoint    = new IPEndPoint(ipAddresses[0], port);
            Console.WriteLine("Connecting to {0}...", endPoint.Address);
            Client.Connect(endPoint);

            while (true)
            {
                var message = Console.ReadLine();
                Client.SendChatMessage(message);
            }
        }