public ParticipantFrame(RiotApi.Net.RestClient.Dto.Match.Generic.ParticipantFrame pf)
 {
     ParticipantId = pf.ParticipantId;
     CurrentGold = pf.CurrentGold;
     Level = pf.Level;
     MinionsKilled = pf.MinionsKilled;
     TotalGold = pf.TotalGold;
     Xp = pf.Xp;
 }
示例#2
0
 public Event(RiotApi.Net.RestClient.Dto.Match.Generic.Event e)
 {
     ParticipantId = e.ParticipantId;
     EventType = e.EventType.ToString();
     int? nullInt = null;
     ItemAfter = e.ItemAfter == 0 ? nullInt : e.ItemAfter;
     ItemBefore = e.ItemBefore == 0 ? nullInt : e.ItemBefore;
     ItemId = e.ItemId == 0 ? nullInt : e.ItemId;
     LevelUpType = e.LevelUpType.ToString();
     SkillSlot = e.SkillSlot == 0 ? nullInt : e.SkillSlot;
     Timestamp = e.Timestamp;
 }
示例#3
0
 public Patch(RiotApi.Net.RestClient.Dto.LolStaticData.Champion.ChampionListDto champList, 
     RiotApi.Net.RestClient.Dto.LolStaticData.Item.ItemListDto itemList)
 {
     this.version = champList.Version;
     Champions = new List<Champion.Champion>();
     Items = new List<Item.Item>();
     foreach (var champ in champList.Data)
     {
         Champions.Add(new Champion.Champion(champ.Value));
     }
     foreach (var item in itemList.Data)
     {
         Items.Add(new Item.Item(item.Value));
     }
     Added = DateTime.UtcNow;
 }
示例#4
0
 public Champion(RiotApi.Net.RestClient.Dto.LolStaticData.Champion.ChampionDto champ)
 {
     AutoMapper.Mapper.CreateMap<StatsDto, ChampStats>();
     this.id = champ.Id;
     this.name = champ.Name;
     this.key = champ.Key;
     this.stats = AutoMapper.Mapper.Map<ChampStats>(champ.Stats);
     this.passive = new ChampionPassive(champ.Passive);
     this.championSpells = new List<ChampionSpell>();
     AutoMapper.Mapper.CreateMap<ImageDto, Image>();
     this.image = AutoMapper.Mapper.Map<Image>(champ.Image);
     foreach (var champSpell in champ.Spells)
     {
         championSpells.Add(new ChampionSpell(champSpell));
     }
     this.title = champ.Title;
 }
示例#5
0
        static async System.Threading.Tasks.Task Main(string[] args)
        {
            var riotApi = RiotApi.NewInstance("RGAPI-fdb6e702-1dc4-4ed3-ac3d-bb05f3a4e173");

            var summoner = riotApi.SummonerV4.GetBySummonerName(Region.NA, "gorilla sauce");

            Console.WriteLine($"Name: {summoner.Name} \nLevel: {summoner.SummonerLevel} \n ID: {summoner.Id}");

            Console.WriteLine($"{summoner.Name}'s Top 10 Champs:");


            var masteries =
                riotApi.ChampionMasteryV4.GetAllChampionMasteries(Region.NA, summoner.Id);

            for (var i = 0; i < 10; i++)
            {
                var mastery = masteries[i];
                // Get champion for this mastery.
                var champ = (Champion)mastery.ChampionId;
                // print i, champ id, champ mastery points, and champ level
                Console.WriteLine("{0,3}) {1,-16} {2,10:N0} ({3})", i + 1, champ.Name(),
                                  mastery.ChampionPoints, mastery.ChampionLevel);
            }
            Console.WriteLine();

            var summonerNameQuery = "gorilla sauce";

            // Get summoners data (blocking).
            var summonerData = await riotApi.SummonerV4.GetBySummonerNameAsync(Region.NA, summonerNameQuery);

            if (null == summonerData)
            {
                Console.WriteLine($"Summoner '{summonerNameQuery}' not found.");
                return;
            }

            Console.WriteLine($"Match history for {summonerData.Name}:");

            // Get 10 recent matches
            var matchlist = await riotApi.MatchV4.GetMatchlistAsync(
                Region.NA, summonerData.AccountId, queue : new[] { 400 }, endIndex : 10);

            // Get match results
            var matchDataTasks = matchlist.Matches.Select(
                matchMetadata => riotApi.MatchV4.GetMatchAsync(Region.NA, matchMetadata.GameId)
                ).ToArray();
            // Wait for all task requests to complete asynchronously.
            var matchDatas = await Task.WhenAll(matchDataTasks);

            for (var i = 0; i < matchDatas.Count(); i++)
            {
                var matchData = matchDatas[i];
                // Get this summoner's participant ID info.
                var participantIdData = matchData.ParticipantIdentities
                                        .First(pi => summonerData.Id.Equals(pi.Player.SummonerId));
                // Find the corresponding participant.
                var participant = matchData.Participants
                                  .First(p => p.ParticipantId == participantIdData.ParticipantId);

                var win   = participant.Stats.Win;
                var champ = (Champion)participant.ChampionId;
                var k     = participant.Stats.Kills;
                var d     = participant.Stats.Deaths;
                var a     = participant.Stats.Assists;


                var kda = (k + a) / (float)d;


                Console.WriteLine("{0,3}) {1,-4} ({2})", i + 1, win ? "Win" : "Loss", champ.Name());

                Console.WriteLine("     K/D/A {0}/{1}/{2} ({3:0.00})", k, d, a, kda);
            }
        }
示例#6
0
 public LeagueService(string apiKey)
 {
     API = RiotApi.GetDevelopmentInstance(apiKey);
 }
示例#7
0
 public RiotAPI()
 {
     _api = RiotApi.GetDevelopmentInstance("RGAPI-84171906-8f89-41ab-9b06-5c2911300015");
 }
        [Aliases("lastgame")] // alternative names for the command
        public async Task Last(CommandContext ctx, String user)
        {
            // let's trigger a typing indicator to let
            // users know we're working
            await ctx.TriggerTypingAsync();

            // Validate API key
            var api = RiotApi.GetInstance("//API goes here");

            try
            {
                // Get user's Riot information and 10 recent games
                var summoner = api.GetSummoner(Region.na, user);
                var games    = summoner.GetRecentGames();

                try
                {
                    var match = api.GetMatch(Region.na, (long)games[0].GameId);
                }
                catch (RiotSharpException ex) {
                    Console.WriteLine(ex);
                }


                //match.Participants[0].Stats < - How to access stats

                int totalKills = 1;

                foreach (RiotSharp.MatchEndpoint.Participant part in match.Participants)
                {
                    if (part.TeamId == games[0].TeamId)
                    {
                        totalKills += (int)part.Stats.Kills;
                    }
                }

                // Calculate KDR
                var dmg = games[0].Statistics.TotalDamageDealt.ToString();

                float  KDR = (float)games[0].Statistics.ChampionsKilled / (float)games[0].Statistics.NumDeaths;
                string KD  = "```" + "\n" + games[0].Statistics.ChampionsKilled + " / "
                             + games[0].Statistics.NumDeaths + " / "
                             + games[0].Statistics.Assists + " - "
                             + Math.Round(KDR, 2) + " KDR ```";

                // Preparing the embed

                var embed = new DiscordEmbed
                {
                    Title       = user + "'s Last Game Stats" + " (" + games[0].GameSubType + ")",
                    Description = KD,
                    Footer      = new DiscordEmbedFooter
                    {
                        Text = "Copyright © 2017 by A. Webster - all rights reserved."
                    },
                    Url = "https://na.op.gg/summoner/userName="******"Damage / Kill Participation";
                dmgfield.Value = "`" + games[0].Statistics.TotalDamageDealtToChampions.ToString("#,##0") + " damage - "
                                 + (games[0].Statistics.ChampionsKilled / totalKills) + "% Kill Participation"
                                 + "`";

                var towerfield = new DiscordEmbedField();
                towerfield.Name  = "Towers Destroyed";
                towerfield.Value = "`" + games[0].Statistics.TurretsKilled + " - " + Math.Round(((float)games[0].Statistics.TurretsKilled / (float)11), 2) + "% of enemy towers" + "`";

                var genStatsfield = new DiscordEmbedField();
                genStatsfield.Name = "But did you win?";

                string winStatus;
                if (games[0].Statistics.Win)
                {
                    winStatus = "`Yes! Game won at ";
                }
                else
                {
                    winStatus = "`No. Game lost at ";
                }

                genStatsfield.Value = winStatus + Math.Round(games[0].Statistics.TimePlayed.TotalMinutes) + " minutes.`";



                // Add fields to the embed
                embed.Fields.Add(dmgfield);
                embed.Fields.Add(towerfield);
                embed.Fields.Add(genStatsfield);


                // Send the embed to Discord
                await ctx.RespondAsync("", embed : embed);
            }
            catch (RiotSharpException ex)
            {
                ex.ToString();
            }
        }
示例#9
0
 public RiotApiService()
 {
     riotApi = RiotApi.NewInstance(Environment.GetEnvironmentVariable("RIOTAPI"));
 }
 public ChampionService()
 {
     _riotApi = RiotApi.GetDevelopmentInstance(WebConfigurationManager.AppSettings["ApiKey"]);
 }
示例#11
0
        public async Task View()
        {
            MessageHandler messageHandler = new MessageHandler();
            EmbedBuilder   message;
            EmbedBuilder   embed = new EmbedBuilder()
                                   .WithAuthor(a => a.WithIconUrl(Context.User.GetAvatarUrl()).WithName(Context.User.Username + "'s team"))
                                   .WithTitle("Here's your lineup!")
                                   .WithColor(Palette.Pink);

            if (CheckStarted(Context.User.Id.ToString()))
            {
                string savedMessage = "";
                var    user         = GetUserByIdFromList(Context.User.Id.ToString());

                if (user.Saved)
                {
                    savedMessage = "Your team is currently saved! Don't worry!";
                }
                else
                {
                    savedMessage = "Team isn't currently saved! Use `team save` when you're done!";
                }

                var summonersInUserTeam         = GetNamesForSummonersInUserTeam(GetUserByIdFromList(Context.User.Id.ToString()));
                var namesForChampionsInUserTeam = GetNamesForChampionsInUserTeam(GetUserByIdFromList(Context.User.Id.ToString()));

                if (summonersInUserTeam.Count > 1)
                {
                    message = messageHandler.BuildEmbed("Your current team setup: ", savedMessage, Palette.Pink, summonersInUserTeam, namesForChampionsInUserTeam);
                }
                else
                {
                    message = messageHandler.BuildEmbed("Your current team setup: ", savedMessage, Palette.Pink, new List <string> {
                        "It's empty!"
                    }, new List <string> {
                        "See `help` to see how to add"
                    });
                }
            }
            else
            {
                try
                {
                    string userid = Context.User.Id.ToString();

                    User user = new User(userid, Context.User.Username);

                    Team team = new Team(userid);
                    team.GetExistingTeamFromUser();


                    user.SetTeam(team);

                    int counter = 0;
                    foreach (var summoner in team.Summoners)
                    {
                        counter++;
                        string role;
                        string incrementor;
                        switch (summoner.Lane)
                        {
                        case (Lane.Bot): role = "ADC"; break;

                        case (Lane.Jungle): role = "Jungler"; break;

                        case (Lane.Mid): role = "Midlaner"; break;

                        case (Lane.Top): role = "Top"; break;

                        case (Lane.Support): role = "Support"; break;

                        default: return;
                        }
                        switch (counter)
                        {
                        case 1: incrementor = "Alright! First up we've got: "; break;

                        case 2: incrementor = "Secondly, it's: "; break;

                        case 3: incrementor = "Next up!: "; break;

                        case 4: incrementor = "Let's not forget about "; break;

                        case 5: incrementor = "And last, but not least! It's "; break;

                        default: return;
                        }
                        long id = int.Parse(summoner.SummonerId);
                        embed.AddField(incrementor + RiotApi.GetDevelopmentInstance(Settings.RiotAPIKey).GetSummonerBySummonerId(summoner.Region, id).Name + " as SK" + Context.User.Username.ToUpperInvariant() + "'s " + role + "!", "Looks like they'll be playing... " + GetChampionNameById(summoner.ChampionId).Name + "!");
                    }
                }
                catch (Exception e)
                {
                    message = messageHandler.BuildEmbed("Whoops! There's been an error getting your team. Make sure you have one!", $"A message for my creators: {e.Message}", Palette.Pink);
                    Debugging.Log("View command CHECKSTARTED ELSE", $"Error trying to get existing team from user: {e.Message}", LogSeverity.Error);
                }
            }

            await ReplyAsync("", false, embed.Build());
        }
示例#12
0
        // Input: Summoner IDs (from Table RegisteredPlayers)
        // API Output: Summoner ranks
        // Database: Summoner
        // APIKey Usage: 1 per summoner ID in the selected Competition
        private static void CompetitionUpdateSummonerRanks(RiotApi apiDev, string competitionName) {

            using (var connection = new SqlConnection(connectionString)) {
                connection.Open();
                var summIdList = new List<string>();

                string queryCompId = "SELECT * FROM " + T_REGP + " WHERE " + C_COMPNAME + "=" + P_COMPNAME;
                using (var cmdCompId = new SqlCommand(queryCompId, connection)) {
                    cmdCompId.Parameters.AddWithValue(P_COMPNAME, competitionName);
                    using (var obj = cmdCompId.ExecuteReader()) {
                        while (obj.Read()) {
                            summIdList.Add(obj[C_SUMID].ToString());
                        }
                    }
                }

                // Now update their Solo queue and Flex queue ranking
                foreach (string summId in summIdList) {
                    var leagueTask = apiDev.League.GetLeagueEntriesBySummonerAsync(Region.Na, summId);
                    WaitTaskPassException(leagueTask, APIParam.LEAGUES, summId);
                    var leagueObj = leagueTask.Result;
                    foreach (var leagueEntry in leagueObj) {
                        string tier = null, div = null;
                        string queueType = leagueEntry.QueueType;
                        if (queueType == SOLO_QUEUE_STRING || queueType == FLEX_QUEUE_STRING) {
                            tier = leagueEntry.Tier;
                            div = leagueEntry.Rank;
                        }

                        if (!string.IsNullOrWhiteSpace(tier) && !string.IsNullOrWhiteSpace(div)) {
                            string colTier = (queueType == SOLO_QUEUE_STRING) ? C_STIER : C_FTIER;
                            string paramTier = (queueType == SOLO_QUEUE_STRING) ? P_STIER : P_FTIER;
                            string colDiv = (queueType == SOLO_QUEUE_STRING) ? C_SDIV : C_FDIV;
                            string paramDiv = (queueType == SOLO_QUEUE_STRING) ? P_SDIV : P_FDIV;
                            string queryUpdate = "UPDATE " + T_SUMM + 
                                " SET " + colTier + "=" + paramTier + ", " + colDiv + "=" + paramDiv + 
                                " WHERE " + C_SUMID + "=" + P_SUMID;
                            using (var cmdUpate = new SqlCommand(queryUpdate, connection)) {
                                cmdUpate.Parameters.AddWithValue(paramTier, tier);
                                cmdUpate.Parameters.AddWithValue(paramDiv, div);
                                cmdUpate.Parameters.AddWithValue(P_SUMID, summId);
                                cmdUpate.ExecuteNonQuery();
                            }
                        }
                    }
                }

                connection.Close();
            }

            /*
            foreach (string Id in IDList) {
                var LeagueTask = apiDev.League.GetLeagueEntriesBySummonerAsync(Region.Na, Id);
                WaitTaskPassException(LeagueTask, Endpoint.LEAGUES, Id);
                var LeagueList = LeagueTask.Result;

                for (int i = 0; i < LeagueList.Count; ++i) {
                    var league = LeagueList[i];
                    if (league.QueueType == RANKED_SOLO_STRING) {
                        sbTier.AppendLine(league.Tier);
                        sbDiv.AppendLine(league.Rank);
                    }
                }
            }
            */
        }
示例#13
0
        // Input: Summoner Name Rosters based on Competition
        // API Output: Summoner IDs
        // Database: Summoner
        // APIKey Usage: 1 per new Name not in Summoners Table loaded from .txt
        private static void LoadSummonerNamesUpdateSummonerIds(RiotApi apiDev) {
            var ofd_Txt = OFD("Open Summoner Names");
            if (ofd_Txt == null) { return; }
            var summonersList = new List<string>(File.ReadLines(ofd_Txt.FileName));
            var summonerMap = new Dictionary<string, Tuple<string, string>>(); // Key: SummonerId -> Values: AccountId, Name
            string competitionName = summonersList[0];

            using (SqlConnection connection = new SqlConnection(connectionString)) {
                connection.Open();

                // If new, register the competition
                string queryComp = "SELECT COUNT(*) FROM " + T_COMP + " WHERE " + C_NAME + "=" + P_NAME;
                using (SqlCommand cmdCompetition = new SqlCommand(queryComp, connection)) {
                    cmdCompetition.Parameters.AddWithValue(P_NAME, competitionName);
                    if ((int)cmdCompetition.ExecuteScalar() == 0) {
                        string queryCompInsert = "INSERT INTO " + T_COMP + " VALUES (" + P_NAME + ")";
                        using (SqlCommand cmdInsert = new SqlCommand(queryCompInsert, connection)) {
                            cmdInsert.Parameters.AddWithValue(P_NAME, competitionName);
                            cmdInsert.ExecuteNonQuery();
                        }
                    }
                }

                // Before calling the API, check to see if summonerName is already in database
                // Add to a list of summoners that will update the database
                string queryName = "SELECT * FROM " + T_SUMM + " WHERE " + C_NAME + "=" + P_NAME;
                using (SqlCommand cmdNameCheck = new SqlCommand(queryName, connection)) {
                    cmdNameCheck.Parameters.Add(P_NAME, SqlDbType.NVarChar);
                    for (int i = 1; i < summonersList.Count; ++i) {
                        string summonerName = summonersList[i];
                        cmdNameCheck.Parameters[P_NAME].Value = summonerName;
                        using (SqlDataReader objRead = cmdNameCheck.ExecuteReader()) {
                            string summid = "", accid = "";
                            if (objRead.Read()) {
                                summid = objRead[C_SUMID].ToString();
                                accid = objRead[C_ACCID].ToString();
                            }
                            else {
                                // New summoner name
                                var summonerTask = apiDev.Summoner.GetSummonerByNameAsync(Region.Na, summonerName);
                                if (WaitTaskPassException(summonerTask, APIParam.SUMMONER_NAME, summonerName)) {
                                    var summonerObj = summonerTask.Result;
                                    summid = summonerObj.Id;
                                    accid = summonerObj.AccountId;
                                }
                            }
                            summonerMap.Add(summid, new Tuple<string, string>(accid, summonerName));
                        }
                    }
                }

                // Check if that accountID exists in the database: If so, they had a name change recently
                foreach (string summID in summonerMap.Keys) {
                    // SELECT COUNT(*) FROM [Table] WHERE [Col]=[Param]
                    string queryID = "SELECT COUNT(*) FROM " + T_SUMM + " WHERE " + C_SUMID + "=" + P_SUMID;
                    using (SqlCommand cmdIDCheck = new SqlCommand(queryID, connection)) {
                        cmdIDCheck.Parameters.AddWithValue(P_SUMID, summID);
                        string querySumm = "";
                        if ((int)cmdIDCheck.ExecuteScalar() == 0) {
                            // ID does not exist. INSERT new summoner
                            // INSERT INTO [Table] ([Col, ...]) VALUES ([Param, ...])
                            querySumm = "INSERT INTO " + T_SUMM + " (" + C_ACCID + ", " + C_SUMID + ", " + C_NAME + ") " +
                                 "VALUES (" + P_ACCID + ", " + P_SUMID + ", " + P_NAME + ")";
                        }
                        else {
                            // ID does exist. UPDATE summoner
                            // UPDATE [Table] SET [Col]=[Param] WHERE [Col]=[Param] AND [Col]=[PARAM]
                            querySumm = "UPDATE " + T_SUMM + " SET " + C_NAME + "=" + P_NAME +
                                " WHERE " + C_ACCID + "=" + P_ACCID + " AND " + C_SUMID + "=" + P_SUMID;
                        }
                        // Execute Query call
                        using (SqlCommand cmdSummoner = new SqlCommand(querySumm, connection)) {
                            var summTuple = summonerMap[summID];
                            string accID = summTuple.Item1;
                            string name = summTuple.Item2;
                            cmdSummoner.Parameters.AddWithValue(P_ACCID, accID);
                            cmdSummoner.Parameters.AddWithValue(P_SUMID, summID);
                            cmdSummoner.Parameters.AddWithValue(P_NAME, name);
                            cmdSummoner.ExecuteNonQuery();
                        }
                    }

                }

                foreach (string summID in summonerMap.Keys) {
                    // Now update RegisteredPlayers based on the Competition names
                    int compID = 0;
                    string queryID = "SELECT * FROM " + T_COMP + " WHERE " + C_NAME + "=" + P_NAME;
                    using (SqlCommand cmdID = new SqlCommand(queryID, connection)) {
                        cmdID.Parameters.AddWithValue(P_NAME, competitionName);
                        using (SqlDataReader objRead = cmdID.ExecuteReader()) {
                            if (objRead.Read()) {
                                compID = (int)objRead[C_ID];
                            }
                        }
                    }
                    queryID = "SELECT COUNT(*) FROM " + T_REGP + " WHERE " +
                        C_COMPNAME + "=" + P_COMPNAME + " AND " + C_SUMID + "=" + P_SUMID;
                    using (SqlCommand cmdRegister = new SqlCommand(queryID, connection)) {
                        cmdRegister.Parameters.AddWithValue(P_COMPNAME, competitionName);
                        cmdRegister.Parameters.AddWithValue(P_SUMID, summID);
                        if ((int)cmdRegister.ExecuteScalar() == 0) {
                            string queryInsert = "INSERT INTO " + T_REGP + " VALUES (" + P_COMPNAME + ", " + P_SUMID + ")";
                            using (SqlCommand cmdInsert = new SqlCommand(queryInsert, connection)) {
                                cmdInsert.Parameters.AddWithValue(P_COMPNAME, competitionName);
                                cmdInsert.Parameters.AddWithValue(P_SUMID, summID);
                                cmdInsert.ExecuteNonQuery();
                            }
                        }
                    }
                }

                connection.Close();
            }
        }
示例#14
0
文件: Api.cs 项目: alif2/RiotApi.NET
 protected Api(RiotApi riotApi, string baseUrl)
 {
     RiotApi = riotApi;
     BaseUrl = baseUrl;
 }
示例#15
0
 public RapiInfo(String key, IServiceProvider services)
 {
     RAPI = RiotApi.NewInstance(key);
     updateLeaguePatch().GetAwaiter().GetResult();
 }
示例#16
0
        private static IServiceProvider BuildServiceProvider()
        {
            var configPath = Environment.GetEnvironmentVariable("AATROX_CONFIG_PATH") ?? "credentials.json";

            var cfg = new ConfigurationBuilder()
                      .AddJsonFile(configPath, false)
                      .Build();

            return(new ServiceCollection()
                   .AddSingleton(cfg)
                   .AddSingleton <Aatrox>()
                   .AddSingleton(x => new LogService("Aatrox"))
                   .Configure <AatroxConfiguration>(x => cfg.GetSection("Secrets").Bind(x))
                   .AddSingleton <AatroxConfigurationProvider>()
                   .Configure <DatabaseConfiguration>(x => cfg.GetSection("Database").Bind(x))
                   .AddSingleton <IDatabaseConfigurationProvider, DatabaseConfigurationProvider>()
                   .AddSingleton <ConnectionStringProvider>()
                   .AddDbContext <AatroxDbContext>(ServiceLifetime.Transient)
                   .AddSingleton(x =>
            {
                var config = x.GetRequiredService <AatroxConfigurationProvider>().GetConfiguration();

                return new DiscordBotSharderConfiguration
                {
                    ProviderFactory = _ => x,
                    CommandServiceConfiguration = new CommandServiceConfiguration
                    {
                        IgnoresExtraArguments = true,
                        CooldownBucketKeyGenerator = CooldownBucketGenerator,
                        StringComparison = StringComparison.OrdinalIgnoreCase
                    },
                    ShardCount = config.ShardCount
                };
            })
                   .AddSingleton <AatroxPrefixProvider>()
                   .AddSingleton <DiscordService>()
                   .AddSingleton(x =>
            {
                var config = x.GetRequiredService <AatroxConfigurationProvider>().GetConfiguration();

                return new OsuClient(new OsuSharpConfiguration
                {
                    ApiKey = config.OsuToken,
                    ModeSeparator = " "
                });
            })
                   .AddSingleton <OsuService>()
                   .AddSingleton <InteractivityExtension>()
                   .AddSingleton <ICache, FileCache>(x
                                                     => new FileCache(new Uri("./riot-cache", UriKind.Relative), true))
                   .AddSingleton <IRiotApi, RiotApi>(x =>
            {
                var config = x.GetRequiredService <AatroxConfigurationProvider>().GetConfiguration();

                return RiotApi.GetInstance(
                    config.RiotToken, 500, 30000, x.GetRequiredService <ICache>());
            })
                   .AddSingleton <IStaticDataEndpoints, StaticDataEndpoints>(x =>
            {
                var config = x.GetRequiredService <AatroxConfigurationProvider>().GetConfiguration();

                return new StaticDataEndpoints(
                    new Requester(config.RiotToken), x.GetRequiredService <ICache>());
            })
                   .BuildServiceProvider());
        }
示例#17
0
        public async Task <PartidaAtualViewModel> PersistirDadosPartidaAtualAsync(int regiao, string jogador)
        {
            _logger.LogInformation($"Gravando partida do jogador {jogador}");

            var api = RiotApi.GetDevelopmentInstance(_apiConfiguration.Key);

            var estatisticasPrincipalJogador = await PersistirDadosJogadorAsync(regiao, jogador);

            if (!estatisticasPrincipalJogador.Desatualizado)
            {
                try
                {
                    var retorno = new PartidaAtualViewModel();

                    var partidaAtual = await api.Spectator.GetCurrentGameAsync((Region)regiao, estatisticasPrincipalJogador.InvocadorId);

                    var partidaAtualBanco =
                        await _context
                        .PartidaAtual
                        .Find(x =>
                              x.GameId == partidaAtual.GameId &&
                              x.Platform == partidaAtual.Platform &&
                              x.Aliados.Any(k => k.JogadorPrincipal && k.Participante.SummonerId == estatisticasPrincipalJogador.InvocadorId))
                        .FirstOrDefaultAsync();

                    if (partidaAtualBanco == null)
                    {
                        _logger.LogInformation("Gravando nova partida");

                        retorno.GameId   = partidaAtual.GameId;
                        retorno.Platform = partidaAtual.Platform;

                        estatisticasPrincipalJogador =
                            await PersistirDadosJogadorAsync(regiao,
                                                             partidaAtual.Participants.First(x => x.SummonerId == estatisticasPrincipalJogador.InvocadorId).SummonerName,
                                                             new List <int> {
                            (int)partidaAtual.Participants.First(x => x.SummonerId == estatisticasPrincipalJogador.InvocadorId).ChampionId
                        });

                        retorno.Aliados  = new List <JogadorPartidaAtual>();
                        retorno.Inimigos = new List <JogadorPartidaAtual>();

                        var ultimaVersao = await _util.RetornarUltimoPatchAsync();

                        var campeoes = await api.StaticData.Champions.GetAllAsync(ultimaVersao, Language.pt_BR, fullData : false);

                        var participantePrincipal = partidaAtual.Participants.First(x => x.SummonerId == estatisticasPrincipalJogador.InvocadorId);

                        var idTimeAliado = participantePrincipal.TeamId;

                        retorno.Aliados.Add(new JogadorPartidaAtual(estatisticasPrincipalJogador, participantePrincipal, true, campeoes, ultimaVersao, true));

                        //adicionar jogadorprincipal a lista de aliados
                        foreach (var item in partidaAtual.Participants.Where(x => x.SummonerId != estatisticasPrincipalJogador.InvocadorId).ToList())
                        {
                            var estatisticasJogador = await PersistirDadosJogadorAsync(regiao, item.SummonerName, new List <int> {
                                (int)item.ChampionId
                            });

                            if (item.TeamId == idTimeAliado)
                            {
                                retorno.Aliados.Add(new JogadorPartidaAtual(estatisticasJogador, item, true, campeoes, ultimaVersao));
                            }
                            else
                            {
                                retorno.Inimigos.Add(new JogadorPartidaAtual(estatisticasJogador, item, false, campeoes, ultimaVersao));
                            }
                        }

                        retorno.ChanceVitoriaAliados = ((retorno.Aliados.Sum(x => x.ChanceVitoria) / (decimal)retorno.Aliados.Count) + (retorno.Inimigos.Sum(x => 1 - x.ChanceVitoria) / (decimal)retorno.Inimigos.Count)) / 2;

                        retorno.ChanceVitoriaInimigos = 1 - retorno.ChanceVitoriaAliados;

                        var spells = await api.StaticData.SummonerSpells.GetAllAsync(ultimaVersao, Language.pt_BR);

                        await retorno.PreencherDicas(spells);

                        (retorno.ItensSugeridos, retorno.WardSugerida) = await _itensRegraNegocio.ObterSugestaoCampeao(participantePrincipal.ChampionId);

                        await _context.PartidaAtual.InsertOneAsync(retorno);

                        return(retorno);
                    }
                    else
                    {
                        _logger.LogInformation("Partida já existente no banco, pulando");
                        return(partidaAtualBanco);
                    }
                }
                catch (RiotSharpException ex)
                {
                    if (ex.HttpStatusCode == System.Net.HttpStatusCode.NotFound)
                    {
                        _logger.LogInformation(ex, "Partida em andamento não encontrada");

                        return(null);
                    }
                    else
                    {
                        _logger.LogError(ex, "Ocorreu um erro ao obter partida existente");

                        return(null);
                    }
                }
                catch (Exception ex)
                {
                    _logger.LogError(ex, "Ocorreu um erro ao obter partida existente");

                    return(null);
                }
            }
            return(null);
        }
示例#18
0
        static void Main(string[] args)
        {
            int ClientNumber = -1;

            try
            {
                ClientNumber  = Convert.ToInt32(args[0]);
                Console.Title = "SummonerFinderV4 Client #" + ClientNumber.ToString();
                Console.WriteLine("Client Number: " + ClientNumber.ToString());
            }
            catch (Exception)
            {
                Console.WriteLine("Enter client number argument");
                Console.ReadKey();
                return;
            }

            MySqlConnection link;
            Stopwatch       stopWatch = new Stopwatch();

            link = new MySqlConnection(ConfigurationManager.AppSettings["MySqlConnectionString"]);
            int timeoutTimetime = 1;

            int batch  = 50;
            int sample = 500;


            while (!link.Ping())
            {
                try
                {
                    link.Open();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }

                System.Threading.Thread.Sleep(10000);
            }

            Console.WriteLine("Conncection to Database: " + link.Ping());
            //var api = RiotApi.GetDevelopmentInstance(ConfigurationManager.AppSettings["RiotApiKey"]);
            var api = RiotApi.GetInstance(ConfigurationManager.AppSettings["RiotApiKey"], 495, 29500);


            try
            {
                var test   = api.Champion.GetChampionRotationAsync(Region.euw);
                var result = test.Result.FreeChampionIds;
            }
            catch (Exception ex)
            {
                Console.WriteLine("Connection to Api: " + ex.ToString());
                goto End;
            }

            Console.WriteLine("Connection to Api: True");

            var gameBase     = new GameBase();
            var summonerBase = new SummonerBase();

            //var sips = new Summoner("SipsClar", null, null, "0fhpK-H2m0-tS_xeHpBRyXL9Lzu_uGTNts9cwCF36BJ-FnU", 0, 0, 0, 0, 0, new DateTime(0));

            //summonerBase.AddSummoner(sips);

            //summonerBase.LoadFromDatabase(link, 100);

            stopWatch.Start();

            while (true)
            {
                if (gameBase.GamesScrapable(1) < 1)
                {
tryagain:
                    summonerBase.NewSummonersToDatabase(link);
                    //load new or break
                    if (gameBase.LoadFromDatabase(link, ClientNumber * 5000, sample))
                    {
                        timeoutTimetime = 1;
                        Console.WriteLine("Loaded " + sample + " new games from database, First Game: " + gameBase.gameList[0].gameId);
                    }
                    else
                    {
                        if (timeoutTimetime > 5)
                        {
                            //Console.WriteLine("Could not load new games from database: Breaking");
                            break;
                        }
                        Console.WriteLine("Could not load new games from database: Timeout " + timeoutTimetime + " minute");
                        System.Threading.Thread.Sleep(timeoutTimetime * 60000);
                        timeoutTimetime++;
                        goto tryagain;
                    }
                }
                //here
                Match matchData = null;
                Game  game      = gameBase.gameList.Find(g => g.scrapeIndex < 1);


                try
                {
                    matchData        = api.Match.GetMatchAsync(Region.euw, game.gameId).Result;
                    game.scrapeIndex = 1;
                }
                catch (AggregateException e)
                {
                    Console.WriteLine("Error with game: " + game.gameId);
                    //Console.WriteLine(e.ToString());

                    string em = e.InnerException.Message;

                    if (e.InnerException.Message.Contains("A task"))
                    {
                        Console.WriteLine(em);
                        api = RiotApi.GetInstance(ConfigurationManager.AppSettings["RiotApiKey"], 495, 29500);
                    }
                    else if (em.StartsWith("500") || em.StartsWith("503") || em.StartsWith("504") || em.StartsWith("429"))
                    {
                        Console.WriteLine(em);
                    }
                    else
                    {
                        Console.WriteLine("\nOther Error\n");
                        Console.WriteLine(e.ToString());
                    }

                    System.Threading.Thread.Sleep(5000);
                }


                if (matchData != null)
                {
                    foreach (ParticipantIdentity pId in matchData.ParticipantIdentities)
                    {
                        var summoner = pId.Player;
                        //Console.WriteLine(match.PlatformID.GetHashCode() + " " + match.Region.GetHashCode());
                        summonerBase.AddUniqueSummoner(new Summoner(0, summoner.SummonerName, null, summoner.SummonerId, summoner.CurrentAccountId, summoner.CurrentPlatformId.GetHashCode(), summoner.ProfileIcon, 0, 0, 0, DateTime.FromBinary(0)));
                    }
                }

                if ((gameBase.gameList.Count - gameBase.GamesScrapable(1)) % batch == 0)
                {
                    stopWatch.Stop();
                    Console.WriteLine(DateTime.Now.ToString("HH:mm:ss") + "\t" + (gameBase.gameList.Count - gameBase.GamesScrapable(1)) + "/" + gameBase.gameList.Count + " Dt: " + stopWatch.ElapsedMilliseconds / batch);
                    stopWatch.Reset();
                    stopWatch.Start();
                }


                /*
                 * try
                 * {
                 *
                 *  var matchResult = api.Match.GetMatchAsync(Region.euw, gameBase.CurrentGame().gameId).Result;
                 *
                 *  foreach (ParticipantIdentity pId in matchResult.ParticipantIdentities)
                 *  {
                 *      var summoner = pId.Player;
                 *      //Console.WriteLine(match.PlatformID.GetHashCode() + " " + match.Region.GetHashCode());
                 *      summonerBase.AddUniqueSummoner(new Summoner(0, summoner.SummonerName, null, summoner.SummonerId, summoner.CurrentAccountId, summoner.CurrentPlatformId.GetHashCode(), summoner.ProfileIcon, 0, 0, 0, DateTime.FromBinary(0)));
                 *  }
                 *
                 *  Console.WriteLine("added summoners from game: " + gameBase.CurrentGame().gameId);
                 *
                 *
                 *  //AddSummonersFromMatchAsync(api,gameBase.CurrentGame(),summonerBase,gameBase).Wait();
                 *
                 *  stopWatch.Start();
                 *  //var results = GetMatchesFromApiAsync(api,summonerBase,gameBase,30);
                 *  //var results = api.Match.GetMatchAsync(Region.euw,)
                 *  var results = GetMatchesFromApiParallel(api, gameBase, 30);
                 *  stopWatch.Stop();
                 *
                 *  foreach (var match in results)
                 *  {
                 *      foreach (ParticipantIdentity pId in match.ParticipantIdentities)
                 *      {
                 *          var summoner = pId.Player;
                 *          //Console.WriteLine(match.PlatformID.GetHashCode() + " " + match.Region.GetHashCode());
                 *          summonerBase.AddUniqueSummoner(new Summoner(0, summoner.SummonerName, null, summoner.SummonerId, summoner.CurrentAccountId, summoner.CurrentPlatformId.GetHashCode(), summoner.ProfileIcon, 0, 0, 0, DateTime.FromBinary(0)));
                 *      }
                 *  }
                 *
                 *
                 *  Console.WriteLine(gameBase.gameList.Count-gameBase.GamesScrapable(1) +"/" + gameBase.gameList.Count + " Dt: " + stopWatch.ElapsedMilliseconds/batch);
                 *  stopWatch.Reset();
                 *  //System.Threading.Thread.Sleep(3000);
                 * }
                 * catch (Exception ex)
                 * {
                 *  // Handle the exception however you want.
                 *  Console.WriteLine(ex.ToString());
                 *
                 *  //System.Threading.Thread.Sleep(10000);
                 * }
                 *
                 * //gameBase.CurrentGame().scrapeIndex = 1;
                 * //gameBase.NextGame();
                 */
            }

End:
            Console.WriteLine("Hello World!");
            Console.ReadKey();
        }
示例#19
0
        public async Task <EstatisticasJogador> PersistirEstatisticasJogadorAsync(string puuid)
        {
            #region Instancia api
            var api = RiotApi.GetDevelopmentInstance(_apiConfiguration.Key);

            var ultimaVersao = await _util.RetornarUltimoPatchAsync();

            var campeoes = await api.StaticData.Champions.GetAllAsync(ultimaVersao, Language.pt_BR, fullData : false);

            #endregion

            //Pega estatisticas do banco
            var estatisticasJogador = await _context.EstatisticasJogador.Find(x => x.PUDID == puuid).FirstOrDefaultAsync();


            //Pega últimas 4 seasons
            BsonArray arraySeasons = Util.RetornaUltimasSeason(4).Select(x => (int)x).ToArray().ToBsonDocumentArray();


            #region Retorna taxa de vitória
            var match = new BsonDocument
            {
                {
                    "$match",
                    new BsonDocument
                    {
                        { "PlatformId", estatisticasJogador.Regiao },
                        { "ParticipantIdentities.Player.CurrentAccountId", estatisticasJogador.ContaId },
                        { "SeasonId", new BsonDocument
                          {
                              {
                                  "$in", arraySeasons
                              }
                          } }
                    }
                }
            };

            var unwind1 = new BsonDocument
            {
                {
                    "$unwind",
                    "$Participants"
                }
            };

            var unwind2 = new BsonDocument
            {
                {
                    "$unwind",
                    "$ParticipantIdentities"
                }
            };

            var match2 = new BsonDocument
            {
                {
                    "$match",
                    new BsonDocument
                    {
                        { "ParticipantIdentities.Player.CurrentAccountId", estatisticasJogador.ContaId }
                    }
                }
            };


            var redact = BsonDocument.Parse(@"{'$redact': {
                     '$cond': {
                         if: {$eq: ['$Participants.ParticipantId', '$ParticipantIdentities.ParticipantId']},
                         then : '$$KEEP',
                         else: '$$PRUNE'
                 }}}");

            var groupTaxaVitoria = BsonDocument.Parse(@"{$group: {
                _id : { $toString: '$Participants.ChampionId'}, 
                'PartidasGanhas' : { 
                            '$sum' : {$cond: [{$eq : ['$Participants.Stats.Winner', true]},1, 0 ]}
                            },
                        'PartidasPerdidas' : { 
                            '$sum' : {$cond: [{$eq : ['$Participants.Stats.Winner', false]},1, 0 ]}
                            },
            }}");

            //var projectTaxaVitoria = BsonDocument.Parse("{$project: {PercentualVitoria:{ $divide: [ '$PartidasGanhas', '$TotalPartidas' ]}}}");

            var pipelineTaxaVitoria = new[] { match, unwind1, unwind2, match2, redact, groupTaxaVitoria, /*projectTaxaVitoria */ };

            var lista = await _context
                        .Partidas
                        .Aggregate <VitoriaDerrota>(pipelineTaxaVitoria)
                        .ToListAsync();

            estatisticasJogador.CampeoesXTaxaVitoria = lista.Select(x => new Campeao
            {
                ID               = Convert.ToInt32(x._id),
                PartidasGanhas   = x.PartidasGanhas ?? 0,
                PartidasPerdidas = x.PartidasPerdidas ?? 0,
                TaxaVitoria      = Math.Round((decimal)((decimal)x.PartidasGanhas / ((decimal)x.PartidasPerdidas + (decimal)x.PartidasGanhas)), 2),
                Nome             = campeoes
                                   .Champions
                                   .FirstOrDefault(c => c.Value.Id == Convert.ToInt32(x._id)).Value.Name
            })
                                                       .ToList();

            #endregion

            #region calculo de quantas partidas ganhas e quantas perdidas
            var groupVitoriaDerrota = BsonDocument.Parse(@"{$group: {
                _id : '$ParticipantIdentities.Player.CurrentAccountId', 
                'PartidasGanhas' : { 
                    '$sum' : {$cond: [{$eq : ['$Participants.Stats.Winner', true]},1, 0 ]}
                    },
                'PartidasPerdidas' : { 
                    '$sum' : {$cond: [{$eq : ['$Participants.Stats.Winner', false]},1, 0 ]}
                    },
                }}");

            var pipelineVitoriaDerrota = new[] { match, unwind1, unwind2, match2, redact, groupVitoriaDerrota };

            var vitoriaDerrota = await _context
                                 .Partidas
                                 .Aggregate <VitoriaDerrota>(pipelineVitoriaDerrota)
                                 .FirstOrDefaultAsync();

            estatisticasJogador.PartidasGanhas   = vitoriaDerrota?.PartidasGanhas ?? 0;
            estatisticasJogador.PartidasPerdidas = vitoriaDerrota?.PartidasPerdidas ?? 0;

            #endregion

            #region lanes mais jogadas

            var projectLanesMaisJogadas = BsonDocument.Parse(@"{$project: {
               Lane:{ 
                   '$switch' : {
                        'branches':[
                            {case: { $eq : ['$Participants.Timeline.Lane', 'TOP']}, then: 'Top'},
                            {case: { $in: ['$Participants.Timeline.Lane',  ['MIDDLE','MID']]}, then: 'Mid'},
                            {case: { $and: [ { $in: ['$Participants.Timeline.Lane',  ['BOTTOM','BOT']] }, {$eq: ['$Participants.Timeline.Role', 'DUO_SUPPORT']}]}, then: 'Support'},
                            {case: { $and: [ { $in: ['$Participants.Timeline.Lane',  ['BOTTOM','BOT']] }, {$ne: ['$Participants.Timeline.Role', 'DUO_SUPPORT']}]}, then: 'Adc'},
                            {case: { $eq : ['$Participants.Timeline.Lane', 'JUNGLE']}, then: 'JUNGLE'},
                       ],
                        default: 'Não definida'
                       }
                   },
               Vitoria: '$Participants.Stats.Winner'
               }
           }");

            var groupLanesMaisJogadas = BsonDocument.Parse(@"{$group: {
                _id : '$Lane', 
                'PartidasGanhas' : { 
                    '$sum' : {$cond: [{$eq : ['$Vitoria', true]},1, 0 ]}
                    },
                'PartidasPerdidas' : { 
                    '$sum' : {$cond: [{$eq : ['$Vitoria', false]},1, 0 ]}
                    },
            }}");

            var pipelineLanesMaisJogadas = new[] { match, unwind1, unwind2, match2, redact, projectLanesMaisJogadas, groupLanesMaisJogadas };

            var lanesMaisJogadas = await _context
                                   .Partidas
                                   .Aggregate <VitoriaDerrota>(pipelineLanesMaisJogadas)
                                   .ToListAsync();

            var totalPartidasJogadas = lanesMaisJogadas?.Sum(l => (l.PartidasGanhas ?? 0) + (l.PartidasPerdidas ?? 0)) ?? 0;

            if (totalPartidasJogadas > 0)
            {
                estatisticasJogador.Lanes = lanesMaisJogadas?.Select(x => new LaneModel(x._id, x.PartidasGanhas ?? 0, x.PartidasPerdidas ?? 0, totalPartidasJogadas)).ToList();
            }

            #endregion


            #region taxaPrimeiroBarao
            var unwindTeams = new BsonDocument
            {
                {
                    "$unwind",
                    "$Teams"
                }
            };

            var redactTeams = BsonDocument.Parse(@"{'$redact': {
                     '$cond': {
                         if: {
                            $and: [
                                { $eq: ['$Participants.ParticipantId', '$ParticipantIdentities.ParticipantId'] },
                                { $eq: ['$Participants.TeamId', '$Teams.TeamId'] }
                            ]},
                         then : '$$KEEP',
                         else: '$$PRUNE'
                 }}}");


            var groupBaron = BsonDocument.Parse(@"{$group: {
              _id : '$ParticipantIdentities.Player.CurrentAccountId', 
              'PrimeiroBaronSim' : { 
                  '$sum' : {$cond: [{$eq : ['$Teams.FirstBaron', true]},1, 0 ]}
                  },
              'PrimeiroBaronNao' : { 
                  '$sum' : {$cond: [{$eq : ['$Teams.FirstBaron', false]},1, 0 ]}
                  },
            }}");

            var pipelineBaron = new[] { match, unwind1, unwind2, unwindTeams, match2, redactTeams, groupBaron };

            var baronEstatisticas = await _context
                                    .Partidas
                                    .Aggregate <BaronEstatisticas>(pipelineBaron)
                                    .FirstOrDefaultAsync();

            if (totalPartidasJogadas > 0)
            {
                estatisticasJogador.TaxaPrimeiroBarao = Math.Round((decimal)((decimal)(baronEstatisticas?.PrimeiroBaronSim ?? 0) / (decimal)totalPartidasJogadas), 2);
            }

            #endregion

            #region taxaFirstBlood


            var groupFirstBlood = BsonDocument.Parse(@"{$group: {
              _id : '$ParticipantIdentities.Player.CurrentAccountId', 
              'FirstBloodSim' : { 
                  '$sum' : {$cond: [{$eq : ['$Teams.FirstBlood', true]},1, 0 ]}
                  },
              'FirstBloodNao' : { 
                  '$sum' : {$cond: [{$eq : ['$Teams.FirstBlood', false]},1, 0 ]}
                  },
            }}");

            var pipelineFirstBlood = new[] { match, unwind1, unwind2, unwindTeams, match2, redactTeams, groupFirstBlood };

            var firstBloodEstatisticas = await _context
                                         .Partidas
                                         .Aggregate <FirstBloodEstatisticas>(pipelineFirstBlood)
                                         .FirstOrDefaultAsync();

            if (totalPartidasJogadas > 0)
            {
                estatisticasJogador.TaxaFirstBlood = Math.Round((decimal)((decimal)firstBloodEstatisticas?.FirstBloodSim / (decimal)totalPartidasJogadas), 2);
            }

            #endregion

            //Faz o update do documento
            await _context.EstatisticasJogador.ReplaceOneAsync(Builders <EstatisticasJogador> .Filter.Eq(x => x.PUDID, estatisticasJogador.PUDID), estatisticasJogador);

            return(estatisticasJogador);
        }
示例#20
0
        private static List <Match> GetMatchesFromApiAsync(RiotApi api, SummonerBase summonerBase, GameBase gameBase, int limit)
        {
            List <Task <Match> > tasks     = new List <Task <Match> >();
            List <Match>         matchList = new List <Match>();

            foreach (var game in gameBase.gameList)
            {
                if (limit < 1)
                {
                    break;
                }

                if (game.scrapeIndex == 0)
                {
                    tasks.Add(api.Match.GetMatchAsync(Region.euw, game.gameId));
                    //tasks.Add(DownloadMatch(api, Region.euw, game.gameId));
                    game.scrapeIndex = 1; //TODO check if actually scraped

                    limit--;
                }
            }

            try
            {
                Task.WhenAll(tasks);
            }
            catch (RiotSharpException ex)
            {
                Console.WriteLine(ex.HttpStatusCode);

                //tasks.Clear();

                foreach (var task in tasks)
                {
                    task.Dispose();
                    //Console.WriteLine("Task - IsFaulted: " + task.IsFaulted + "     IsCanceled: " + task.IsCanceled + "     IsCompleted: " + task.IsCompleted);
                }

                //System.Threading.Thread.Sleep(10000);
            }

            foreach (var match in tasks)
            {
                if (match.Result != null)
                {
                    matchList.Add(match.Result);
                }
            }

            return(matchList);


            /*
             * var matchResult = await api.Match.GetMatchAsync(Region.euw, game.gameId);
             *
             * foreach (ParticipantIdentity pId in matchResult.ParticipantIdentities)
             * {
             *  var summoner = pId.Player;
             *  //Console.WriteLine(match.PlatformID.GetHashCode() + " " + match.Region.GetHashCode());
             *  summonerBase.AddUniqueSummoner(new Summoner(0, summoner.SummonerName, null, summoner.SummonerId, summoner.CurrentAccountId, summoner.CurrentPlatformId.GetHashCode(), summoner.ProfileIcon, 0, 0, 0, DateTime.FromBinary(0)));
             * }
             *
             * gameBase.gameList.Remove(game);
             * game.scrapeIndex = 1;
             * gameBase.gamesToUpdate.Add(game);
             *
             * //Console.WriteLine("added summoners from game: " + game.gameId);
             */
        }
示例#21
0
 public ChampionsService(ApplicationDbContext db)
 {
     this.db        = db;
     this.api       = RiotApi.GetDevelopmentInstance(PublicData.apiKey);
     this.ddVersion = PublicData.ddVerision;
 }
        public static void Obtener_Enemigos()
        {
            RiotSharp.RiotApi       Api       = RiotApi.GetDevelopmentInstance(_Key);
            RiotSharp.StaticRiotApi StaticApi = StaticRiotApi.GetInstance(_Key);

            try
            {
                RiotSharp.SummonerEndpoint.Summoner            Summoner     = Api.GetSummonerByName(_Region, _NombreInvocador);
                List <RiotSharp.SpectatorEndpoint.Participant> Participants = Api.GetCurrentGame(_Region, Summoner.Id).Participants;

                // --- ## Diccionarios para cargar los campeones & hechizos ## --- //

                Dictionary <string, RiotSharp.StaticDataEndpoint.Champion.ChampionStatic> .ValueCollection championlist =
                    StaticApi.GetChampions(_Region, RiotSharp.StaticDataEndpoint.ChampionData.All).Champions.Values;

                Dictionary <string, RiotSharp.StaticDataEndpoint.SummonerSpell.SummonerSpellStatic> .ValueCollection SummonerSpell =
                    StaticApi.GetSummonerSpells(_Region, RiotSharp.StaticDataEndpoint.SummonerSpellData.All).SummonerSpells.Values;

                // --- ## Diccionarios para cargar los campeones & hechizos ## --- //

                int total = Participants.Count;
                int index = Participants.FindIndex(a => a.SummonerName == _NombreInvocador);

                if (index > (total / 2) - 1)
                {
                    for (int i = 0; i <= (total / 2) - 1; i++)
                    {
                        IEnumerable <RiotSharp.StaticDataEndpoint.Champion.ChampionStatic>
                        CampeonWhere = championlist.Where(yourself => yourself.Id == Participants[i].ChampionId);

                        IEnumerable <RiotSharp.StaticDataEndpoint.SummonerSpell.SummonerSpellStatic>
                        Spell1Where = SummonerSpell.Where(yourself => yourself.Id == Participants[i].SummonerSpell1);

                        IEnumerable <RiotSharp.StaticDataEndpoint.SummonerSpell.SummonerSpellStatic>
                        Spell2Where = SummonerSpell.Where(yourself => yourself.Id == Participants[i].SummonerSpell2);

                        Enemigos.Add(CampeonWhere.First());
                        Hechizos.Add(Spell1Where.First());
                        Hechizos.Add(Spell2Where.First());
                    }
                }
                else
                {
                    for (int i = 0; i <= (total / 2) - 1; i++)
                    {
                        IEnumerable <RiotSharp.StaticDataEndpoint.Champion.ChampionStatic>
                        CampeonWhere = championlist.Where(yourself => yourself.Id == Participants[total / 2 + i].ChampionId);

                        IEnumerable <RiotSharp.StaticDataEndpoint.SummonerSpell.SummonerSpellStatic>
                        Spell1Where = SummonerSpell.Where(yourself => yourself.Id == Participants[total / 2 + i].SummonerSpell1);

                        IEnumerable <RiotSharp.StaticDataEndpoint.SummonerSpell.SummonerSpellStatic>
                        Spell2Where = SummonerSpell.Where(yourself => yourself.Id == Participants[total / 2 + i].SummonerSpell2);


                        Enemigos.Add(CampeonWhere.First());
                        Hechizos.Add(Spell1Where.First());
                        Hechizos.Add(Spell2Where.First());
                    }
                }
            }
            catch (RiotSharpException e)
            {
                _controlar_excepcion = e.Message;
            }
        }
示例#23
0
 public RiotService(RiotApi api)
 {
     _api = api;
 }
示例#24
0
    void getdivisionboostprogress(int i)
    {
        //sindesi me tin riot kai me json anaktisi tou division tou paikti
        try
        {
            if (int.Parse(datat1.Rows[i][14].ToString()) != 2)
            {
                var api      = RiotApi.GetInstance("RGAPI-cf5bf121-65f7-41cd-85f8-9b3b0b4b1f03");
                var summoner = (dynamic)null;
                switch (setserver(custumerserver))
                {
                case "EUW":
                    summoner = api.GetSummoner(RiotSharp.Region.euw, game_summonername);
                    break;

                case "EUNE":
                    summoner = api.GetSummoner(RiotSharp.Region.eune, game_summonername);
                    break;

                case "NA":
                    summoner = api.GetSummoner(RiotSharp.Region.na, game_summonername);
                    break;

                case "OCE":
                    summoner = api.GetSummoner(RiotSharp.Region.oce, game_summonername);
                    break;
                }

                List <RiotSharp.LeagueEndpoint.League> test = summoner.GetLeagues();
                var league   = test[0].Tier.ToString();
                var division = test[0].Entries[0].Division.ToString();
                var lp       = test[0].Entries[0].LeaguePoints.ToString();
                var a        = test[0].Entries[0].Wins.ToString();
                label_progressdivcurrent1.Text = "" + league + " ";
                label_progressdivcurrent2.Text = "" + division;
                label_progressdivcurrent3.Text = "" + lp + "LP";
                strprogressdivcurrent1         = league;
                strprogressdivcurrent2         = division;
                strprogressdivcurrent3         = Int32.Parse(lp);
                test.Clear();
                img_progressdivcurrent.ImageUrl = setdivisionpic(league);
                //if ((datat1.Rows[i][11].ToString() == league) && (datat1.Rows[i][12].ToString() == division))
                //{
                //    finishorder(i);
                //}
            }
            else
            {
                img_progressdivcurrent.ImageUrl = setdivisionpic(datat1.Rows[i][11].ToString());
                label_progressdivcurrent1.Text  = "" + datat1.Rows[i][11].ToString() + " ";
                label_progressdivcurrent2.Text  = "" + datat1.Rows[i][12].ToString();
                label_progressdivcurrent3.Text  = "";
            }

            img_progressdivstart.ImageUrl   = setdivisionpic(datat1.Rows[i][6].ToString());
            label_progressdivstart.Text     = "" + datat1.Rows[i][6].ToString() + "\n" + datat1.Rows[i][7].ToString();
            img_progressdivdesired.ImageUrl = setdivisionpic(datat1.Rows[i][11].ToString());
            label_progressdivdesired.Text   = "" + datat1.Rows[i][11].ToString() + " " + datat1.Rows[i][12].ToString();
        }
        catch
        {
            img_progressdivstart.ImageUrl   = setdivisionpic("Bronze-black-white");
            label_progressdivstart.Text     = "";
            img_progressdivdesired.ImageUrl = setdivisionpic("Bronze-black-white");
            label_progressdivdesired.Text   = "";
            img_progressdivcurrent.ImageUrl = setdivisionpic("Bronze-black-white");
            label_progressdivcurrent1.Text  = "";
            label_progressdivcurrent2.Text  = "";
            label_progressdivcurrent3.Text  = "";
            //if (datat1.Rows[i][3].ToString() != "")
            //{
            //    free_game_summonername();
            //}
        }
    }
示例#25
0
 public Form1()
 {
     InitializeComponent();
     var api = RiotApi.GetInstance("AN-ACTUAL-API-KEY");
 }
示例#26
0
 public LeagueApiService(IConfiguration configuration)
 {
     _config = (IConfigurationRoot)configuration;
     //TODO API Key should be moved to appsettings.json
     _riotApi = RiotApi.NewInstance("RGAPI-27f314d6-8e0c-4765-b36a-4a56b782f363");
 }
示例#27
0
    void getwinsprogress(int i)
    {
        //sindesi me tin riot kai me json anaktisi tou division tou paikti
        try
        {
            if (int.Parse(datat1.Rows[i][14].ToString()) != 2)
            {
                var api      = RiotApi.GetInstance("RGAPI-cf5bf121-65f7-41cd-85f8-9b3b0b4b1f03");
                var summoner = (dynamic)null;
                switch (setserver(custumerserver))
                {
                case "EUW":
                    summoner = api.GetSummoner(RiotSharp.Region.euw, game_summonername);
                    break;

                case "EUNE":
                    summoner = api.GetSummoner(RiotSharp.Region.eune, game_summonername);
                    break;

                case "NA":
                    summoner = api.GetSummoner(RiotSharp.Region.na, game_summonername);
                    break;

                case "OCE":
                    summoner = api.GetSummoner(RiotSharp.Region.oce, game_summonername);
                    break;
                }

                List <RiotSharp.LeagueEndpoint.League> test = summoner.GetLeagues();

                var wins    = test[0].Entries[0].Wins.ToString();
                int winsint = Int32.Parse(wins);
                if (datat1.Rows[i][8].ToString() == "")
                {
                    MySqlConnection con = openconnection();
                    MySqlCommand    cmd = new MySqlCommand("UPDATE `db_divisionboost`.`orderprogress` SET `OrderStartLp` = @startwins WHERE `idOrderProgress` = '" + datat1.Rows[i][5].ToString() + "';", con);
                    cmd.CommandType = CommandType.Text;

                    cmd.Parameters.AddWithValue("@startwins", winsint);
                    obj = cmd.ExecuteScalar();
                    con.Close();
                    currentplacementlb.Text = "0";
                }
                else
                {
                    currentgames            = winsint - Int32.Parse(datat1.Rows[i][8].ToString());
                    currentplacementlb.Text = currentgames.ToString();;

                    //if ((winsint - Int32.Parse(datat1.Rows[i][8].ToString())) >= Int32.Parse(datat1.Rows[i][13].ToString()))
                    //{
                    //    finishorder(i);
                    //}
                }
            }
            else
            {/////////////////////edo stamatisa
                currentplacementlb.Text = datat1.Rows[i][13].ToString();
                desiredplacementlb.Text = datat1.Rows[i][13].ToString();
            }
            label_progressdivstart.Text = datat1.Rows[i][6].ToString();
            Label1.Text      = "Current Rank";
            Label1.Font.Size = 21;
            img_progressdivstart.ImageUrl  = setdivisionpic(datat1.Rows[i][6].ToString());
            currentplacementlb.Visible     = true;
            desiredplacementlb.Visible     = true;
            img_progressdivcurrent.Visible = false;
            img_progressdivdesired.Visible = false;
            desiredplacementlb.Text        = datat1.Rows[row_with_order][13].ToString();
            label_progressdivcurrent1.Text = "Current";
            label_progressdivcurrent2.Text = " Win";
            label_progressdivcurrent3.Text = "Games";
        }
        catch
        {
            img_progressdivstart.ImageUrl   = setdivisionpic("Bronze-black-white");
            label_progressdivstart.Text     = "";
            img_progressdivdesired.ImageUrl = setdivisionpic("Bronze-black-white");
            label_progressdivdesired.Text   = "";
            img_progressdivcurrent.ImageUrl = setdivisionpic("Bronze-black-white");
            label_progressdivcurrent1.Text  = "";
            label_progressdivcurrent2.Text  = "";
            label_progressdivcurrent3.Text  = "";
            if (datat1.Rows[i][3].ToString() != "")
            {
                free_game_summonername();
            }
        }
    }
示例#28
0
 public MatchService()
 {
     _riotApi = RiotApi.GetDevelopmentInstance(ApiKeys.RiotApiKey);
 }
示例#29
0
        static void Main(string[] args)
        {
            Stopwatch stopWatch1 = new Stopwatch();
            Stopwatch stopWatch2 = new Stopwatch();
            long      countje    = 0;

            int ClientNumber = -1;

            try
            {
                ClientNumber  = Convert.ToInt32(args[0]);
                Console.Title = "GameFinderV4 Client #" + ClientNumber.ToString();
                Console.WriteLine("Client Number: " + ClientNumber.ToString());
            }
            catch (Exception)
            {
                Console.WriteLine("Enter client number argument");
                Console.ReadKey();
                return;
            }



            MySqlConnection link;

            link = new MySqlConnection(ConfigurationManager.AppSettings["MySqlConnectionString"]);
            int timeoutTimetime = 1;

            while (!link.Ping())
            {
                try
                {
                    link.Open();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }

                System.Threading.Thread.Sleep(1000);
            }

            Console.WriteLine("Conncection to Database: " + link.Ping());
            //var api = RiotApi.(ConfigurationManager.AppSettings["RiotApiKey"], 500, 30000);
            var api = RiotApi.GetInstance(ConfigurationManager.AppSettings["RiotApiKey"], 495, 29500);

            try
            {
                var test   = api.Champion.GetChampionRotationAsync(Region.euw);
                var result = test.Result.FreeChampionIds;
            }
            catch (Exception ex)
            {
                Console.WriteLine("Connection to Api: " + ex.InnerException.Message);
                goto End;
            }

            Console.WriteLine("Connection to Api: True");

            var gameBase     = new GameBase();
            var summonerBase = new SummonerBase();

            //var sips = new Summoner("SipsClar", null, null, "0fhpK-H2m0-tS_xeHpBRyXL9Lzu_uGTNts9cwCF36BJ-FnU", 0, 0, 0, 0, 0, new DateTime(0));

            //summonerBase.AddSummoner(sips);

            //summonerBase.LoadFromDatabase(link, 100);

            stopWatch2.Start();

            while (true)
            {
                if (!summonerBase.SummonersAvailable())
                {
tryagain:
                    gameBase.NewGamesToDatabase(link);
                    //load new or break
                    if (summonerBase.LoadFromDatabase(link, ClientNumber * 5000, 500))
                    {
                        Console.WriteLine("Loaded new players from database");
                        timeoutTimetime = 1;
                    }
                    else
                    {
                        if (timeoutTimetime > 5)
                        {
                            Console.WriteLine("Could not load new players from database: Breaking");
                            break;
                        }
                        Console.WriteLine("Could not load new players from database: Timeout " + timeoutTimetime + " minute");
                        System.Threading.Thread.Sleep(timeoutTimetime * 60000);
                        timeoutTimetime++;
                        goto tryagain;
                    }
                }

                if (gameBase.gameList.Count > 10000)
                {
                    //stopWatch2.Stop();
                    Console.WriteLine("batchtime: " + stopWatch2.ElapsedMilliseconds / countje);
                    //stopWatch2.Reset();
                    //stopWatch2.Start();

                    gameBase.NewGamesToDatabase(link);
                    summonerBase.UpdateSummonersToDatabase(link);
                }


                int       beginIndex     = 0;
                MatchList gameListResult = new MatchList();
                DateTime  checkedUntil   = DateTime.FromBinary(0);
                stopWatch1.Start();
                do
                {
                    try
                    {
                        gameListResult = api.Match.GetMatchListAsync(Region.euw, summonerBase.CurrentSummoner().accountId, null, new List <int>(new int[] { 450 }), null, summonerBase.CurrentSummoner().checkedUntil, null, beginIndex, null).Result;
                    }
                    catch (Exception e)
                    {
                        Console.WriteLine("Error with Summoner: " + summonerBase.CurrentSummoner().name);
                        //Console.WriteLine(e.ToString());

                        string em = e.InnerException.Message;

                        if (e.InnerException.Message.Contains("A task"))
                        {
                            Console.WriteLine(em);
                            api = RiotApi.GetInstance(ConfigurationManager.AppSettings["RiotApiKey"], 495, 29500);
                        }
                        else if (em.StartsWith("500") || em.StartsWith("503") || em.StartsWith("504") || em.StartsWith("429"))
                        {
                            Console.WriteLine(em);
                        }
                        else
                        {
                            Console.WriteLine("\nOther Error\n");
                            Console.WriteLine(e.ToString());
                        }

                        System.Threading.Thread.Sleep(5000);
                    }

                    if (gameListResult.Matches != null)
                    {
                        foreach (MatchReference match in gameListResult.Matches)
                        {
                            gameBase.AddNewGame(match.GameId, match.PlatformID.GetHashCode(), match.Season.GetHashCode(), match.Timestamp);
                        }

                        if (beginIndex == 0) //only run first loop
                        {
                            checkedUntil = gameListResult.Matches.Max(t => t.Timestamp).AddSeconds(1);
                        }

                        beginIndex += 100;
                        countje++;
                    }
                    else
                    {
                        continue;
                    }
                } while (gameListResult.TotalGames > beginIndex);
                if (gameListResult.Matches != null)
                {
                    stopWatch1.Stop();

                    summonerBase.CurrentSummoner().AddGamesFound(gameListResult.TotalGames, checkedUntil);

                    Console.WriteLine(DateTime.Now.ToString("HH:mm:ss") + "  dt: " + stopWatch1.ElapsedMilliseconds / ((gameListResult.TotalGames + 99) / 100) + "\t" + gameListResult.TotalGames.ToString() + " games added from summoner: " + summonerBase.CurrentSummoner().name);
                    stopWatch1.Reset();

                    summonerBase.NextSummoner();
                }
            }


End:
            Console.WriteLine("Hello World!");
            Console.ReadKey();
        }
示例#30
0
        public SummonerInfo GetInfo(string SummonerName, Region region)
        {
            SummonerInfo summonerInfo = new SummonerInfo("Unknown");

            string summonername;

            var api = RiotApi.GetDevelopmentInstance(apiKey);

            summonername = SummonerName;

            try
            {
                //General info about account
                var summoner = api.Summoner.GetSummonerByNameAsync(region, summonername).Result;
                summonerInfo.name   = summoner.Name;
                summonerInfo.region = summoner.Region.ToString();
                summonerInfo.level  = summoner.Level.ToString();
                var accountid = summoner.AccountId;

                Console.WriteLine("Name:" + summonerInfo.name);
                Console.WriteLine("Region:" + summonerInfo.region);
                Console.WriteLine("Level:" + summonerInfo.level);

                try
                {
                    List <LeagueEntry> rank = api.League.GetLeagueEntriesBySummonerAsync(summoner.Region, summoner.Id).Result;

                    if (rank[0].QueueType == "RANKED_SOLO_5x5")
                    {
                        try
                        {
                            //Getting players ranks
                            Console.WriteLine("Rank solo:" + rank[0].Tier + " " + rank[0].Rank);
                            summonerInfo.soloRank = rank[0].Tier + " " + rank[0].Rank;
                            Console.WriteLine("Rank flex:" + rank[1].Tier + " " + rank[1].Rank);
                            summonerInfo.flexRank = rank[1].Tier + " " + rank[1].Rank;
                        }
                        catch
                        {
                            Console.WriteLine("\nProblems with solorank\n");
                        }

                        try
                        {
                            //Getting players winrates
                            float sWinrate = (float)rank[0].Wins / ((float)rank[0].Wins + (float)rank[0].Losses);
                            sWinrate *= 100;
                            Console.WriteLine("Solo ranked winrate:" + Math.Round(sWinrate, 1) + "%");
                            summonerInfo.soloWinrate = Math.Round(sWinrate, 1).ToString();

                            float fWinrate = (float)rank[1].Wins / ((float)rank[1].Wins + (float)rank[1].Losses);
                            fWinrate *= 100;
                            Console.WriteLine("Flex ranked winrate:" + Math.Round(fWinrate, 1) + "%");
                            summonerInfo.flexWinrate = Math.Round(fWinrate, 1).ToString();
                        }
                        catch
                        {
                            Console.WriteLine("\nProblems with winrates\n");
                        }
                    }
                    else
                    {
                        try
                        {
                            //Getting players ranks
                            Console.WriteLine("Rank flex:" + rank[0].Tier + " " + rank[0].Rank);
                            summonerInfo.flexRank = rank[0].Tier + " " + rank[0].Rank;
                            Console.WriteLine("Rank solo:" + rank[1].Tier + " " + rank[1].Rank);
                            summonerInfo.soloRank = rank[1].Tier + " " + rank[1].Rank;
                        }
                        catch
                        {
                            Console.WriteLine("\nProblems with solorank\n");
                        }

                        try
                        {
                            //Getting players winrates
                            float fWinrate = (float)rank[0].Wins / ((float)rank[0].Wins + (float)rank[0].Losses);
                            fWinrate *= 100;
                            Console.WriteLine("Flex ranked winrate:" + Math.Round(fWinrate, 1) + "%");
                            summonerInfo.flexWinrate = Math.Round(fWinrate, 1).ToString();

                            float sWinrate = (float)rank[1].Wins / ((float)rank[1].Wins + (float)rank[1].Losses);
                            sWinrate *= 100;
                            Console.WriteLine("Solo ranked winrate:" + Math.Round(sWinrate, 1) + "%");
                            summonerInfo.soloWinrate = Math.Round(sWinrate, 1).ToString();
                        }
                        catch
                        {
                            Console.WriteLine("\nProblems with winrates\n");
                        }
                    }
                }
                catch
                {
                    Console.WriteLine("\nProblems with rank\n");
                    return(summonerInfo);
                }

                return(summonerInfo);
            }
            catch
            {
                Console.WriteLine("\nPlayer not found (or smth else)\n");
                return(summonerInfo);
            }
        }
示例#31
0
 public RiotSharpService(ISanitizerService sanitizerService)
 {
     this.api              = RiotApi.GetDevelopmentInstance("RGAPI-58084645-3667-433c-8bd8-e13077f0819f");
     this.latestVersion    = this.api.StaticData.Versions.GetAllAsync().GetAwaiter().GetResult()[0];
     this.sanitizerService = sanitizerService;
 }
示例#32
0
 public LeagueModule(BotDbContext botDbContext)
 {
     _api     = RiotApi.NewInstance(Environment.GetEnvironmentVariable("RIOT_API_TOKEN"));
     _context = botDbContext;
 }
示例#33
0
        static void Main(string[] args)
        {
            MySqlConnection link;

            link = new MySqlConnection(ConfigurationManager.AppSettings["MySqlConnectionString"]);
            int timeoutTimetime = 1;

            while (!link.Ping())
            {
                try
                {
                    link.Open();
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex.ToString());
                }

                System.Threading.Thread.Sleep(1000);
            }

            Console.WriteLine("Conncection to Database: " + link.Ping());
            var api = RiotApi.GetDevelopmentInstance(ConfigurationManager.AppSettings["RiotApiKey"]);

            try
            {
                var test   = api.Champion.GetChampionRotationAsync(Region.euw);
                var result = test.Result.FreeChampionIds;
            }
            catch (Exception ex)
            {
                Console.WriteLine("Connection to Api: " + ex.InnerException.Message);
                goto End;
            }

            Console.WriteLine("Connection to Api: True");

            var gameBase     = new GameBase();
            var summonerBase = new SummonerBase();

            //var sips = new Summoner("SipsClar", null, null, "0fhpK-H2m0-tS_xeHpBRyXL9Lzu_uGTNts9cwCF36BJ-FnU", 0, 0, 0, 0, 0, new DateTime(0));

            //summonerBase.AddSummoner(sips);

            //summonerBase.LoadFromDatabase(link, 100);

            while (true)
            {
                if (!summonerBase.SummonersAvailable())
                {
tryagain:
                    gameBase.UpdateGamesToDatabase(link);
                    //load new or break
                    if (summonerBase.LoadFromDatabase(link, 100))
                    {
                        Console.WriteLine("Loaded new players from database");
                        timeoutTimetime = 1;
                    }
                    else
                    {
                        if (timeoutTimetime > 5)
                        {
                            Console.WriteLine("Could not load new players from database: Breaking");
                            break;
                        }
                        Console.WriteLine("Could not load new players from database: Timeout " + timeoutTimetime + " minute");
                        System.Threading.Thread.Sleep(timeoutTimetime * 60000);
                        timeoutTimetime++;
                        goto tryagain;
                    }
                }

                try
                {
                    var gameListResult = api.Match.GetMatchListAsync(Region.euw, summonerBase.CurrentSummoner().accountId, null, new List <int>(new int[] { 450 }), null, summonerBase.CurrentSummoner().checkedUntil, null, null, null);

                    foreach (MatchReference match in gameListResult.Result.Matches)
                    {
                        //Console.WriteLine(match.PlatformID.GetHashCode() + " " + match.Region.GetHashCode());

                        gameBase.AddNewGame(match.GameId, Region.euw.GetHashCode(), match.Season.GetHashCode(), match.Timestamp);
                    }

                    summonerBase.CurrentSummoner().AddGamesFound(gameListResult.Result);

                    Console.WriteLine(gameListResult.Result.Matches.Count.ToString() + " games added from summoner: " + summonerBase.CurrentSummoner().name);
                }
                catch (Exception ex)
                {
                    // Handle the exception however you want.

                    if (ex.InnerException.Message == "404, Resource not found")
                    {
                        Console.WriteLine("No new games for summoner: " + summonerBase.CurrentSummoner().name); // TODO
                        summonerBase.CurrentSummoner().NoGamesFound();
                    }
                    else
                    {
                        Console.WriteLine(ex.ToString());
                    }
                }

                summonerBase.NextSummoner();
            }


End:
            Console.WriteLine("Hello World!");
            Console.ReadKey();
        }
示例#34
0
 static Riot()
 {
     // Get API key from resources.
     _api = RiotApi.GetDevelopmentInstance(Properties.Resources.Key);
 }