public static string ToStringValue(this ERegion region)
 {
     return(region switch
     {
         ERegion.Eu => ApiRanks.Emea,
         ERegion.Na => ApiRanks.Ncsa,
         ERegion.Asia => ApiRanks.Apac,
         _ => throw new ArgumentOutOfRangeException(nameof(region), region, null)
     });
Beispiel #2
0
 public static string ToLongName(this ERegion region)
 {
     return(region switch
     {
         ERegion.Bilgewater => "Bilgewater",
         ERegion.Demacia => "Demacia",
         ERegion.Freljord => "Freljord",
         ERegion.Ionia => "Ionia",
         ERegion.Noxus => "Noxus",
         ERegion.PnZ => "Piltover & Zaun",
         ERegion.Si => "Shadow Isles",
         ERegion.Targon => "Targon",
         ERegion.ALL => "Collection",
         _ => "ALL"
     });
Beispiel #3
0
        public static IHtmlDocument GetHtmlPageCrawlera(string url, ERegion region = ERegion.ALL)
        {
            string apiKeyUs  = "2abdabfa02ab4595bbdbb92ac4088432";
            string apiKeyAll = "36f14b90c38c4005a81ccbed16a31f58";
            string apiKey    = apiKeyAll;

            if (region == ERegion.ALL)
            {
                apiKey = apiKeyAll;
            }
            if (region == ERegion.US)
            {
                apiKey = apiKeyUs;
            }

            return(GetHtmlPageCrawlera(url, apiKey));
        }
Beispiel #4
0
        public static IHtmlDocument GetHtmlPageCrawlera5Try(string url, ERegion region = ERegion.ALL)
        {
            int  i         = 0;
            bool isGetPage = false;

            while (i < 5)
            {
                try
                {
                    var page = GetHtmlPageCrawlera(url, region);
                    return(page);
                }
                catch (Exception e)
                {
                    _logger.Error(e.Message);
                    _logger.Error(e.StackTrace);
                    i++;
                }
            }
            _logger.Error("page didn't get: " + url);
            return(null);
        }
Beispiel #5
0
 public AddressCompany(string cep, string logradouro, string complemento, string bairro, string localidade, string uf, string ibge, string gia, string number, string reference, ERegion region, int idCompany)
 {
     this.Cep         = cep;
     this.Logradouro  = logradouro;
     this.Complemento = complemento;
     this.Bairro      = bairro;
     this.Localidade  = localidade;
     this.Uf          = uf;
     this.Ibge        = ibge;
     this.IdCompany   = idCompany;
     this.Gia         = gia;
     this.Number      = number;
     this.Reference   = reference;
     this.Region      = region;
 }
Beispiel #6
0
        public async Task <IDictionary <string, Rank> > GetRanksAsync(IEnumerable <string> profileIds, ERegion region, EPlatform platform, int season = -1)
        {
            var ranksRequest = new RanksRequest
            {
                UbiAppId   = _settings.UbiAppId,
                Ticket     = _ticket,
                SessionId  = _sessionId,
                BoardId    = "pvp_ranked",
                Profileids = profileIds,
                Platform   = platform,
                Region     = region,
                SeasonId   = season
            };

            var ranksResponse = await _apiManager.GetRanksResponseAsync(ranksRequest);

            return(ranksResponse.RankContracts.ToDictionary(r => r.Key, r => ApiMapper.GetMappedRank(r.Value)));
        }
Beispiel #7
0
        public async Task <KeyValuePair <string, Rank> > GetRankAsync(string profileId, ERegion region, EPlatform platform, int season = -1)
        {
            var ranks = await GetRanksAsync(new[] { profileId }, region, platform, season);

            return(ranks.FirstOrDefault());
        }