2019-06-11 23:47:05 +05:30
// 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-11 22:42:57 +05:30
using System ;
namespace osu.Game.Database
{
2019-06-12 18:35:34 +05:30
/// <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-11 23:47:05 +05:30
public interface IModelDownloader < TModel > : IModelManager < TModel >
2019-06-11 22:42:57 +05:30
where TModel : class
{
/// <summary>
2019-11-17 20:48:23 +08:00
/// Fired when a <typeparamref name="TModel"/> download begins.
2019-06-11 22:42:57 +05:30
/// </summary>
2019-06-12 13:30:23 +09:00
event Action < ArchiveDownloadRequest < TModel > > DownloadBegan ;
2019-06-11 22:42:57 +05:30
/// <summary>
2019-11-17 20:48:23 +08:00
/// Fired when a <typeparamref name="TModel"/> download is interrupted, either due to user cancellation or failure.
2019-06-11 22:42:57 +05:30
/// </summary>
2019-06-12 13:30:23 +09:00
event Action < ArchiveDownloadRequest < TModel > > DownloadFailed ;
2019-06-11 22:42:57 +05:30
2019-06-13 21:28:32 +05:30
/// <summary>
2019-11-17 20:48:23 +08:00
/// Checks whether a given <typeparamref name="TModel"/> is already available in the local store.
2019-06-13 21:28:32 +05:30
/// </summary>
2019-11-17 20:48:23 +08:00
/// <param name="model">The <typeparamref name="TModel"/> whose existence needs to be checked.</param>
/// <returns>Whether the <typeparamref name="TModel"/> exists.</returns>
2019-06-11 22:42:57 +05:30
bool IsAvailableLocally ( TModel model ) ;
/// <summary>
2019-11-17 20:48:23 +08:00
/// Begin a download for the requested <typeparamref name="TModel"/>.
2019-06-11 22:42:57 +05:30
/// </summary>
2019-11-17 20:48:23 +08:00
/// <param name="model">The <stypeparamref name="TModel"/> to be downloaded.</param>
2019-06-19 01:41:19 +09: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-11 22:42:57 +05:30
/// <summary>
2019-11-17 20:48:23 +08:00
/// Gets an existing <typeparamref name="TModel"/> download request if it exists.
2019-06-11 22:42:57 +05:30
/// </summary>
2019-11-17 20:48:23 +08:00
/// <param name="model">The <typeparamref name="TModel"/> whose request is wanted.</param>
2019-06-12 13:30:23 +09:00
/// <returns>The <see cref="ArchiveDownloadRequest{TModel}"/> object if it exists, otherwise null.</returns>
ArchiveDownloadRequest < TModel > GetExistingDownload ( TModel model ) ;
2019-06-11 22:42:57 +05:30
}
}