2021-09-30 17:52:09 +08:00
|
|
|
// 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.
|
|
|
|
|
2022-06-20 17:53:48 +08:00
|
|
|
using System;
|
2021-09-30 17:52:09 +08:00
|
|
|
using System.Collections.Generic;
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
using osu.Game.Overlays.Notifications;
|
|
|
|
|
|
|
|
namespace osu.Game.Database
|
|
|
|
{
|
|
|
|
/// <summary>
|
2021-10-08 13:20:21 +08:00
|
|
|
/// A class which handles importing of associated models to the game store.
|
2021-09-30 17:52:09 +08:00
|
|
|
/// </summary>
|
|
|
|
/// <typeparam name="TModel">The model type.</typeparam>
|
2022-06-20 17:53:48 +08:00
|
|
|
public interface IModelImporter<TModel> : IPostNotifications, ICanAcceptFiles
|
2022-01-26 12:37:33 +08:00
|
|
|
where TModel : class, IHasGuidPrimaryKey
|
2021-09-30 17:52:09 +08:00
|
|
|
{
|
|
|
|
/// <summary>
|
2022-06-14 18:38:51 +08:00
|
|
|
/// Process multiple import tasks, updating a tracking notification with progress.
|
2021-09-30 17:52:09 +08:00
|
|
|
/// </summary>
|
2022-06-14 18:38:51 +08:00
|
|
|
/// <param name="notification">The notification to update.</param>
|
|
|
|
/// <param name="tasks">The import tasks.</param>
|
|
|
|
/// <returns>The imported models.</returns>
|
|
|
|
Task<IEnumerable<Live<TModel>>> Import(ProgressNotification notification, params ImportTask[] tasks);
|
2021-09-30 17:52:09 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// A user displayable name for the model type associated with this manager.
|
|
|
|
/// </summary>
|
2022-06-20 20:39:47 +08:00
|
|
|
string HumanisedModelName => $"{typeof(TModel).Name.Replace(@"Info", "").ToLowerInvariant()}";
|
2022-06-20 17:53:48 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Fired when the user requests to view the resulting import.
|
|
|
|
/// </summary>
|
|
|
|
public Action<IEnumerable<Live<TModel>>>? PresentImport { set; }
|
2021-09-30 17:52:09 +08:00
|
|
|
}
|
|
|
|
}
|