Exemple #1
0
        public void Execute(IState state)
        {
            if (state.Collection != null)
            {
                var          api    = new BGG.API(new APIConfig());
                List <IGame> result = api.GetHotAsync().Result;
                XDocument    xml    = XMLConverter.ToXML(result);

                string name = $"{DateTime.Now.ToString("yyyy-M-dd--HH-mm")}_hot.xml";
                string path = Path.Combine(Directory.GetCurrentDirectory(), state.Collection, name);

                xml.Save(path);
            }
            else
            {
                WriteLine("Stage collection.");
            }
        }
Exemple #2
0
        public void Execute(IState state)
        {
            if (state.Collection != null)
            {
                var api = new BGG.API(new APIConfig());
                List <IGeekItem> result = api.GetGeekListAsync(listId).Result;
                XDocument        xml    = XMLConverter.ToXML(result);

                string path = Path.Combine(Directory.GetCurrentDirectory(), state.Collection, listId.ToString());
                path = Path.ChangeExtension(path, ".xml");

                xml.Save(path);
            }
            else
            {
                WriteLine("Stage collection.");
            }
        }
Exemple #3
0
        public void Execute(IState state)
        {
            if (state.Collection != null)
            {
                var          api    = new BGG.API(new APIConfig());
                List <IGame> result = api.GetTopAsync(depth).Result;
                // Ensure list is truncated to original request depth
                XDocument xml = XMLConverter.ToXML(result.Take(depth));

                string name = $"{DateTime.Now.ToString("yyyy-M-dd--HH-mm")}_top.xml";
                string path = Path.Combine(Directory.GetCurrentDirectory(), state.Collection, name);

                xml.Save(path);
            }
            else
            {
                WriteLine("Stage collection.");
            }
        }