Add beatmap deletion support.

Note that this is a very naive approach and will result in file access exceptions. This will be fixed in a further commit.
This commit is contained in:
Dean Herbert
2017-02-24 14:37:54 +09:00
parent 3a89348413
commit 6c3bda18b6
4 changed files with 61 additions and 7 deletions

View File

@ -2,6 +2,7 @@
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@ -22,6 +23,7 @@ namespace osu.Game.Database
private SQLiteConnection connection { get; set; }
private Storage storage;
public event Action<BeatmapSetInfo> BeatmapSetAdded;
public event Action<BeatmapSetInfo> BeatmapSetRemoved;
private BeatmapImporter ipc;
@ -157,6 +159,13 @@ namespace osu.Game.Database
connection.Commit();
}
public void Delete(BeatmapSetInfo beatmapSet)
{
storage.Delete(beatmapSet.Path);
connection.Delete(beatmapSet);
BeatmapSetRemoved?.Invoke(beatmapSet);
}
public ArchiveReader GetReader(BeatmapSetInfo beatmapSet)
{
if (string.IsNullOrEmpty(beatmapSet.Path))