Create a generic base archive download manager class

This commit is contained in:
naoey
2019-06-11 18:29:33 +05:30
parent 5c2c4f0ada
commit b4de51b612
2 changed files with 140 additions and 0 deletions

View File

@ -0,0 +1,23 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace osu.Game.Online.API
{
public abstract class ArchiveDownloadModelRequest<TModel> : APIDownloadRequest
where TModel : class
{
public readonly TModel Info;
public float Progress;
public event Action<float> DownloadProgressed;
protected ArchiveDownloadModelRequest(TModel model)
{
Info = model;
Progressed += (current, total) => DownloadProgressed?.Invoke(Progress = (float)current / total);
}
}
}