diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index bf71033f36..a25f454218 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -104,6 +104,8 @@ namespace osu.Game.Beatmaps if (importHost != null) ipc = new BeatmapIPCChannel(importHost, this); + + beatmaps.Cleanup(); } /// diff --git a/osu.Game/Beatmaps/BeatmapStore.cs b/osu.Game/Beatmaps/BeatmapStore.cs index 69aadb470e..4892d4f3db 100644 --- a/osu.Game/Beatmaps/BeatmapStore.cs +++ b/osu.Game/Beatmaps/BeatmapStore.cs @@ -40,12 +40,6 @@ namespace osu.Game.Beatmaps } } - protected override void StartupTasks() - { - base.StartupTasks(); - cleanupPendingDeletions(); - } - /// /// Add a to the database. /// @@ -136,7 +130,7 @@ namespace osu.Game.Beatmaps return true; } - private void cleanupPendingDeletions() + public override void Cleanup() { var context = GetContext(); diff --git a/osu.Game/Database/DatabaseBackedStore.cs b/osu.Game/Database/DatabaseBackedStore.cs index 90a43a47c5..be86d35335 100644 --- a/osu.Game/Database/DatabaseBackedStore.cs +++ b/osu.Game/Database/DatabaseBackedStore.cs @@ -27,14 +27,12 @@ namespace osu.Game.Database Logger.Error(e, $@"Failed to initialise the {GetType()}! Trying again with a clean database..."); Prepare(true); } - - StartupTasks(); } /// - /// Perform any common startup tasks. Runs after . + /// Perform any common clean-up tasks. Should be run when idle, or whenever necessary. /// - protected virtual void StartupTasks() + public virtual void Cleanup() { } diff --git a/osu.Game/IO/FileStore.cs b/osu.Game/IO/FileStore.cs index db4f5fd2a2..5f1b21ddb6 100644 --- a/osu.Game/IO/FileStore.cs +++ b/osu.Game/IO/FileStore.cs @@ -38,12 +38,6 @@ namespace osu.Game.IO } } - protected override void StartupTasks() - { - base.StartupTasks(); - deletePending(); - } - public FileInfo Add(Stream data, bool reference = true) { var context = GetContext(); @@ -101,7 +95,7 @@ namespace osu.Game.IO context.SaveChanges(); } - private void deletePending() + public override void Cleanup() { var context = GetContext(); diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 5ecc7279da..22eb75fcea 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -160,6 +160,8 @@ namespace osu.Game }; API.Register(this); + + FileStore.Cleanup(); } private WorkingBeatmap lastBeatmap;