Esempio n. 1
0
        private void searchButton_Click(object sender, EventArgs e)
        {
            if (regionComboBox.SelectedItem == null)
            {
                showError("Pick a region");
                return;
            }

            string region = regionComboBox.SelectedItem.ToString().ToLower();
            string summ   = summName.Text;

            CurrentGameInfo game = Services.getCurrentGame(region, summ);

            if (game != null)
            {
                selectedGame          = game;
                selectedRegion        = region;
                selectedFeaturedGames = null;

                singlePage();

                Label[] labels = regionLabels.Values.ToArray();

                for (int i = 0; i < labels.Length; i++)
                {
                    labels[i].Font = new Font(labels[i].Font, FontStyle.Regular);
                }
            }
            else
            {
                showError("The player " + summ + " is not currently in a game.");
            }
        }
Esempio n. 2
0
        private void setPage(int page)
        {
            if (page >= 0 &&
                selectedFeaturedGames != null &&
                selectedFeaturedGames.gameList.Length > page)
            {
                selectedGameIndex = page;

                selectedGame = selectedFeaturedGames.gameList[selectedGameIndex];

                showGame(selectedGame);

                gameNumber.Text = (page + 1) + " / " + selectedFeaturedGames.gameList.Length;



                if (page == 0)
                {
                    prevGameButton.Enabled = false;
                }
                else
                {
                    prevGameButton.Enabled = true;
                }

                if (page == selectedFeaturedGames.gameList.Length - 1)
                {
                    nextGameButton.Enabled = false;
                }
                else
                {
                    nextGameButton.Enabled = true;
                }
            }
        }
Esempio n. 3
0
        private void refreshGamesButton_Click(object sender, EventArgs e)
        {
            renewRefreshTime();

            featuredGamesByRegion = new Dictionary <string, FeaturedGames>();

            selectedGame          = null;
            selectedFeaturedGames = null;

            showFeaturedGames(selectedRegion);
        }
Esempio n. 4
0
        public static Boolean runSpectate(CurrentGameInfo game, string region)
        {
            string clientPath = getClientPath();

            string parameters = Constants.spectatorConstantParameters
                                + " "
                                + "\"spectator "
                                + getSpectatorUrlByRegion(region)
                                + " "
                                + game.observers.encryptionKey
                                + " "
                                + game.gameId
                                + " "
                                + getPlatformIDByRegion(region)
                                + "\"";



            ProcessStartInfo startInfo = new ProcessStartInfo();

            startInfo.FileName = clientPath + "\\" + Constants.leagueClientFile;

            startInfo.WorkingDirectory = clientPath;

            startInfo.Arguments = parameters;

            try
            {
                Process proc = Process.Start(startInfo);

                return(true);
            }
            catch (System.IO.FileNotFoundException)
            {
                return(false);
            }
        }
Esempio n. 5
0
        private void showGame(CurrentGameInfo g)
        {
            summ1team1.Text = g.participants[0].summonerName;
            summ2team1.Text = g.participants[1].summonerName;
            summ3team1.Text = g.participants[2].summonerName;
            summ4team1.Text = g.participants[3].summonerName;
            summ5team1.Text = g.participants[4].summonerName;

            summ1team2.Text = g.participants[5].summonerName;
            summ2team2.Text = g.participants[6].summonerName;
            summ3team2.Text = g.participants[7].summonerName;
            summ4team2.Text = g.participants[8].summonerName;
            summ5team2.Text = g.participants[9].summonerName;

            champ1team1.Image = getChampionPic((int)g.participants[0].championId);
            champ2team1.Image = getChampionPic((int)g.participants[1].championId);
            champ3team1.Image = getChampionPic((int)g.participants[2].championId);
            champ4team1.Image = getChampionPic((int)g.participants[3].championId);
            champ5team1.Image = getChampionPic((int)g.participants[4].championId);

            champ1team2.Image = getChampionPic((int)g.participants[5].championId);
            champ2team2.Image = getChampionPic((int)g.participants[6].championId);
            champ3team2.Image = getChampionPic((int)g.participants[7].championId);
            champ4team2.Image = getChampionPic((int)g.participants[8].championId);
            champ5team2.Image = getChampionPic((int)g.participants[9].championId);

            long gameStartTime = g.gameStartTime;

            DateTime startTime = Util.fromUnixTime(gameStartTime);

            TimeSpan diff = DateTime.UtcNow - startTime;

            currentGameTimeSpan = diff;

            updateTimeLabel();
        }
Esempio n. 6
0
        public static string getSpectatorString(CurrentGameInfo game, string region)
        {
            string clientPath = "\""
                                + getClientPath()
                                + "\\"
                                + Constants.leagueClientFile
                                + "\"";

            string parameters = Constants.spectatorConstantParameters
                                + " "
                                + "\"spectator "
                                + getSpectatorUrlByRegion(region)
                                + " "
                                + game.observers.encryptionKey
                                + " "
                                + game.gameId
                                + " "
                                + getPlatformIDByRegion(region)
                                + "\"";

            string command = clientPath + " " + parameters;

            return(command);
        }