mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 20:22:55 +08:00
Rename request type to be less verbose
This commit is contained in:
parent
eaeeffaa86
commit
c591a6f1fa
@ -74,7 +74,7 @@ namespace osu.Game.Beatmaps
|
||||
beatmaps.BeatmapRestored += b => BeatmapRestored?.Invoke(b);
|
||||
}
|
||||
|
||||
protected override ArchiveDownloadModelRequest<BeatmapSetInfo> CreateDownloadRequest(BeatmapSetInfo set, object[] options) => new DownloadBeatmapSetRequest(set, (options?.FirstOrDefault() as bool?) ?? false);
|
||||
protected override ArchiveDownloadRequest<BeatmapSetInfo> CreateDownloadRequest(BeatmapSetInfo set, object[] options) => new DownloadBeatmapSetRequest(set, (options?.FirstOrDefault() as bool?) ?? false);
|
||||
|
||||
protected override void Populate(BeatmapSetInfo beatmapSet, ArchiveReader archive)
|
||||
{
|
||||
|
@ -22,13 +22,13 @@ namespace osu.Game.Database
|
||||
where TModel : class, IHasFiles<TFileModel>, IHasPrimaryKey, ISoftDelete
|
||||
where TFileModel : INamedFileInfo, new()
|
||||
{
|
||||
public event Action<ArchiveDownloadModelRequest<TModel>> DownloadBegan;
|
||||
public event Action<ArchiveDownloadRequest<TModel>> DownloadBegan;
|
||||
|
||||
public event Action<ArchiveDownloadModelRequest<TModel>> DownloadFailed;
|
||||
public event Action<ArchiveDownloadRequest<TModel>> DownloadFailed;
|
||||
|
||||
private readonly IAPIProvider api;
|
||||
|
||||
private readonly List<ArchiveDownloadModelRequest<TModel>> currentDownloads = new List<ArchiveDownloadModelRequest<TModel>>();
|
||||
private readonly List<ArchiveDownloadRequest<TModel>> currentDownloads = new List<ArchiveDownloadRequest<TModel>>();
|
||||
|
||||
private readonly MutableDatabaseBackedStoreWithFileIncludes<TModel, TFileModel> modelStore;
|
||||
|
||||
@ -47,7 +47,7 @@ namespace osu.Game.Database
|
||||
/// <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>
|
||||
/// <returns>The request object.</returns>
|
||||
protected abstract ArchiveDownloadModelRequest<TModel> CreateDownloadRequest(TModel model, object[] options);
|
||||
protected abstract ArchiveDownloadRequest<TModel> CreateDownloadRequest(TModel model, object[] options);
|
||||
|
||||
public bool Download(TModel model)
|
||||
{
|
||||
@ -78,11 +78,11 @@ namespace osu.Game.Database
|
||||
/// <returns>Whether the <see cref="TModel"/> exists locally.</returns>
|
||||
public virtual bool IsAvailableLocally(TModel model) => modelStore.ConsumableItems.Any(m => m.Equals(model) && !m.DeletePending);
|
||||
|
||||
public ArchiveDownloadModelRequest<TModel> GetExistingDownload(TModel model) => currentDownloads.Find(r => r.Info.Equals(model));
|
||||
public ArchiveDownloadRequest<TModel> GetExistingDownload(TModel model) => currentDownloads.Find(r => r.Info.Equals(model));
|
||||
|
||||
private bool canDownload(TModel model) => GetExistingDownload(model) == null && api != null;
|
||||
|
||||
private void performDownloadWithRequest(ArchiveDownloadModelRequest<TModel> request)
|
||||
private void performDownloadWithRequest(ArchiveDownloadRequest<TModel> request)
|
||||
{
|
||||
DownloadNotification notification = new DownloadNotification
|
||||
{
|
||||
|
@ -12,12 +12,12 @@ namespace osu.Game.Database
|
||||
/// <summary>
|
||||
/// Fired when a <see cref="TModel"/> download begins.
|
||||
/// </summary>
|
||||
event Action<ArchiveDownloadModelRequest<TModel>> DownloadBegan;
|
||||
event Action<ArchiveDownloadRequest<TModel>> DownloadBegan;
|
||||
|
||||
/// <summary>
|
||||
/// Fired when a <see cref="TModel"/> download is interrupted, either due to user cancellation or failure.
|
||||
/// </summary>
|
||||
event Action<ArchiveDownloadModelRequest<TModel>> DownloadFailed;
|
||||
event Action<ArchiveDownloadRequest<TModel>> DownloadFailed;
|
||||
|
||||
bool IsAvailableLocally(TModel model);
|
||||
|
||||
@ -42,7 +42,7 @@ namespace osu.Game.Database
|
||||
/// Gets an existing <see cref="TModel"/> download request if it exists.
|
||||
/// </summary>
|
||||
/// <param name="model">The <see cref="TModel"/> whose request is wanted.</param>
|
||||
/// <returns>The <see cref="ArchiveDownloadModelRequest{TModel}"/> object if it exists, otherwise null.</returns>
|
||||
ArchiveDownloadModelRequest<TModel> GetExistingDownload(TModel model);
|
||||
/// <returns>The <see cref="ArchiveDownloadRequest{TModel}"/> object if it exists, otherwise null.</returns>
|
||||
ArchiveDownloadRequest<TModel> GetExistingDownload(TModel model);
|
||||
}
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ using System;
|
||||
|
||||
namespace osu.Game.Online.API
|
||||
{
|
||||
public abstract class ArchiveDownloadModelRequest<TModel> : APIDownloadRequest
|
||||
public abstract class ArchiveDownloadRequest<TModel> : APIDownloadRequest
|
||||
where TModel : class
|
||||
{
|
||||
public readonly TModel Info;
|
||||
@ -14,7 +14,7 @@ namespace osu.Game.Online.API
|
||||
|
||||
public event Action<float> DownloadProgressed;
|
||||
|
||||
protected ArchiveDownloadModelRequest(TModel model)
|
||||
protected ArchiveDownloadRequest(TModel model)
|
||||
{
|
||||
Info = model;
|
||||
|
@ -5,7 +5,7 @@ using osu.Game.Beatmaps;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public class DownloadBeatmapSetRequest : ArchiveDownloadModelRequest<BeatmapSetInfo>
|
||||
public class DownloadBeatmapSetRequest : ArchiveDownloadRequest<BeatmapSetInfo>
|
||||
{
|
||||
private readonly bool noVideo;
|
||||
private readonly BeatmapSetInfo set;
|
||||
|
@ -76,9 +76,9 @@ namespace osu.Game.Overlays.Direct
|
||||
|
||||
#endregion
|
||||
|
||||
private ArchiveDownloadModelRequest<BeatmapSetInfo> attachedRequest;
|
||||
private ArchiveDownloadRequest<BeatmapSetInfo> attachedRequest;
|
||||
|
||||
private void attachDownload(ArchiveDownloadModelRequest<BeatmapSetInfo> request)
|
||||
private void attachDownload(ArchiveDownloadRequest<BeatmapSetInfo> request)
|
||||
{
|
||||
if (attachedRequest != null)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user