2019-06-12 02:17:05 +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.
using osu.Game.Online.API ;
2019-06-12 01:12:57 +08:00
using System ;
namespace osu.Game.Database
{
2019-06-12 21:05:34 +08:00
/// <summary>
/// Represents a <see cref="IModelManager{TModel}"/> that can download new models from an external source.
/// </summary>
/// <typeparam name="TModel">The model type.</typeparam>
2019-06-12 02:17:05 +08:00
public interface IModelDownloader < TModel > : IModelManager < TModel >
2019-06-12 01:12:57 +08:00
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 ;
2019-06-12 01:12:57 +08:00
/// <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 ;
2019-06-12 01:12:57 +08:00
2019-06-13 23:58:32 +08:00
/// <summary>
/// Checks whether a given <see cref="TModel"/> is already available in the local store.
/// </summary>
/// <param name="model">The <see cref="TModel"/> whose existence needs to be checked.</param>
/// <returns>Whether the <see cref="TModel"/> exists.</returns>
2019-06-12 01:12:57 +08:00
bool IsAvailableLocally ( TModel model ) ;
/// <summary>
2019-06-19 00:41:19 +08:00
/// Begin a download for the requested <see cref="TModel"/>.
2019-06-12 01:12:57 +08:00
/// </summary>
/// <param name="model">The <see cref="TModel"/> to be downloaded.</param>
2019-06-19 00:41:19 +08:00
/// <param name="minimiseDownloadSize">Whether this download should be optimised for slow connections. Generally means extras are not included in the download bundle..</param>
/// <returns>Whether the download was started.</returns>
bool Download ( TModel model , bool minimiseDownloadSize ) ;
2019-06-12 01:12:57 +08:00
/// <summary>
2019-06-12 02:32:53 +08:00
/// Gets an existing <see cref="TModel"/> download request if it exists.
2019-06-12 01:12:57 +08:00
/// </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 ) ;
2019-06-12 01:12:57 +08:00
}
}