mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 18:23:04 +08:00
Clean up BeatmapManager
query methods
This commit is contained in:
parent
9beabad6a4
commit
46e92c3b60
@ -151,22 +151,6 @@ namespace osu.Game.Beatmaps
|
|||||||
return context.All<BeatmapSetInfo>().Where(b => !b.DeletePending).Detach();
|
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>
|
/// <summary>
|
||||||
/// Perform a lookup query on available <see cref="BeatmapSetInfo"/>s.
|
/// Perform a lookup query on available <see cref="BeatmapSetInfo"/>s.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -197,7 +181,6 @@ namespace osu.Game.Beatmaps
|
|||||||
/// <param name="query">The query.</param>
|
/// <param name="query">The query.</param>
|
||||||
/// <returns>The first result for the provided query, or null if no results were found.</returns>
|
/// <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();
|
public BeatmapInfo? QueryBeatmap(Expression<Func<BeatmapInfo, bool>> query) => beatmapModelManager.QueryBeatmap(query)?.Detach();
|
||||||
// TODO: move detach to usages?
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Saves an <see cref="IBeatmap"/> file against a given <see cref="BeatmapInfo"/>.
|
/// Saves an <see cref="IBeatmap"/> file against a given <see cref="BeatmapInfo"/>.
|
||||||
|
@ -131,7 +131,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
bool loadThemedIntro()
|
bool loadThemedIntro()
|
||||||
{
|
{
|
||||||
setInfo = beatmaps.QueryBeatmapSets(b => b.Hash == BeatmapHash).FirstOrDefault();
|
setInfo = beatmaps.QueryBeatmapSet(b => b.Hash == BeatmapHash);
|
||||||
|
|
||||||
if (setInfo == null)
|
if (setInfo == null)
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user