Esempio n. 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);
        }
Esempio n. 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);
        }
Esempio n. 3
0
        public void Connect()
        {
            Types       = new List <PokeType>();
            EggGroups   = new List <EggGroup>();
            EvoTrees    = new List <EvolutionTree>();
            EvoMethods  = new List <EvoMethod>();
            Pockets     = new List <Pocket>();
            Items       = new List <Item>();
            Versions    = new List <GameVersion>();
            Natures     = new List <Nature>();
            Abilities   = new List <Ability>();
            Moves       = new List <Move>();
            MoveMethods = new List <MoveMethod>();
            MoveSets    = new List <MoveSet>();
            Pokedex     = new List <Pokémon>();

            #region Types
            string url = URL + getTypes;
            NameValueCollection formData = new NameValueCollection();

            WebClient webClient = new WebClient();

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

            Types = XMLReader.ReadTypes();
            #endregion
            #region Egg Groups
            url      = URL + getEggGroups;
            formData = new NameValueCollection();

            webClient = new WebClient();

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

            EggGroups = XMLReader.ReadEggGroups();
            #endregion
            #region Evolution Ways
            url      = URL + getEvoWays;
            formData = new NameValueCollection();

            webClient = new WebClient();

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

            EvoMethods = XMLReader.ReadEvoMethod();
            #endregion
            #region Pockets
            url      = URL + getPockets;
            formData = new NameValueCollection();

            webClient = new WebClient();

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

            Pockets = XMLReader.ReadPockets();
            #endregion
            #region Items
            url      = URL + getItems;
            formData = new NameValueCollection();

            webClient = new WebClient();

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

            Items = XMLReader.ReadItems();
            #endregion
            #region Versions
            url      = URL + getVersions;
            formData = new NameValueCollection();

            webClient = new WebClient();

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

            Versions = XMLReader.ReadVersions();
            #endregion
            #region Natures
            url      = URL + getNatures;
            formData = new NameValueCollection();

            webClient = new WebClient();

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

            Natures = XMLReader.ReadNatures();
            #endregion
            #region Abilities
            url      = URL + getAbilities;
            formData = new NameValueCollection();

            webClient = new WebClient();

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

            Abilities = XMLReader.ReadAbilities();
            #endregion
            #region Moves
            url      = URL + getMoves;
            formData = new NameValueCollection();

            webClient = new WebClient();

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

            Moves = XMLReader.ReadMoves();
            #endregion
            #region MoveMethods
            url      = URL + getMoveMethods;
            formData = new NameValueCollection();

            webClient = new WebClient();

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

            MoveMethods = XMLReader.ReadMoveMethods();
            #endregion
            #region MoveSets
            url      = URL + getMoveSets;
            formData = new NameValueCollection();

            webClient = new WebClient();

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

            MoveSets = XMLReader.ReadMoveSets();
            #endregion
        }