Exemple #1
0
        static void Main(string[] args)
        {
            Console.WriteLine("Getting Characters...\n");
            CharacterUpdater updater = new CharacterUpdater();
            List<Character> characters = updater.GetOrderedCharacters();

            if (!Directory.Exists(imageDirectory))
                Directory.CreateDirectory(imageDirectory);
            WebClient client = new WebClient();
            int counter = 1;
            foreach(Character c in characters)
            {
                Console.WriteLine(counter + ": " + c.Name);

                Console.Write("image... ");
                try
                {
                    client.DownloadFile(c.ImageLocation, Path.Combine(imageDirectory, c.GetImageFileName()));
                    WriteWithColor("DONE!", ConsoleColor.Green);
                }
                catch (Exception e)
                {
                    WriteWithColor("FAIL!", ConsoleColor.Red);
                    WriteWithColor(e.ToString(), ConsoleColor.Red);
                }
                Console.WriteLine(c.GetImageFileName());

                Console.WriteLine();
                counter++;
            }
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("Getting Characters...\n");
            CharacterUpdater updater    = new CharacterUpdater();
            List <Character> characters = updater.GetOrderedCharacters();

            if (!Directory.Exists(imageDirectory))
            {
                Directory.CreateDirectory(imageDirectory);
            }
            WebClient client  = new WebClient();
            int       counter = 1;

            foreach (Character c in characters)
            {
                Console.WriteLine(counter + ": " + c.Name);

                Console.Write("image... ");
                try
                {
                    client.DownloadFile(c.ImageLocation, Path.Combine(imageDirectory, c.GetImageFileName()));
                    WriteWithColor("DONE!", ConsoleColor.Green);
                }
                catch (Exception e)
                {
                    WriteWithColor("FAIL!", ConsoleColor.Red);
                    WriteWithColor(e.ToString(), ConsoleColor.Red);
                }
                Console.WriteLine(c.GetImageFileName());

                Console.WriteLine();
                counter++;
            }
        }
        private async void UpdateCharacters()
        {
            EnableLoadingFilm();
            List<Character> result = new List<Character>();
            bool succeed = false;

            CharacterUpdater updater = new CharacterUpdater();
            updater.UpdateTierFailed += Updater_UpdateTierFailed;
            updater.UpdateTierEnd += () => { succeed = true; };

            result = await Task.Run(() => updater.GetOrderedCharacters());

            if (succeed)
            {
                Smashers = result;
                FileManager.WriteFile(Smashers);
                DG_Characters.ItemsSource = Smashers;
            }

            DisableLoadingFilm();
        }
Exemple #4
0
        private async void UpdateCharacters()
        {
            EnableLoadingFilm();
            List <Character> result  = new List <Character>();
            bool             succeed = false;

            CharacterUpdater updater = new CharacterUpdater();

            updater.UpdateTierFailed += Updater_UpdateTierFailed;
            updater.UpdateTierEnd    += () => { succeed = true; };

            result = await Task.Run(() => updater.GetOrderedCharacters());

            if (succeed)
            {
                Smashers = result;
                FileManager.WriteFile(Smashers);
                DG_Characters.ItemsSource = Smashers;
            }

            DisableLoadingFilm();
        }