mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 06:42:54 +08:00
Simplify import ordering logic by making beatmapImportTask non-nullable.
This commit is contained in:
parent
5ca4fd5ab4
commit
6110a847aa
@ -51,7 +51,7 @@ namespace osu.Game.Database
|
|||||||
var stableStorage = await getStableStorage().ConfigureAwait(false);
|
var stableStorage = await getStableStorage().ConfigureAwait(false);
|
||||||
var importTasks = new List<Task>();
|
var importTasks = new List<Task>();
|
||||||
|
|
||||||
Task beatmapImportTask = default;
|
Task beatmapImportTask = Task.CompletedTask;
|
||||||
if (content.HasFlagFast(StableContent.Beatmaps))
|
if (content.HasFlagFast(StableContent.Beatmaps))
|
||||||
importTasks.Add(beatmapImportTask = beatmaps.ImportFromStableAsync(stableStorage));
|
importTasks.Add(beatmapImportTask = beatmaps.ImportFromStableAsync(stableStorage));
|
||||||
|
|
||||||
@ -59,16 +59,10 @@ namespace osu.Game.Database
|
|||||||
importTasks.Add(skins.ImportFromStableAsync(stableStorage));
|
importTasks.Add(skins.ImportFromStableAsync(stableStorage));
|
||||||
|
|
||||||
if (content.HasFlagFast(StableContent.Collections))
|
if (content.HasFlagFast(StableContent.Collections))
|
||||||
{
|
importTasks.Add(beatmapImportTask.ContinueWith(_ => collections.ImportFromStableAsync(stableStorage), TaskContinuationOptions.OnlyOnRanToCompletion));
|
||||||
importTasks.Add(beatmapImportTask?.ContinueWith(_ => collections.ImportFromStableAsync(stableStorage), TaskContinuationOptions.OnlyOnRanToCompletion)
|
|
||||||
?? collections.ImportFromStableAsync(stableStorage));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (content.HasFlagFast(StableContent.Scores))
|
if (content.HasFlagFast(StableContent.Scores))
|
||||||
{
|
importTasks.Add(beatmapImportTask.ContinueWith(_ => scores.ImportFromStableAsync(stableStorage), TaskContinuationOptions.OnlyOnRanToCompletion));
|
||||||
importTasks.Add(beatmapImportTask?.ContinueWith(_ => scores.ImportFromStableAsync(stableStorage), TaskContinuationOptions.OnlyOnRanToCompletion)
|
|
||||||
?? scores.ImportFromStableAsync(stableStorage));
|
|
||||||
}
|
|
||||||
|
|
||||||
await Task.WhenAll(importTasks.ToArray()).ConfigureAwait(false);
|
await Task.WhenAll(importTasks.ToArray()).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user