public static ScPlayerScore Convert(this PlayerScore playerScore, IModParser modParser)
        {
            if (!_playerScores.TryGetValue(playerScore, out var scPlayerScore))
            {
                _playerScores[playerScore] = scPlayerScore = new ScPlayerScore(playerScore);
            }

            scPlayerScore.Accuracy = OsuScore.CalculateAccuracy((PlayMode)scPlayerScore.Mode, scPlayerScore.Hit50, scPlayerScore.Hit100, scPlayerScore.Hit300, scPlayerScore.HitMiss, scPlayerScore.HitGeki, scPlayerScore.HitKatu) * 100;
            scPlayerScore.Grade    = OsuScore.CalculateGrade((PlayMode)scPlayerScore.Mode, (Mods)scPlayerScore.Mods, scPlayerScore.Accuracy, scPlayerScore.Hit50, scPlayerScore.Hit100, scPlayerScore.Hit300, scPlayerScore.HitMiss);
            scPlayerScore.ModsStr  = modParser.GetModsFromEnum(scPlayerScore.Mods, true);

            return(scPlayerScore);
        }
        public async Task <IMapSearchResult> FindBeatmap(IMapSearchArgs args, CancellationToken cancellationToken)
        {
            if (args == null || string.IsNullOrEmpty(args.OsuFilePath))
            {
                return(null);
            }

            if (!File.Exists(args.OsuFilePath))
            {
                _logger.Log($"Osu file supplied in search args was not found on disk! ({args.OsuFilePath})", LogLevel.Error);
                return(null);
            }

            (Beatmap beatmap, CancelableAsyncLazy <IPpCalculator> ppTask)result;
            try
            {
                result = await LazerMapLoader.LoadLazerBeatmapWithPerformanceCalculator(args.OsuFilePath, args.PlayMode,
                                                                                        _modParser.GetModsFromEnum((int)args.Mods), _logger, cancellationToken);
            }
            catch (OperationCanceledException)
            {
                throw;
            }
            catch (Exception ex)
            {
                ex.Data["PreventedCrash"] = 1;
                ex.Data["location"]       = args.OsuFilePath;
                _logger.Log(ex, LogLevel.Critical);
                return(null);
            }

            if (result.beatmap == null)
            {
                var ex = new BeatmapLoadFailedException();
                ex.Data["location"] = args.OsuFilePath;
                _logger.Log(ex, LogLevel.Critical);
                _logger.Log($"Failed to load beatmap located at {args.OsuFilePath}", LogLevel.Warning);
                return(null);
            }

            return(new MapSearchResult(args)
            {
                BeatmapsFound = { result.beatmap },
                SharedObjects = { result.ppTask }
            });
        }