Allow retrieving count of available stable imports

This commit is contained in:
Dean Herbert
2022-05-16 19:57:00 +09:00
parent 4412fec41a
commit 6448c97929
3 changed files with 37 additions and 0 deletions

View File

@ -111,6 +111,18 @@ namespace osu.Game.Collections
public Action<Notification> PostNotification { protected get; set; }
public Task<int> GetAvailableCount(StableStorage stableStorage)
{
if (!stableStorage.Exists(database_name))
return Task.FromResult(0);
return Task.Run(() =>
{
using (var stream = stableStorage.GetStream(database_name))
return readCollections(stream).Count;
});
}
/// <summary>
/// This is a temporary method and will likely be replaced by a full-fledged (and more correctly placed) migration process in the future.
/// </summary>