Exemple #1
0
        private void Export_Click(object sender, EventArgs e)
        {
            var filter  = GetFilter();
            var loader  = new DigimonFileLoader(null);
            var digimon = new DigimonList();

            digimon.LoadDigimon();
            digimon.FilterList(filter);
            loader.SaveDigimon(digimon.DigimonCollection, "DigimonListExport.xml");
        }
        private static void DeleteAllEvolutions()
        {
            var digimonList = new DigimonList();

            digimonList.LoadDigimon();
            var fileLoader = new DigimonFileLoader(new List <string>());

            foreach (var digimon in digimonList.DigimonCollection)
            {
                digimon.Digivolutions.Clear();
            }
            fileLoader.SaveDigimon(digimonList.DigimonCollection);
        }
        private static void UpdateData()
        {
            var digimonList = new DigimonList();

            digimonList.LoadDigimon();
            var webloader  = new DigimonWebLoader(new List <string>());
            var fileLoader = new DigimonFileLoader(new List <string>());

            foreach (var digimon in digimonList.DigimonCollection.Where(x => x.Number >= 100 && x.Number <= 457))
            {
                webloader.LoadImage(digimon);
            }
            fileLoader.SaveDigimon(digimonList.DigimonCollection);
        }
        private static void LoadData(IEnumerable <Digimon> digimons)
        {
            var digimonList = new DigimonList();

            digimonList.LoadDigimon();
            var webloader  = new DigimonWebLoader(new List <string>());
            var fileLoader = new DigimonFileLoader(new List <string>());

            foreach (var digimon in digimons)
            {
                webloader.LoadImage(digimon);
                digimonList.DigimonCollection.Add(digimon);
            }
            fileLoader.SaveDigimon(digimonList.DigimonCollection);
        }
        private static void RemoveDuplicates()
        {
            var digimonList = new DigimonList();

            digimonList.LoadDigimon();
            var fileLoader      = new DigimonFileLoader(new List <string>());
            var digimonToRemove = new List <Digimon>();

            foreach (var digimon in digimonList.DigimonCollection)
            {
                if (digimonList.DigimonCollection.Any(x => string.Equals(x.Name, digimon.Name) && digimon.Number != x.Number && string.IsNullOrEmpty(digimon.Type)))
                {
                    digimonToRemove.Add(digimon);
                }
            }
            foreach (var digimon in digimonToRemove)
            {
                digimonList.DigimonCollection.Remove(digimon);
            }
            fileLoader.SaveDigimon(digimonList.DigimonCollection);
        }
 private void button2_Click(object sender, System.EventArgs e)
 {
     var loader = new DigimonFileLoader(null);
     loader.SaveDigimon(_digimonList.UnfilteredDigimonCollection, "DigimonList.xml");
     new MessageForm($"Digimon List saved").ShowDialog();
 }