diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 955c6f4b17..e4c53cec94 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -60,8 +60,6 @@ namespace osu.Game.Beatmaps private readonly FileStore files; - private readonly OsuDbContext connection; - private readonly RulesetStore rulesets; private readonly BeatmapStore beatmaps; @@ -93,7 +91,6 @@ namespace osu.Game.Beatmaps this.storage = storage; this.files = files; - this.connection = connection; this.rulesets = rulesets; this.api = api; @@ -164,7 +161,7 @@ namespace osu.Game.Beatmaps /// The beatmap to be imported. public BeatmapSetInfo Import(ArchiveReader archiveReader) { - BeatmapSetInfo set = null; + BeatmapSetInfo set; // let's only allow one concurrent import at a time for now. lock (importLock) diff --git a/osu.Game/IO/FileStore.cs b/osu.Game/IO/FileStore.cs index 680ecedf52..c15ebd264e 100644 --- a/osu.Game/IO/FileStore.cs +++ b/osu.Game/IO/FileStore.cs @@ -85,23 +85,22 @@ namespace osu.Game.IO public void Reference(params FileInfo[] files) { - var incrementedFiles = files.GroupBy(f => f.ID).Select(f => + foreach (var f in files.GroupBy(f => f.ID)) { - var accurateRefCount = Connection.Find(f.First().ID); - accurateRefCount.ReferenceCount += f.Count(); - return accurateRefCount; - }); + var refetch = Connection.Find(f.First().ID); + refetch.ReferenceCount += f.Count(); + } + Connection.SaveChanges(); } public void Dereference(params FileInfo[] files) { - var incrementedFiles = files.GroupBy(f => f.ID).Select(f => + foreach (var f in files.GroupBy(f => f.ID)) { var accurateRefCount = Connection.Find(f.First().ID); accurateRefCount.ReferenceCount -= f.Count(); - return accurateRefCount; - }); + } Connection.SaveChanges(); }