Beispiel #1
0
        public static bool StateLoL(out StateGame st)
        {
            try
            {
                ConnectionAPI connection =
                    new ConnectionAPI(APILinks.GetLink(
                                          APILinks.Link.StateLoL), false);

                json = connection.json;

                st = JsonConvert.DeserializeObject <StateGame>(json);

                json = null;

                return(true);
            }
            catch
            {
                st = null;
                if (ggLoL.language == "en-EN")
                {
                    MessageBox.Show("Connection error");
                }
                else if (ggLoL.language == "es-ES")
                {
                    MessageBox.Show("Error en la Conexión");
                }
                return(false);
            }
        }
Beispiel #2
0
        // For Download File Data
        public static bool GetLinkFileData(out string link)
        {
            try
            {
                ConnectionAPI connection =
                    new ConnectionAPI(APILinks.GetLink(APILinks.Link.DragontailData), false);

                json = connection.json;

                link = JsonConvert.DeserializeObject <string>(json);

                json = null;

                return(true);
            }
            catch

            {
                link = null;
                if (ggLoL.language == "en-EN")
                {
                    MessageBox.Show("Connection error");
                }
                else if (ggLoL.language == "es-ES")
                {
                    MessageBox.Show("Error en la Conexión");
                }
                return(false);
            }
        }
Beispiel #3
0
        public static bool SearchKey(string nick)
        {
            try
            {
                ConnectionAPI connection =
                    new ConnectionAPI(nick, APILinks.GetLink(
                                          APILinks.Link.VerifyProfile), false);

                string key = JsonConvert.DeserializeObject <string>(connection.json);

                return(true);
            }
            catch { MessageBox.Show("Summoner don't found!"); return(false); }
        }
Beispiel #4
0
        public ChampionMastery GetMaestry()
        {
            ChampionMastery cm;

            try
            {
                ConnectionAPI connection =
                    new ConnectionAPI(name, APILinks.GetLink(
                                          APILinks.Link.ChampionMastery), false);

                cm = JsonConvert.DeserializeObject <ChampionMastery>(connection.json);

                return(cm);
            }
            catch { return(null); }
        }
Beispiel #5
0
        public string GetPatchCode()
        {
            const string link = "/lol/static-data/v3/versions";

            try
            {
                WebClient client = new WebClient();

                ConnectionAPI patch = new ConnectionAPI(link, false);

                // Get First Result
                string numberPatch = patch.json.Split('\"')[1];

                return(client.DownloadString("https://euw.leagueoflegends.com" +
                                             "/en/news/game-updates/patch/patch-" + numberPatch + "-notes"));
            }
            catch (Exception) { return(""); }
        }
Beispiel #6
0
        public static bool SearchPlayer(string name, out SummonerProfile s)
        {
            try
            {
                s = null;
                if (online)
                {
                    ConnectionAPI connection =
                        new ConnectionAPI(name, APILinks.GetLink(
                                              APILinks.Link.SummonerProfile), true);

                    json = connection.json;
                }
                else
                {
                    GetOfflineData(name.ToLower() + "-" + Region.linkRegion.ToLower() +
                                   SummonerProfile.fileName);
                }

                s = JsonConvert.DeserializeObject <SummonerProfile>(json);

                json = null;

                return(true);
            }
            catch
            {
                s = null;
                if (ggLoL.language == "en-EN")
                {
                    MessageBox.Show("Non-Existing Summoner Profile");
                }
                else if (ggLoL.language == "es-ES")
                {
                    MessageBox.Show("Perfil de Invocador no Existente");
                }
                return(false);
            }
        }
Beispiel #7
0
        public static bool SearchGameInfo(out Items i)
        {
            i = null;
            try
            {
                if (online)
                {
                    ConnectionAPI connection =
                        new ConnectionAPI(APILinks.GetLink(
                                              APILinks.Link.Items), true);

                    json = connection.json;
                }
                else
                {
                    GetOfflineData(Items.fileName);
                }


                i = JsonConvert.DeserializeObject <Items>(json);

                json = null;

                return(true);
            }
            catch
            {
                i = null;
                if (ggLoL.language == "en-EN")
                {
                    MessageBox.Show("Non-Existing Object");
                }
                else if (ggLoL.language == "es-ES")
                {
                    MessageBox.Show("Objeto no Existente");
                }
                return(false);
            }
        }
Beispiel #8
0
        public static bool SearchChampion(out Champions c)
        {
            c = null;
            try
            {
                if (online)
                {
                    ConnectionAPI connection =
                        new ConnectionAPI(APILinks.GetLink(
                                              APILinks.Link.Champions), true);

                    json = connection.json;
                }
                else
                {
                    GetOfflineData(Champions.fileName);
                }

                c = JsonConvert.DeserializeObject <Champions>(json);

                json = null;

                return(true);
            }
            catch
            {
                c = null;
                if (ggLoL.language == "en-EN")
                {
                    MessageBox.Show("Non-Existing Champion");
                }
                else if (ggLoL.language == "es-ES")
                {
                    MessageBox.Show("Campeón no Existente");
                }
                return(false);
            }
        }