1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-01 04:02:57 +08:00

Rename property.

This commit is contained in:
naoey 2017-09-09 11:03:25 +05:30
parent e67606e203
commit d12a5e927a

View File

@ -68,7 +68,7 @@ namespace osu.Game.Beatmaps
private readonly APIAccess api; private readonly APIAccess api;
private readonly List<DownloadBeatmapSetRequest> downloadsList; private readonly List<DownloadBeatmapSetRequest> currentDownloads;
// ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised) // ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised)
private BeatmapIPCChannel ipc; private BeatmapIPCChannel ipc;
@ -100,7 +100,7 @@ namespace osu.Game.Beatmaps
if (importHost != null) if (importHost != null)
ipc = new BeatmapIPCChannel(importHost, this); ipc = new BeatmapIPCChannel(importHost, this);
downloadsList = new List<DownloadBeatmapSetRequest>(); currentDownloads = new List<DownloadBeatmapSetRequest>();
} }
/// <summary> /// <summary>
@ -194,7 +194,7 @@ namespace osu.Game.Beatmaps
/// <returns>A new <see cref="DownloadBeatmapSetRequest"/>, or an existing one if a download is already in progress.</returns> /// <returns>A new <see cref="DownloadBeatmapSetRequest"/>, or an existing one if a download is already in progress.</returns>
public DownloadBeatmapSetRequest Download(BeatmapSetInfo beatmapSetInfo) public DownloadBeatmapSetRequest Download(BeatmapSetInfo beatmapSetInfo)
{ {
var existing = downloadsList.Find(d => d.BeatmapSet.OnlineBeatmapSetID == beatmapSetInfo.OnlineBeatmapSetID); var existing = currentDownloads.Find(d => d.BeatmapSet.OnlineBeatmapSetID == beatmapSetInfo.OnlineBeatmapSetID);
if (existing != null) return existing; if (existing != null) return existing;
@ -221,25 +221,25 @@ namespace osu.Game.Beatmaps
using (var archive = new OszArchiveReader(stream)) using (var archive = new OszArchiveReader(stream))
Import(archive); Import(archive);
downloadsList.Remove(request); currentDownloads.Remove(request);
}; };
request.Failure += data => request.Failure += data =>
{ {
downloadNotification.State = ProgressNotificationState.Completed; downloadNotification.State = ProgressNotificationState.Completed;
Logger.Error(data, "Failed to get beatmap download information"); Logger.Error(data, "Failed to get beatmap download information");
downloadsList.Remove(request); currentDownloads.Remove(request);
}; };
downloadNotification.CancelRequested += () => downloadNotification.CancelRequested += () =>
{ {
request.Cancel(); request.Cancel();
downloadsList.Remove(request); currentDownloads.Remove(request);
downloadNotification.State = ProgressNotificationState.Cancelled; downloadNotification.State = ProgressNotificationState.Cancelled;
return true; return true;
}; };
downloadsList.Add(request); currentDownloads.Add(request);
PostNotification?.Invoke(downloadNotification); PostNotification?.Invoke(downloadNotification);
// don't run in the main api queue as this is a long-running task. // don't run in the main api queue as this is a long-running task.
@ -254,7 +254,7 @@ namespace osu.Game.Beatmaps
/// </summary> /// </summary>
/// <param name="beatmap">The <see cref="BeatmapSetInfo"/> whose download request is wanted.</param> /// <param name="beatmap">The <see cref="BeatmapSetInfo"/> whose download request is wanted.</param>
/// <returns>The <see cref="DownloadBeatmapSetRequest"/> object if it exists, or null.</returns> /// <returns>The <see cref="DownloadBeatmapSetRequest"/> object if it exists, or null.</returns>
public DownloadBeatmapSetRequest GetExistingDownload(BeatmapSetInfo beatmap) => downloadsList.Find(d => d.BeatmapSet.OnlineBeatmapSetID == beatmap.OnlineBeatmapSetID); public DownloadBeatmapSetRequest GetExistingDownload(BeatmapSetInfo beatmap) => currentDownloads.Find(d => d.BeatmapSet.OnlineBeatmapSetID == beatmap.OnlineBeatmapSetID);
/// <summary> /// <summary>
/// Delete a beatmap from the manager. /// Delete a beatmap from the manager.