Esempio n. 1
0
        public static DominionSet GetSet(string setname)
        {
            DominionSet set = new DominionSet();
            set.Name = setname;
            List<DominionCard> cards = new List<DominionCard>();
            HttpWebRequest req = HttpWebRequest.Create("http://dominion.diehrstraits.com/?set=" + setname) as HttpWebRequest;
            HttpWebResponse rep = req.GetResponse() as HttpWebResponse;
            StreamReader reader = new StreamReader(rep.GetResponseStream());
            string site = reader.ReadToEnd();
            string siteparse = site;
            // Get names
            while (siteparse.Contains(titletag))
            {
                string leftovers = siteparse.Substring(siteparse.IndexOf(titletag) + titletag.Length);
                string cardname = leftovers.Substring(0, leftovers.IndexOf("\'"));
                DominionCard card = new DominionCard();
                card.Name = cardname;
                cards.Add(card);
                card.Set = set;
                set.Cards.Add(card);
                PopulateCard(card);
                siteparse = leftovers;
            }

            return set;
        }
Esempio n. 2
0
        public static DominionSet GetSet(string setname)
        {
            DominionSet set = new DominionSet();

            set.Name = setname;
            List <DominionCard> cards  = new List <DominionCard>();
            HttpWebRequest      req    = HttpWebRequest.Create("http://dominion.diehrstraits.com/?set=" + setname) as HttpWebRequest;
            HttpWebResponse     rep    = req.GetResponse() as HttpWebResponse;
            StreamReader        reader = new StreamReader(rep.GetResponseStream());
            string site      = reader.ReadToEnd();
            string siteparse = site;

            // Get names
            while (siteparse.Contains(titletag))
            {
                string       leftovers = siteparse.Substring(siteparse.IndexOf(titletag) + titletag.Length);
                string       cardname  = leftovers.Substring(0, leftovers.IndexOf("\'"));
                DominionCard card      = new DominionCard();
                card.Name = cardname;
                cards.Add(card);
                card.Set = set;
                set.Cards.Add(card);
                PopulateCard(card);
                siteparse = leftovers;
            }

            return(set);
        }