From 48ced4a79e5de5fa246af97e1642667a807ad3ae Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Tue, 4 Oct 2016 13:35:40 -0400 Subject: [PATCH] Move control of databases into osu-framework --- osu.Desktop.VisualTests/Program.cs | 4 ++-- osu.Game/Database/BeatmapDatabase.cs | 5 +++-- osu.Game/OsuGameBase.cs | 4 +++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/osu.Desktop.VisualTests/Program.cs b/osu.Desktop.VisualTests/Program.cs index 966b6d00b1..1c27431ea6 100644 --- a/osu.Desktop.VisualTests/Program.cs +++ b/osu.Desktop.VisualTests/Program.cs @@ -12,8 +12,8 @@ namespace osu.Framework.VisualTests [STAThread] public static void Main(string[] args) { - BasicGameHost host = Host.GetSuitableHost(@"visual-tests"); - host.Add(new VisualTestGame()); + BasicGameHost host = Host.GetSuitableHost("osu-tests"); + host.Load(new VisualTestGame()); host.Run(); } } diff --git a/osu.Game/Database/BeatmapDatabase.cs b/osu.Game/Database/BeatmapDatabase.cs index 2c318c5997..86c352c81c 100644 --- a/osu.Game/Database/BeatmapDatabase.cs +++ b/osu.Game/Database/BeatmapDatabase.cs @@ -1,4 +1,5 @@ using System; +using osu.Framework.OS; using SQLite; namespace osu.Game.Database @@ -7,11 +8,11 @@ namespace osu.Game.Database { private static SQLiteConnection Connection { get; set; } - public BeatmapDatabase() + public BeatmapDatabase(BasicStorage storage) { if (Connection == null) { - Connection = new SQLiteConnection("beatmap.db"); + Connection = storage.GetDb("beatmaps"); Connection.CreateTable(); Connection.CreateTable(); Connection.CreateTable(); diff --git a/osu.Game/OsuGameBase.cs b/osu.Game/OsuGameBase.cs index 451bcfd3ac..7d8773b722 100644 --- a/osu.Game/OsuGameBase.cs +++ b/osu.Game/OsuGameBase.cs @@ -16,7 +16,7 @@ namespace osu.Game public class OsuGameBase : Framework.Game { internal OsuConfigManager Config = new OsuConfigManager(); - internal BeatmapDatabase Beatmaps = new BeatmapDatabase(); + internal BeatmapDatabase Beatmaps { get; private set; } protected override string MainResourceFile => @"osu.Game.Resources.dll"; @@ -33,6 +33,8 @@ namespace osu.Game { base.Load(); + Beatmaps = new BeatmapDatabase(Host.Storage); + //this completely overrides the framework default. will need to change once we make a proper FontStore. Fonts = new TextureStore() { ScaleAdjust = 0.01f }; Fonts.AddStore(new GlyphStore(Resources, @"Fonts/Exo2.0-Regular"));