1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 05:27:23 +08:00
osu-lazer/osu.Game/Database/IModelDownloader.cs

53 lines
2.2 KiB
C#
Raw Normal View History

// 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 osu.Game.Online.API;
using System;
namespace osu.Game.Database
{
/// <summary>
/// Represents a <see cref="IModelManager{TModel}"/> that can download new models from an external source.
/// </summary>
/// <typeparam name="TModel">The model type.</typeparam>
public interface IModelDownloader<TModel> : IModelManager<TModel>
where TModel : class
{
/// <summary>
/// Fired when a <see cref="TModel"/> download begins.
/// </summary>
2019-06-12 12:30:23 +08:00
event Action<ArchiveDownloadRequest<TModel>> DownloadBegan;
/// <summary>
/// Fired when a <see cref="TModel"/> download is interrupted, either due to user cancellation or failure.
/// </summary>
2019-06-12 12:30:23 +08:00
event Action<ArchiveDownloadRequest<TModel>> DownloadFailed;
bool IsAvailableLocally(TModel model);
/// <summary>
/// Downloads a <see cref="TModel"/>.
/// This may post notifications tracking progress.
/// </summary>
/// <param name="model">The <see cref="TModel"/> to be downloaded.</param>
/// <returns>Whether downloading can happen.</returns>
bool Download(TModel model);
/// <summary>
/// Downloads a <see cref="TModel"/> with optional parameters for the download request.
/// This may post notifications tracking progress.
/// </summary>
/// <param name="model">The <see cref="TModel"/> to be downloaded.</param>
/// <param name="extra">Optional parameters to be used for creating the download request.</param>
/// <returns>Whether downloading can happen.</returns>
bool Download(TModel model, params object[] extra);
/// <summary>
2019-06-12 02:32:53 +08:00
/// Gets an existing <see cref="TModel"/> download request if it exists.
/// </summary>
2019-06-12 02:32:53 +08:00
/// <param name="model">The <see cref="TModel"/> whose request is wanted.</param>
2019-06-12 12:30:23 +08:00
/// <returns>The <see cref="ArchiveDownloadRequest{TModel}"/> object if it exists, otherwise null.</returns>
ArchiveDownloadRequest<TModel> GetExistingDownload(TModel model);
}
}