1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 15:47:26 +08:00

Clean up BeatmapManager query methods

This commit is contained in:
Dean Herbert 2022-01-11 21:44:18 +09:00
parent 9beabad6a4
commit 46e92c3b60
2 changed files with 1 additions and 18 deletions

View File

@ -151,22 +151,6 @@ namespace osu.Game.Beatmaps
return context.All<BeatmapSetInfo>().Where(b => !b.DeletePending).Detach();
}
/// <summary>
/// Perform a lookup query on available <see cref="BeatmapSetInfo"/>s.
/// </summary>
/// <param name="query">The query.</param>
/// <returns>Results from the provided query.</returns>
public List<ILive<BeatmapSetInfo>> QueryBeatmapSets(Expression<Func<BeatmapSetInfo, bool>> query)
{
using (var context = contextFactory.CreateContext())
{
return context.All<BeatmapSetInfo>()
.Where(b => !b.DeletePending)
.Where(query)
.ToLive(contextFactory);
}
}
/// <summary>
/// Perform a lookup query on available <see cref="BeatmapSetInfo"/>s.
/// </summary>
@ -197,7 +181,6 @@ namespace osu.Game.Beatmaps
/// <param name="query">The query.</param>
/// <returns>The first result for the provided query, or null if no results were found.</returns>
public BeatmapInfo? QueryBeatmap(Expression<Func<BeatmapInfo, bool>> query) => beatmapModelManager.QueryBeatmap(query)?.Detach();
// TODO: move detach to usages?
/// <summary>
/// Saves an <see cref="IBeatmap"/> file against a given <see cref="BeatmapInfo"/>.

View File

@ -131,7 +131,7 @@ namespace osu.Game.Screens.Menu
bool loadThemedIntro()
{
setInfo = beatmaps.QueryBeatmapSets(b => b.Hash == BeatmapHash).FirstOrDefault();
setInfo = beatmaps.QueryBeatmapSet(b => b.Hash == BeatmapHash);
if (setInfo == null)
return false;