mirror of
https://github.com/ppy/osu.git
synced 2025-02-19 08:23:20 +08:00
Secondary documentation pass on BeatmapStore
This commit is contained in:
parent
99e53b5109
commit
07d4d2dbe4
@ -27,22 +27,30 @@ namespace osu.Game.Beatmaps
|
|||||||
// todo: make this private
|
// todo: make this private
|
||||||
public readonly BeatmapDatabase Database;
|
public readonly BeatmapDatabase Database;
|
||||||
|
|
||||||
private readonly Storage storage;
|
/// <summary>
|
||||||
private readonly FileDatabase files;
|
/// Fired when a new <see cref="BeatmapSetInfo"/> becomes available in the database.
|
||||||
|
/// </summary>
|
||||||
private readonly RulesetDatabase rulesets;
|
|
||||||
|
|
||||||
public event Action<BeatmapSetInfo> BeatmapSetAdded;
|
public event Action<BeatmapSetInfo> BeatmapSetAdded;
|
||||||
public event Action<BeatmapSetInfo> BeatmapSetRemoved;
|
|
||||||
|
|
||||||
// ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised)
|
/// <summary>
|
||||||
private BeatmapIPCChannel ipc;
|
/// Fired when a <see cref="BeatmapSetInfo"/> is removed from the database.
|
||||||
|
/// </summary>
|
||||||
|
public event Action<BeatmapSetInfo> BeatmapSetRemoved;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// A default representation of a WorkingBeatmap to use when no beatmap is available.
|
/// A default representation of a WorkingBeatmap to use when no beatmap is available.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public WorkingBeatmap DefaultBeatmap { private get; set; }
|
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)
|
public BeatmapStore(Storage storage, FileDatabase files, SQLiteConnection connection, RulesetDatabase rulesets, IIpcHost importHost = null)
|
||||||
{
|
{
|
||||||
Database = new BeatmapDatabase(connection);
|
Database = new BeatmapDatabase(connection);
|
||||||
@ -167,6 +175,21 @@ namespace osu.Game.Beatmaps
|
|||||||
Database.Reset();
|
Database.Reset();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Perform a lookup query on available <see cref="BeatmapSetInfo"/>s.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="query">The query.</param>
|
||||||
|
/// <returns>The first result for the provided query, or null if no results were found.</returns>
|
||||||
|
public BeatmapSetInfo QueryBeatmapSet(Func<BeatmapSetInfo, bool> query)
|
||||||
|
{
|
||||||
|
BeatmapSetInfo set = Database.Query<BeatmapSetInfo>().FirstOrDefault(query);
|
||||||
|
|
||||||
|
if (set != null)
|
||||||
|
Database.GetChildren(set, true);
|
||||||
|
|
||||||
|
return set;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates an <see cref="ArchiveReader"/> from a valid storage path.
|
/// Creates an <see cref="ArchiveReader"/> from a valid storage path.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -257,15 +280,5 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
return beatmapSet;
|
return beatmapSet;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BeatmapSetInfo QueryBeatmapSet(Func<BeatmapSetInfo, bool> func)
|
|
||||||
{
|
|
||||||
BeatmapSetInfo set = Database.Query<BeatmapSetInfo>().FirstOrDefault(func);
|
|
||||||
|
|
||||||
if (set != null)
|
|
||||||
Database.GetChildren(set, true);
|
|
||||||
|
|
||||||
return set;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user