示例#1
0
        private async Task <IEnumerable <XmlItemBase> > ReadJson(string wikiClass,
                                                                 Func <XmlItemBase, ItemType> itemTypeFunc, ItemCategory category)
        {
            var conditions = new ConditionBuilder
            {
                { RdfRarity, "Normal" },
                { RdfItemClass, wikiClass }
            };
            var printouts  = GlobalPredicates.Union(PredicatesPerCategory[category]);
            var enumerable =
                from result in await WikiApiAccessor.AskArgs(conditions, printouts)
                select PrintoutsToBase(category, result);

            var ret = enumerable.ToList();

            foreach (var item in ret)
            {
                item.ItemType = itemTypeFunc(item);
            }
            Log.Info($"Retrieved {ret.Count} bases of class {wikiClass}.");
            return
                (from b in ret
                 orderby b.ItemType, b.Level, b.Name
                 select b);
        }
示例#2
0
        private async Task <IEnumerable <XmlUnique> > ReadJson(string wikiClass)
        {
            var conditions = new ConditionBuilder
            {
                { RdfRarity, "Unique" },
                { RdfItemClass, wikiClass }
            };
            IEnumerable <XmlUnique> enumerable =
                from result in await WikiApiAccessor.AskArgs(conditions, Printouts)
                select PrintoutsToUnique(result);

            var ret = enumerable.ToList();

            Log.Info($"Retrieved {ret.Count} bases of class {wikiClass}.");
            return(ret.OrderBy(b => b.Name));
        }
示例#3
0
        private async Task <IEnumerable <XmlItemBase> > ReadJson(string wikiClass, ItemClass itemClass)
        {
            var conditions = new ConditionBuilder
            {
                { RdfRarity, "Normal" },
                { RdfItemClass, wikiClass }
            };
            var enumerable =
                from result in await WikiApiAccessor.AskArgs(conditions, PrintoutPredicates)
                select PrintoutsToBase(itemClass, result);

            var ret = enumerable.ToList();

            Log.Info($"Retrieved {ret.Count} bases of class {wikiClass}.");
            return
                (from b in ret
                 orderby b.Level, b.Name
                 select b);
        }