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

@ -49,6 +49,29 @@ namespace osu.Game.Database
public bool SupportsImportFromStable => RuntimeInfo.IsDesktop;
public async Task<int> GetImportCount(StableContent content)
{
var stableStorage = await getStableStorage().ConfigureAwait(false);
switch (content)
{
case StableContent.Beatmaps:
return await new LegacyBeatmapImporter(beatmaps).GetAvailableCount(stableStorage);
case StableContent.Skins:
return await new LegacySkinImporter(skins).GetAvailableCount(stableStorage);
case StableContent.Collections:
return await collections.GetAvailableCount(stableStorage);
case StableContent.Scores:
return await new LegacyScoreImporter(scores).GetAvailableCount(stableStorage);
default:
throw new ArgumentException($"Only one {nameof(StableContent)} flag should be specified.");
}
}
public async Task ImportFromStableAsync(StableContent content)
{
var stableStorage = await getStableStorage().ConfigureAwait(false);