Beispiel #1
0
        private void incomingTroopProgress(object sender, DoWorkEventArgs e)
        {
            object[] parameters = e.Argument as object[];

            string  server  = parameters[0].ToString();
            Village village = (Village)parameters[1];

            village.refreshIncoming();

            TroopsMove troop = new TroopsMove();

            string final = "";

            HtmlAgilityPack.HtmlDocument initial = request.incomingTroopRequest(server, 1);
            int count = troop.getRequestNumber(troop.troopCount(initial));

            if (count == 0)
            {
                doMessage(flag.incoming_troop_handling, count, final);
            }
            else if (count == -1)
            {
                doMessage(flag.outgoing_troop_handling, count, "noRally");
            }
            else
            {
                final += troop.troopDecode(initial, village);

                for (int i = 2; i < count; i++)
                {
                    final += troop.troopDecode(request.incomingTroopRequest(server, i), village);
                }
                doMessage(flag.incoming_troop_handling, count, final);
            }
        }