Esempio n. 1
0
        private List<Valley> GetValleys(char prefix, ValleyType valleyType)
        {
            //o1 : +25%wood
            //o2 : +25%wood
            //o3 : +25%wood, +25%crop
            //o4 : +25%clay
            //o5 : +25%clay
            //o6 : +25%clay, +25%crop
            //o7 : +25%iron
            //o8 : +25%iron
            //o9 : +25%iron, +25%crop
            //o10 : +25%crop
            //o11 : +25%crop
            //o12 : +50%crop

            List<Valley> valleys = new List<Valley>();
            List<string> table = new List<string>();
            FillTable(table, prefix);
            foreach (string list in table)
            {
                //<area id="a_0_0" shape="poly" coords="53, 137, 90, 157, 53, 177, 16, 157" title="Nezasedena pokrajina" href="karte.php?d=273457&c=e4" />
                HtmlNodeCollection areaNode =
                    htmlDocument.DocumentNode.SelectNodes(String.Format(CultureInfo.InvariantCulture,
                                                                        "//area[@id='{0}']", list));
                Valley oases = new Valley();
                oases
                    .AddName(areaNode[0].Attributes["title"].Value)
                    .AddUrl(areaNode[0].Attributes["href"].Value)
                    .AddType(valleyType);
                valleys.Add(oases);
            }
            return valleys;
        }
Esempio n. 2
0
 /// <summary>
 /// Adds the type.
 /// </summary>
 /// <param name="type">The type.</param>
 /// <returns></returns>
 public Valley AddType(ValleyType type)
 {
     ValleyType = type;
     return this;
 }