From 07d4d2dbe4f54d869dfd7b1bf55ce9ec1b041747 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 26 Jul 2017 23:13:02 +0900 Subject: [PATCH] Secondary documentation pass on BeatmapStore --- osu.Game/Beatmaps/BeatmapStore.cs | 49 +++++++++++++++++++------------ 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapStore.cs b/osu.Game/Beatmaps/BeatmapStore.cs index 9e0df553c3..4ee8f8a322 100644 --- a/osu.Game/Beatmaps/BeatmapStore.cs +++ b/osu.Game/Beatmaps/BeatmapStore.cs @@ -27,22 +27,30 @@ namespace osu.Game.Beatmaps // todo: make this private public readonly BeatmapDatabase Database; - private readonly Storage storage; - private readonly FileDatabase files; - - private readonly RulesetDatabase rulesets; - + /// + /// Fired when a new becomes available in the database. + /// public event Action BeatmapSetAdded; - public event Action BeatmapSetRemoved; - // ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised) - private BeatmapIPCChannel ipc; + /// + /// Fired when a is removed from the database. + /// + public event Action BeatmapSetRemoved; /// /// A default representation of a WorkingBeatmap to use when no beatmap is available. /// public WorkingBeatmap DefaultBeatmap { private get; set; } + private readonly Storage storage; + + private readonly FileDatabase files; + + private readonly RulesetDatabase rulesets; + + // ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised) + private BeatmapIPCChannel ipc; + public BeatmapStore(Storage storage, FileDatabase files, SQLiteConnection connection, RulesetDatabase rulesets, IIpcHost importHost = null) { Database = new BeatmapDatabase(connection); @@ -167,6 +175,21 @@ namespace osu.Game.Beatmaps Database.Reset(); } + /// + /// Perform a lookup query on available s. + /// + /// The query. + /// The first result for the provided query, or null if no results were found. + public BeatmapSetInfo QueryBeatmapSet(Func query) + { + BeatmapSetInfo set = Database.Query().FirstOrDefault(query); + + if (set != null) + Database.GetChildren(set, true); + + return set; + } + /// /// Creates an from a valid storage path. /// @@ -257,15 +280,5 @@ namespace osu.Game.Beatmaps return beatmapSet; } - - public BeatmapSetInfo QueryBeatmapSet(Func func) - { - BeatmapSetInfo set = Database.Query().FirstOrDefault(func); - - if (set != null) - Database.GetChildren(set, true); - - return set; - } } }