1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 15:27:26 +08:00

Expose method for triggering filename-backed success in APIDownloadRequest

Exactly like in `APIRequest<T>`
This commit is contained in:
Salman Ahmed 2021-01-16 23:07:46 +03:00
parent 96feaa027d
commit 4778686dc4

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 System;
using System.IO;
using osu.Framework.IO.Network;
@ -28,13 +29,19 @@ namespace osu.Game.Online.API
private void request_Progress(long current, long total) => API.Schedule(() => Progressed?.Invoke(current, total));
protected APIDownloadRequest()
internal void TriggerSuccess(string filename)
{
base.Success += onSuccess;
if (this.filename != null)
throw new InvalidOperationException("Attempted to trigger success more than once");
this.filename = filename;
TriggerSuccess();
}
private void onSuccess()
internal override void TriggerSuccess()
{
base.TriggerSuccess();
Success?.Invoke(filename);
}