/// <inheritdoc />
        public async Task <IReadOnlyCollection <EntryWebDto> > ExtractStageAllTimeEntriesAsync(Stage stage)
        {
            var entries = new List <EntryWebDto>();
            var logs    = new List <string>();

            string pageContent = await GetPageStringContentAsync($"/ajax/stage/{(long)stage}/{_configuration.AjaxKey}").ConfigureAwait(false);

            if (string.IsNullOrWhiteSpace(pageContent))
            {
                throw new FormatException($"Unables to load the page content for stage {stage}.");
            }

            var jsonContent = Newtonsoft.Json.JsonConvert.DeserializeObject <IReadOnlyCollection <IReadOnlyCollection <object> > >(pageContent);

            if (jsonContent == null || jsonContent.Count != SystemExtensions.Count <Level>())
            {
                throw new FormatException($"The list of entries by level is invalid.");
            }

            Dictionary <Level, List <long> > links = ExtractEntryIdListFromJsonContent(jsonContent, logs);

            foreach (Level levelKey in links.Keys)
            {
                foreach (long entryId in links[levelKey])
                {
                    var entryDetails = await ExtractEntryDetailsAsync(entryId, stage, levelKey, logs).ConfigureAwait(false);

                    entries.AddRange(entryDetails);
                }
            }

            return(entries);
        }
예제 #2
0
        internal RankingEntryLight(Game game, PlayerDto player)
        {
            Game   = game;
            Player = new Player(player);

            Points             = 0;
            UntiedRecordsCount = 0;
            RecordsCount       = 0;

            CumuledTime = (UnsetTimeValueSeconds * Game.GetStages().Count) * SystemExtensions.Count <Level>();
        }