private Beatmap CheckInCache(PlayMode gamemode = PlayMode.Osu, int mapId = -1, string mapHash = null) { if (mapId >= 0) { if (_mapCacher != null) { var map = _mapCacher.GetByMapId(mapId); if (map != null) { return(map); } } var beatmapFromCache = _beatmapCache.FirstOrDefault(s => s.Key.BeatmapId == mapId & s.Key.PlayMode == gamemode).Value; if (beatmapFromCache != null) { return(beatmapFromCache); } } else if (mapHash != null) { if (_mapCacher != null) { var map = _mapCacher.GetByHash(mapHash); if (map != null) { return(map); } } var beatmapFromCache = _beatmapCache.FirstOrDefault(s => s.Value.Md5 == mapHash & s.Key.PlayMode == gamemode).Value; if (beatmapFromCache != null) { return(beatmapFromCache); } } return(null); }
public static Beatmap GetMap(this IReplay replay, IMapDataManager mapCacher) { return(mapCacher.GetByHash(replay.MapHash)); }