Add basic score import from stable

This commit is contained in:
HoLLy
2019-06-19 18:33:51 +02:00
parent 82515a52fe
commit 15c75b4442
6 changed files with 54 additions and 7 deletions

View File

@ -1,4 +1,4 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
using System;
@ -546,6 +546,11 @@ namespace osu.Game.Database
/// </summary>
protected virtual string ImportFromStablePath => null;
/// <summary>
/// Does stable import look for directories rather than files
/// </summary>
protected abstract bool StableDirectoryBased { get; }
/// <summary>
/// This is a temporary method and will likely be replaced by a full-fledged (and more correctly placed) migration process in the future.
/// </summary>
@ -566,7 +571,11 @@ namespace osu.Game.Database
return Task.CompletedTask;
}
return Task.Run(async () => await Import(stable.GetDirectories(ImportFromStablePath).Select(f => stable.GetFullPath(f)).ToArray()));
return Task.Run(async () =>
{
var paths = StableDirectoryBased ? stable.GetDirectories(ImportFromStablePath) : stable.GetFiles(ImportFromStablePath);
await Import(paths.Select(f => stable.GetFullPath(f)).ToArray());
});
}
#endregion