From 799f51021700d394d5e19a5f329816ca018bd9a9 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 17 Oct 2017 10:25:18 +0900 Subject: [PATCH] FileStore logic fixes --- osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs | 2 -- osu.Game/IO/FileStore.cs | 16 +++++++++------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs index cd9e765e7f..087fb54b5f 100644 --- a/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs +++ b/osu.Game.Tests/Beatmaps/IO/ImportBeatmapTest.cs @@ -95,8 +95,6 @@ namespace osu.Game.Tests.Beatmaps.IO private OsuGameBase loadOsu(GameHost host) { - host.Storage.DeleteDatabase(@"client"); - var osu = new OsuGameBase(); Task.Run(() => host.Run(osu)); diff --git a/osu.Game/IO/FileStore.cs b/osu.Game/IO/FileStore.cs index 55b00b51d9..ae0cfb30c8 100644 --- a/osu.Game/IO/FileStore.cs +++ b/osu.Game/IO/FileStore.cs @@ -31,10 +31,6 @@ namespace osu.Game.IO { if (reset) { - // in earlier versions we stored beatmaps as solid archives, but not any more. - if (Storage.ExistsDirectory("beatmaps")) - Storage.DeleteDirectory("beatmaps"); - if (Storage.ExistsDirectory(prefix)) Storage.DeleteDirectory(prefix); @@ -70,12 +66,14 @@ namespace osu.Game.IO } if (existing == null) + { Connection.FileInfo.Add(info); + Connection.SaveChanges(); + } if (reference || existing == null) Reference(info); - Connection.SaveChanges(); return info; } @@ -85,6 +83,7 @@ namespace osu.Game.IO { var refetch = Connection.Find(f.First().ID); refetch.ReferenceCount += f.Count(); + Connection.Update(refetch); } Connection.SaveChanges(); @@ -94,8 +93,9 @@ namespace osu.Game.IO { foreach (var f in files.GroupBy(f => f.ID)) { - var accurateRefCount = Connection.Find(f.First().ID); - accurateRefCount.ReferenceCount -= f.Count(); + var refetch = Connection.Find(f.First().ID); + refetch.ReferenceCount -= f.Count(); + Connection.Update(refetch); } Connection.SaveChanges(); @@ -115,6 +115,8 @@ namespace osu.Game.IO Logger.Error(e, $@"Could not delete beatmap {f}"); } } + + Connection.SaveChanges(); } } }