Exemplo n.º 1
0
        public static BestTemplate Parse(int id, IDataProperty property)
        {
            var t = new BestTemplate
            {
                ID          = id,
                Category    = Convert.ToInt32(property.Parent.Parent.Name),
                Gender      = property.Parent.Name == "male" ? 0 : 1,
                CommoditySN = property.Resolve <int>() ?? 0
            };

            return(t);
        }
Exemplo n.º 2
0
        public override Task LoadAll()
        {
            var property = Collection.Resolve("Server/Best.img");

            var id = 0;

            property.Children
            .SelectMany(c => c.Children)
            .SelectMany(c => c.Children)
            .ToDictionary(
                c => id++,
                c => BestTemplate.Parse(id, c)
                )
            .ForEach(kv => Templates.Add(kv.Key, kv.Value));
            return(Task.CompletedTask);
        }