Example #1
0
        public async Task <string> GetDemos(DateTime startTime, DateTime endTime)
        {
            if (_running)
            {
                return("Already getting demos!");
            }

            _runStartTime = DateTime.Now;
            _running      = true;

            //Get tags now, so they are in memory.
            _hubTags = await GetFaceHubTags();

            //Populate the matches list
            await GetMatches(startTime, endTime);

            if (_gameInfo.Count == 0)
            {
                var msg = "No matches were found on any endpoint!";
                await _log.LogMessage(msg);

                _running = false;
                return(msg);
            }

            //Start downloading the files and unzip
            await HandleMatchDemos();

            //Parse the demos
            await HandleDemoParsing();

            //Handle games after they are parsed
            await HandleParsedGames();

            //Handle heat map generation
            await HandleHeatmapGeneration();

            //Send the files to the uploader
            _uploadSuccessCount = await DemoParser.UploadFaceitDemosAndRadars(_uploadDictionary);

            //Delete the old .dem files, we don't need them anymore
            DeleteOldFiles();

            //Update the files on the website
            await UpdateWebsiteFiles();

            var report = await GetReport();

            if (report.Length > 1900)
            {
                report = report.Substring(0, 1900) + "\n`[OUTPUT TRUNCATED]`";
            }

            await _log.LogMessage(report);

            _running = false;
            return(report);
        }