Exemplo n.º 1
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.");
            }
        }
Exemplo n.º 2
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.");
            }
        }
Exemplo n.º 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.");
            }
        }
Exemplo n.º 4
0
        public void Execute(IState state)
        {
            IGeekItem newItem = new GeekItem
            {
                Game = new Game
                {
                    Id   = gameId,
                    Name = string.Empty
                }
            };
            List <IGeekItem> gameList;
            string           path = state.IgnorePath;

            gameList = File.Exists(path) ? XMLConverter.FromXML(XDocument.Load(path)) : new List <IGeekItem>();
            gameList.Add(newItem);
            XDocument xml = XMLConverter.ToXML(gameList);

            xml.Save(path);
        }