1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 02:42:54 +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 BeatmapStore beatmaps;
private readonly IAPIProvider api;
private readonly AudioManager audioManager; private readonly AudioManager audioManager;
private readonly GameHost host; private readonly GameHost host;
@ -68,7 +66,6 @@ namespace osu.Game.Beatmaps
: base(storage, contextFactory, api, new BeatmapStore(contextFactory), host) : base(storage, contextFactory, api, new BeatmapStore(contextFactory), host)
{ {
this.rulesets = rulesets; this.rulesets = rulesets;
this.api = api;
this.audioManager = audioManager; this.audioManager = audioManager;
this.host = host; this.host = host;

View File

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

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // 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. // See the LICENCE file in the repository root for full licence text.
using Humanizer;
using osu.Framework.Logging; using osu.Framework.Logging;
using osu.Framework.Platform; using osu.Framework.Platform;
using osu.Game.Online.API; using osu.Game.Online.API;
@ -112,8 +113,7 @@ namespace osu.Game.Database
if (error is OperationCanceledException) return; if (error is OperationCanceledException) return;
notification.State = ProgressNotificationState.Cancelled; notification.State = ProgressNotificationState.Cancelled;
// TODO: maybe implement a Name for every model that we can use in this message? Logger.Error(error, $"{HumanisedModelName.Titleize()} download failed!");
Logger.Error(error, "Download failed!");
currentDownloads.Remove(request); currentDownloads.Remove(request);
}; };

View File

@ -6,6 +6,10 @@ using System;
namespace osu.Game.Database 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> public interface IModelDownloader<TModel> : IModelManager<TModel>
where TModel : class where TModel : class
{ {
@ -23,7 +27,7 @@ namespace osu.Game.Database
/// <summary> /// <summary>
/// Downloads a <see cref="TModel"/>. /// Downloads a <see cref="TModel"/>.
/// This will post notifications tracking progress. /// This may post notifications tracking progress.
/// </summary> /// </summary>
/// <param name="model">The <see cref="TModel"/> to be downloaded.</param> /// <param name="model">The <see cref="TModel"/> to be downloaded.</param>
/// <returns>Whether downloading can happen.</returns> /// <returns>Whether downloading can happen.</returns>
@ -31,7 +35,7 @@ namespace osu.Game.Database
/// <summary> /// <summary>
/// Downloads a <see cref="TModel"/> with optional parameters for the download request. /// 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> /// </summary>
/// <param name="model">The <see cref="TModel"/> to be downloaded.</param> /// <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> /// <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 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> public interface IModelManager<TModel>
where TModel : class
{ {
event Action<TModel, bool> ItemAdded; event Action<TModel, bool> ItemAdded;