diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index e7929ff882..5f182c1dca 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -287,8 +287,7 @@ namespace osu.Game.Beatmaps /// The beatmap set to delete. public void Delete(BeatmapSetInfo beatmapSet) { - lock (beatmaps) - if (!beatmaps.Delete(beatmapSet)) return; + if (!beatmaps.Delete(beatmapSet)) return; if (!beatmapSet.Protected) files.Dereference(beatmapSet.Files.Select(f => f.FileInfo).ToArray()); @@ -298,21 +297,13 @@ namespace osu.Game.Beatmaps /// Delete a beatmap difficulty. /// /// The beatmap difficulty to hide. - public void Hide(BeatmapInfo beatmap) - { - lock (beatmaps) - beatmaps.Hide(beatmap); - } + public void Hide(BeatmapInfo beatmap) => beatmaps.Hide(beatmap); /// /// Restore a beatmap difficulty. /// /// The beatmap difficulty to restore. - public void Restore(BeatmapInfo beatmap) - { - lock (beatmaps) - beatmaps.Restore(beatmap); - } + public void Restore(BeatmapInfo beatmap) => beatmaps.Restore(beatmap); /// /// Returns a to a usable state if it has previously been deleted but not yet purged. @@ -321,8 +312,7 @@ namespace osu.Game.Beatmaps /// The beatmap to restore. private void undelete(BeatmapStore beatmaps, FileStore files, BeatmapSetInfo beatmapSet) { - lock (beatmaps) - if (!beatmaps.Undelete(beatmapSet)) return; + if (!beatmaps.Undelete(beatmapSet)) return; if (!beatmapSet.Protected) files.Reference(beatmapSet.Files.Select(f => f.FileInfo).ToArray()); @@ -357,11 +347,7 @@ namespace osu.Game.Beatmaps /// /// The query. /// The first result for the provided query, or null if no results were found. - public BeatmapSetInfo QueryBeatmapSet(Func query) - { - lock (beatmaps) - return beatmaps.BeatmapSets.FirstOrDefault(query); - } + public BeatmapSetInfo QueryBeatmapSet(Func query) => beatmaps.BeatmapSets.FirstOrDefault(query); /// /// Refresh an existing instance of a from the store. @@ -375,33 +361,21 @@ namespace osu.Game.Beatmaps /// /// The query. /// Results from the provided query. - public List QueryBeatmapSets(Func query) - { - lock (beatmaps) - return beatmaps.BeatmapSets.Where(query).ToList(); - } + public List QueryBeatmapSets(Func query) => beatmaps.BeatmapSets.Where(query).ToList(); /// /// Perform a lookup query on available s. /// /// The query. /// The first result for the provided query, or null if no results were found. - public BeatmapInfo QueryBeatmap(Func query) - { - lock (beatmaps) - return beatmaps.Beatmaps.FirstOrDefault(query); - } + public BeatmapInfo QueryBeatmap(Func query) => beatmaps.Beatmaps.FirstOrDefault(query); /// /// Perform a lookup query on available s. /// /// The query. /// Results from the provided query. - public List QueryBeatmaps(Func query) - { - lock (beatmaps) - return beatmaps.Beatmaps.Where(query).ToList(); - } + public List QueryBeatmaps(Func query) => beatmaps.Beatmaps.Where(query).ToList(); /// /// Creates an from a valid storage path. @@ -437,9 +411,7 @@ namespace osu.Game.Beatmaps var hash = hashable.ComputeSHA2Hash(); // check if this beatmap has already been imported and exit early if so. - BeatmapSetInfo beatmapSet; - lock (beatmaps) - beatmapSet = beatmaps.BeatmapSets.FirstOrDefault(b => b.Hash == hash); + var beatmapSet = beatmaps.BeatmapSets.FirstOrDefault(b => b.Hash == hash); if (beatmapSet != null) { @@ -523,8 +495,7 @@ namespace osu.Game.Beatmaps /// A list of available . public List GetAllUsableBeatmapSets() { - lock (beatmaps) - return beatmaps.BeatmapSets.Where(s => !s.DeletePending).ToList(); + return beatmaps.BeatmapSets.Where(s => !s.DeletePending).ToList(); } protected class BeatmapManagerWorkingBeatmap : WorkingBeatmap