From 46a66ddb63e46116eaf5288dee92d63e33debde0 Mon Sep 17 00:00:00 2001 From: routersys Date: Tue, 14 Jul 2026 21:31:28 +0900 Subject: [PATCH] =?UTF-8?q?=E3=83=86=E3=82=B9=E3=83=88=E7=94=A8=E3=81=AB?= =?UTF-8?q?=E3=83=97=E3=83=AD=E3=83=90=E3=82=A4=E3=83=80=E6=B3=A8=E5=85=A5?= =?UTF-8?q?=E3=82=B7=E3=83=BC=E3=83=A0=E3=82=92=E8=BF=BD=E5=8A=A0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- GitHubUpdateNotifier/GitHubUpdateNotifier.cs | 13 ++++++++++--- GitHubUpdateNotifier/GitHubUpdateNotifier.csproj | 6 ++++++ 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/GitHubUpdateNotifier/GitHubUpdateNotifier.cs b/GitHubUpdateNotifier/GitHubUpdateNotifier.cs index b006355..01f8a7d 100644 --- a/GitHubUpdateNotifier/GitHubUpdateNotifier.cs +++ b/GitHubUpdateNotifier/GitHubUpdateNotifier.cs @@ -7,6 +7,11 @@ public sealed class GitHubUpdateNotifier private readonly ReleaseResolver _resolver; public GitHubUpdateNotifier(string owner, string repository, UpdateNotifierOptions options) + : this(owner, repository, options, DefaultProviders()) + { + } + + internal GitHubUpdateNotifier(string owner, string repository, UpdateNotifierOptions options, IReadOnlyList providers) { ArgumentException.ThrowIfNullOrWhiteSpace(owner); ArgumentException.ThrowIfNullOrWhiteSpace(repository); @@ -14,12 +19,11 @@ public sealed class GitHubUpdateNotifier ArgumentNullException.ThrowIfNull(options.CurrentVersion); ArgumentNullException.ThrowIfNull(options.MessageFormatter); ArgumentNullException.ThrowIfNull(options.NotificationHandler); + ArgumentNullException.ThrowIfNull(providers); _repository = new RepositoryReference(owner, repository); _options = options; - _resolver = new ReleaseResolver( - [new ManjuboxReleaseProvider(), new GitHubReleaseProvider()], - Math.Max(0, options.RetryCount)); + _resolver = new ReleaseResolver(providers, Math.Max(0, options.RetryCount)); } public async Task CheckAsync(CancellationToken cancellationToken = default) @@ -53,4 +57,7 @@ public sealed class GitHubUpdateNotifier await _options.NotificationHandler(new UpdateNotification(result.Update!, message), cancellationToken).ConfigureAwait(false); return result; } + + private static IReadOnlyList DefaultProviders() + => [new ManjuboxReleaseProvider(), new GitHubReleaseProvider()]; } diff --git a/GitHubUpdateNotifier/GitHubUpdateNotifier.csproj b/GitHubUpdateNotifier/GitHubUpdateNotifier.csproj index 9e089b0..631e973 100644 --- a/GitHubUpdateNotifier/GitHubUpdateNotifier.csproj +++ b/GitHubUpdateNotifier/GitHubUpdateNotifier.csproj @@ -15,4 +15,10 @@ + + + <_Parameter1>GitHubUpdateNotifier.Tests + + +