From c7de79caf6a00f9dd5db3de33af93506cc3988cc Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Fri, 9 Feb 2018 19:24:17 +0900 Subject: [PATCH] Remove storage class variable --- osu.Game/Beatmaps/BeatmapManager.cs | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 63d9874d53..08cf5aeff8 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -65,7 +65,7 @@ namespace osu.Game.Beatmaps /// public WorkingBeatmap DefaultBeatmap { private get; set; } - private readonly Storage storage; + private FileStore getFileStoreWithContext(OsuDbContext context) => new FileStore(() => context, files.Storage); private BeatmapStore getBeatmapStoreWithContext(OsuDbContext context) => getBeatmapStoreWithContext(() => context); @@ -128,7 +128,6 @@ namespace osu.Game.Beatmaps beatmaps = getBeatmapStoreWithContext(context); files = new FileStore(context, storage); - this.storage = files.Storage; this.rulesets = rulesets; this.api = api; @@ -233,7 +232,7 @@ namespace osu.Game.Beatmaps Delete(existingOnlineId); } - beatmapSet.Files = createFileInfos(archive, new FileStore(() => context, storage)); + beatmapSet.Files = createFileInfos(archive, getFileStoreWithContext(context)); beatmapSet.Beatmaps = createBeatmapDifficulties(archive); // remove metadata from difficulties where it matches the set @@ -373,7 +372,7 @@ namespace osu.Game.Beatmaps if (getBeatmapStoreWithContext(context).Delete(beatmapSet)) { if (!beatmapSet.Protected) - new FileStore(() => context, storage).Dereference(beatmapSet.Files.Select(f => f.FileInfo).ToArray()); + getFileStoreWithContext(context).Dereference(beatmapSet.Files.Select(f => f.FileInfo).ToArray()); } context.ChangeTracker.AutoDetectChangesEnabled = true; @@ -426,7 +425,7 @@ namespace osu.Game.Beatmaps { context.ChangeTracker.AutoDetectChangesEnabled = false; - undelete(getBeatmapStoreWithContext(context), new FileStore(() => context, storage), beatmapSet); + undelete(getBeatmapStoreWithContext(context), getFileStoreWithContext(context), beatmapSet); context.ChangeTracker.AutoDetectChangesEnabled = true; context.SaveChanges(transaction); @@ -528,7 +527,7 @@ namespace osu.Game.Beatmaps { if (ZipFile.IsZipFile(path)) // ReSharper disable once InconsistentlySynchronizedField - return new OszArchiveReader(storage.GetStream(path)); + return new OszArchiveReader(files.Storage.GetStream(path)); return new LegacyFilesystemReader(path); }