Пример #1
0
        internal bool IsUpdated(List <Pokémon> pokedex)
        {
            bool updated = true;

            string url = URL + getPokedex;
            NameValueCollection formData = new NameValueCollection();

            WebClient webClient = new WebClient();

            byte[] responseBytes      = webClient.UploadValues(url, "POST", formData);
            string responsefromserver = Encoding.UTF8.GetString(responseBytes);

            List <Pokémon> templist = XMLReader.ReadPokedex();

            try
            {
                for (int x = 0; x < templist.Count - 1; x++)
                {
                    if (templist[x].Updated.CompareTo(pokedex[x].Updated) == 1)
                    {
                        updated = false;
                        break;
                    }
                }
            }
            catch (Exception e) {}

            return(updated);
        }
Пример #2
0
        public static void LoadPokedex()
        {
            #region Pokedex
            string url = URL + getPokedex;
            NameValueCollection formData = new NameValueCollection();

            WebClient webClient = new WebClient();

            byte[] responseBytes      = webClient.UploadValues(url, "POST", formData);
            string responsefromserver = Encoding.UTF8.GetString(responseBytes);

            Pokedex = XMLReader.ReadPokedex();
            #endregion
            #region Evolution Trees
            url      = URL + getEvoTrees;
            formData = new NameValueCollection();

            webClient = new WebClient();

            responseBytes      = webClient.UploadValues(url, "POST", formData);
            responsefromserver = Encoding.UTF8.GetString(responseBytes);

            EvoTrees = XMLReader.ReadEvoTrees();
            #endregion


            List <Pokémon> pokedexToSerialize = Pokedex;

            Serializer serializer = new Serializer();
            serializer.SerializePokedex("pokedex.bin", pokedexToSerialize);

            List <EvolutionTree> evotreesToSerialize = EvoTrees;

            serializer = new Serializer();
            serializer.SerializeEvoTrees("evotrees.bin", evotreesToSerialize);
        }