Пример #1
0
 public void HtmlParserTroopMovements()
 {
     DeserializeLanguage();
     Language language = Languages.GetLanguage("sl-SI");
     Assert.IsNotNull(language, "Language is null!");
     HtmlDocument htmlDocument = new HtmlDocument();
     htmlDocument.Load("..\\..\\Test Files\\RallyPoint.php.html");
     HtmlParser htmlParser = new HtmlParser(htmlDocument, language);
     List<TroopMovement> troopMovements = htmlParser.TroopMovements(new Village().AddId(1).AddName("02"));
     Assert.IsNotNull(troopMovements, "TroopMovement is null!");
     Village village = new Village();
     village.SetTroopMovements(troopMovements);
     Assert.AreEqual(23, village.TroopMovementCount, "Troop movement count!");
     Assert.Sorted(village.TroopMovement, SortOrder.Increasing, new TroopMovementComparer());
     village.ClearTroopMovementsList();
     Assert.AreEqual(0, village.TroopMovementCount, "Troop movement count!");
 }
Пример #2
0
 private void PopulateRallyPoint(Village village)
 {
     Language language = languages.GetLanguage(settings.LanguageId);
     string servername = settings.LoginData.Servername;
     //http://s1.travian.com/build.php?newdid=75579&gid=16&id=39
     string url = String.Format(CultureInfo.InvariantCulture, "{0}build.php?newdid={1}&gid=16&id=39",
                                servername, village.Id);
     htmlDocument = htmlWeb.Load(url);
     HtmlParser htmlParser = new HtmlParser(htmlDocument, language);
     List<TroopMovement> troopMovements = htmlParser.TroopMovements(village);
     //ArrayList list = new ArrayList();
     //list.AddRange(troopMovements);
     UpdateDataGridViewRallyPoint(dataGridViewRallyPoint, troopMovements);
     UpdateStatus(String.Format(CultureInfo.InvariantCulture, "Populate Rally Point in {0}", village.Name));
 }