mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 08:20:00 +09:00
Simplify download method
This commit is contained in:
@ -42,30 +42,23 @@ namespace osu.Game.Database
|
||||
|
||||
/// <summary>
|
||||
/// Creates the download request for this <see cref="TModel"/>.
|
||||
/// The <paramref name="options"/> parameters will be provided when the download was initiated with extra options meant
|
||||
/// to be used in the creation of the request.
|
||||
/// </summary>
|
||||
/// <param name="model">The <see cref="TModel"/> to be downloaded.</param>
|
||||
/// <param name="options">Extra parameters for request creation, null if none were passed.</param>
|
||||
/// <param name="minimiseDownloadSize">Whether this download should be optimised for slow connections. Generally means extras are not included in the download bundle..</param>
|
||||
/// <returns>The request object.</returns>
|
||||
protected abstract ArchiveDownloadRequest<TModel> CreateDownloadRequest(TModel model, object[] options);
|
||||
protected abstract ArchiveDownloadRequest<TModel> CreateDownloadRequest(TModel model, bool minimiseDownloadSize);
|
||||
|
||||
public bool Download(TModel model)
|
||||
/// <summary>
|
||||
/// Begin a download for the requested <see cref="TModel"/>.
|
||||
/// </summary>
|
||||
/// <param name="model">The <see cref="TModel"/> to be downloaded.</param>
|
||||
/// <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>
|
||||
public bool Download(TModel model, bool minimiseDownloadSize = false)
|
||||
{
|
||||
if (!canDownload(model)) return false;
|
||||
|
||||
var request = CreateDownloadRequest(model, null);
|
||||
|
||||
performDownloadWithRequest(request);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public bool Download(TModel model, params object[] extra)
|
||||
{
|
||||
if (!canDownload(model)) return false;
|
||||
|
||||
var request = CreateDownloadRequest(model, extra);
|
||||
var request = CreateDownloadRequest(model, minimiseDownloadSize);
|
||||
|
||||
performDownloadWithRequest(request);
|
||||
|
||||
|
Reference in New Issue
Block a user