feat: Add auto-detect update feature.

This commit is contained in:
real-zony
2022-10-18 14:40:03 +08:00
parent a11ef70021
commit d19b1d8d2a
10 changed files with 92 additions and 11 deletions

View File

@@ -0,0 +1,26 @@
using System.Threading;
using System.Threading.Tasks;
using Microsoft.Extensions.Hosting;
using ZonyLrcTools.Common.Updater;
namespace ZonyLrcTools.Cli.Infrastructure;
public class UpdaterHostedService : IHostedService
{
private readonly IUpdater _updater;
public UpdaterHostedService(IUpdater updater)
{
_updater = updater;
}
public async Task StartAsync(CancellationToken cancellationToken)
{
await _updater.CheckUpdateAsync();
}
public Task StopAsync(CancellationToken cancellationToken)
{
return Task.CompletedTask;
}
}