mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Reset the beatmap database when it can't be read, rather than hard failing.
This commit is contained in:
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Linq.Expressions;
|
using System.Linq.Expressions;
|
||||||
@ -34,6 +35,9 @@ namespace osu.Game.Database
|
|||||||
ipc = new BeatmapImporter(importHost, this);
|
ipc = new BeatmapImporter(importHost, this);
|
||||||
|
|
||||||
if (connection == null)
|
if (connection == null)
|
||||||
|
{
|
||||||
|
retry:
|
||||||
|
try
|
||||||
{
|
{
|
||||||
connection = storage.GetDatabase(@"beatmaps");
|
connection = storage.GetDatabase(@"beatmaps");
|
||||||
connection.CreateTable<BeatmapMetadata>();
|
connection.CreateTable<BeatmapMetadata>();
|
||||||
@ -41,6 +45,14 @@ namespace osu.Game.Database
|
|||||||
connection.CreateTable<BeatmapSetInfo>();
|
connection.CreateTable<BeatmapSetInfo>();
|
||||||
connection.CreateTable<BeatmapInfo>();
|
connection.CreateTable<BeatmapInfo>();
|
||||||
}
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
Debug.WriteLine(@"Beatmap database was unable to be migrated; starting fresh!");
|
||||||
|
connection?.Close();
|
||||||
|
storage.DeleteDatabase(@"beatmaps");
|
||||||
|
goto retry;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Reset()
|
public void Reset()
|
||||||
|
Reference in New Issue
Block a user