1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 09:32:55 +08:00

Remove unused delegate, use model name in notifications, add more xmldoc

- Applies a `class` constraint to the generic type in `IModelManager`
- Add xmldoc
This commit is contained in:
naoey 2019-06-12 18:35:34 +05:30
parent c5f1da0f71
commit 9cd5519da3
No known key found for this signature in database
GPG Key ID: 670DA9BE3DF7EE60
5 changed files with 14 additions and 10 deletions

View File

@ -55,8 +55,6 @@ namespace osu.Game.Beatmaps
private readonly BeatmapStore beatmaps;
private readonly IAPIProvider api;
private readonly AudioManager audioManager;
private readonly GameHost host;
@ -68,7 +66,6 @@ namespace osu.Game.Beatmaps
: base(storage, contextFactory, api, new BeatmapStore(contextFactory), host)
{
this.rulesets = rulesets;
this.api = api;
this.audioManager = audioManager;
this.host = host;
@ -80,7 +77,7 @@ namespace osu.Game.Beatmaps
updateQueue = new BeatmapUpdateQueue(api);
}
protected override ArchiveDownloadRequest<BeatmapSetInfo> CreateDownloadRequest(BeatmapSetInfo set, object[] options) => new DownloadBeatmapSetRequest(set, (options?.FirstOrDefault() as bool?) ?? false);
protected override Task Populate(BeatmapSetInfo beatmapSet, ArchiveReader archive, CancellationToken cancellationToken = default)

View File

@ -35,8 +35,6 @@ namespace osu.Game.Database
where TModel : class, IHasFiles<TFileModel>, IHasPrimaryKey, ISoftDelete
where TFileModel : INamedFileInfo, new()
{
public delegate void ItemAddedDelegate(TModel model, bool existing);
/// <summary>
/// Set an endpoint for notifications to be posted to.
/// </summary>

View File

@ -1,6 +1,7 @@
// 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 Humanizer;
using osu.Framework.Logging;
using osu.Framework.Platform;
using osu.Game.Online.API;
@ -112,8 +113,7 @@ namespace osu.Game.Database
if (error is OperationCanceledException) return;
notification.State = ProgressNotificationState.Cancelled;
// TODO: maybe implement a Name for every model that we can use in this message?
Logger.Error(error, "Download failed!");
Logger.Error(error, $"{HumanisedModelName.Titleize()} download failed!");
currentDownloads.Remove(request);
};

View File

@ -6,6 +6,10 @@ using System;
namespace osu.Game.Database
{
/// <summary>
/// Represents a <see cref="IModelManager{TModel}"/> that can download new models from an external source.
/// </summary>
/// <typeparam name="TModel">The model type.</typeparam>
public interface IModelDownloader<TModel> : IModelManager<TModel>
where TModel : class
{
@ -23,7 +27,7 @@ namespace osu.Game.Database
/// <summary>
/// Downloads a <see cref="TModel"/>.
/// This will post notifications tracking progress.
/// This may post notifications tracking progress.
/// </summary>
/// <param name="model">The <see cref="TModel"/> to be downloaded.</param>
/// <returns>Whether downloading can happen.</returns>
@ -31,7 +35,7 @@ namespace osu.Game.Database
/// <summary>
/// Downloads a <see cref="TModel"/> with optional parameters for the download request.
/// This will post notifications tracking progress.
/// This may post notifications tracking progress.
/// </summary>
/// <param name="model">The <see cref="TModel"/> to be downloaded.</param>
/// <param name="extra">Optional parameters to be used for creating the download request.</param>

View File

@ -5,7 +5,12 @@ using System;
namespace osu.Game.Database
{
/// <summary>
/// Represents a model manager that publishes events when <see cref="TModel"/>s are added or removed.
/// </summary>
/// <typeparam name="TModel">The model type.</typeparam>
public interface IModelManager<TModel>
where TModel : class
{
event Action<TModel, bool> ItemAdded;