コード例 #1
0
        internal static IEnumerable <SearchResult> BySource(CompendiumSource source)
        {
            string  url     = String.Format(SearchUrl, source.Value);
            XmlData xmlData = new XmlData(url);

            return(AnalyzeDoc(xmlData.XmlDoc));
        }
コード例 #2
0
        public void TrapBySourceTest()
        {
            CompendiumSource source = new CompendiumSource { Value = 202 };

            IEnumerable<SearchResult> actual;
            actual = SearchResultTrap.BySource(source);
            Assert.AreEqual(16, actual.Count());
            Assert.IsTrue(actual.Any(x => x.Name == "Dust Funnel"));
        }
コード例 #3
0
        public void MonsterBySourceTest()
        {
            CompendiumSource source = new CompendiumSource {Value = 203};

            IEnumerable<SearchResult> actual;
            actual = SearchResultMonster.BySource(source);
            Assert.AreEqual(5,actual.Count());
            Assert.IsTrue(actual.Any(x=>x.Name=="Erdlu"));
        }
コード例 #4
0
        public void ItemBySourceTest()
        {
            CompendiumSource source = new CompendiumSource { Value = 14,Name="Arcane Power" };

            IEnumerable<SearchResult> actual;
            actual = SearchResultMagicItem.BySource(source);
            Assert.AreEqual(9, actual.Count());
            Assert.IsTrue(actual.Any(x => x.Name == "Magic Tome"));
        }
コード例 #5
0
 private static IEnumerable<CompendiumSource> AnalyzeDoc(XmlDocument doc)
 {
     List<CompendiumSource> l = new List<CompendiumSource>();
     XmlNodeList nodes = doc.SelectNodes("//Option");// SelectNodes("//Option[type='MonsterSourceBook']");
     foreach (XmlNode node in nodes)
     {
         CompendiumSource cs = new CompendiumSource
                                   {
                                       Name = node["val"].InnerText,
                                       Value = Convert.ToInt32(node["id"].InnerText),
                                       SourceType = node["type"].InnerText
                                   };
         l.Add(cs);
     }
     AddDefaultSourceOption(l);
     return l;
 }
コード例 #6
0
        private static IEnumerable <CompendiumSource> AnalyzeDoc(XmlDocument doc)
        {
            List <CompendiumSource> l     = new List <CompendiumSource>();
            XmlNodeList             nodes = doc.SelectNodes("//Option");// SelectNodes("//Option[type='MonsterSourceBook']");

            foreach (XmlNode node in nodes)
            {
                CompendiumSource cs = new CompendiumSource
                {
                    Name       = node["val"].InnerText,
                    Value      = Convert.ToInt32(node["id"].InnerText),
                    SourceType = node["type"].InnerText
                };
                l.Add(cs);
            }
            AddDefaultSourceOption(l);
            return(l);
        }
コード例 #7
0
 protected virtual IEnumerable<SearchResult> GetSearchResults(CompendiumSource cs)
 {
     throw new NotImplementedException();
 }
コード例 #8
0
 internal static IEnumerable<SearchResult> BySource(CompendiumSource source)
 {
     string url = String.Format(SearchUrl, source.Value);
     XmlData xmlData=new XmlData(url);
     return AnalyzeDoc(xmlData.XmlDoc);
 }
コード例 #9
0
 protected override IEnumerable<SearchResult> GetSearchResults(CompendiumSource cs)
 {
     return SearchResultMonster.BySource(cs);
 }