mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 23:52:57 +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:
parent
c5f1da0f71
commit
9cd5519da3
@ -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;
|
||||||
|
|
||||||
@ -80,7 +77,7 @@ namespace osu.Game.Beatmaps
|
|||||||
|
|
||||||
updateQueue = new BeatmapUpdateQueue(api);
|
updateQueue = new BeatmapUpdateQueue(api);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override ArchiveDownloadRequest<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 Task Populate(BeatmapSetInfo beatmapSet, ArchiveReader archive, CancellationToken cancellationToken = default)
|
protected override Task Populate(BeatmapSetInfo beatmapSet, ArchiveReader archive, CancellationToken cancellationToken = default)
|
||||||
|
@ -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>
|
||||||
|
@ -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);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -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>
|
||||||
|
@ -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;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user