Added a new "undelete" button that restores every beatmap with "DeletePending" set to true.

This commit is contained in:
FreezyLemon
2017-11-30 10:58:32 +01:00
parent dddd432dc8
commit bf386598b6
2 changed files with 36 additions and 0 deletions

View File

@ -338,6 +338,28 @@ namespace osu.Game.Beatmaps
}
}
public void Undelete(BeatmapSetInfo beatmapSet)
{
lock (importContext)
{
var context = importContext.Value;
using (var transaction = context.BeginTransaction())
{
context.ChangeTracker.AutoDetectChangesEnabled = false;
var iFiles = new FileStore(() => context, storage);
var iBeatmaps = createBeatmapStore(() => context);
if (iBeatmaps.Undelete(beatmapSet))
iFiles.Reference(beatmapSet.Files.Select(f => f.FileInfo).ToArray());
context.ChangeTracker.AutoDetectChangesEnabled = true;
context.SaveChanges(transaction);
}
}
}
/// <summary>
/// Delete a beatmap difficulty.
/// </summary>