Make Source methods virtual (#181)

This commit is contained in:
Enis Necipoglu
2024-07-23 23:59:19 +03:00
committed by GitHub
parent c0a9476c22
commit 5195300183
3 changed files with 6 additions and 6 deletions

View File

@@ -24,7 +24,7 @@ namespace Velopack.Sources
}
/// <inheritdoc />
public Task<VelopackAssetFeed> GetReleaseFeed(ILogger logger, string channel, Guid? stagingId = null, VelopackAsset? latestLocalRelease = null)
public virtual Task<VelopackAssetFeed> GetReleaseFeed(ILogger logger, string channel, Guid? stagingId = null, VelopackAsset? latestLocalRelease = null)
{
if (!BaseDirectory.Exists) {
logger.Error($"The local update directory '{BaseDirectory.FullName}' does not exist.");
@@ -64,7 +64,7 @@ namespace Velopack.Sources
}
/// <inheritdoc />
public Task DownloadReleaseEntry(ILogger logger, VelopackAsset releaseEntry, string localFile, Action<int> progress, CancellationToken cancelToken)
public virtual Task DownloadReleaseEntry(ILogger logger, VelopackAsset releaseEntry, string localFile, Action<int> progress, CancellationToken cancelToken)
{
var releasePath = Path.Combine(BaseDirectory.FullName, releaseEntry.FileName);
if (!File.Exists(releasePath))

View File

@@ -32,7 +32,7 @@ namespace Velopack.Sources
}
/// <inheritdoc />
public async Task<VelopackAssetFeed> GetReleaseFeed(ILogger logger, string channel, Guid? stagingId = null, VelopackAsset? latestLocalRelease = null)
public async virtual Task<VelopackAssetFeed> GetReleaseFeed(ILogger logger, string channel, Guid? stagingId = null, VelopackAsset? latestLocalRelease = null)
{
var releaseFilename = Utility.GetVeloReleaseIndexName(channel);
var uri = Utility.AppendPathToUri(BaseUri, releaseFilename);
@@ -61,7 +61,7 @@ namespace Velopack.Sources
}
/// <inheritdoc />
public async Task DownloadReleaseEntry(ILogger logger, VelopackAsset releaseEntry, string localFile, Action<int> progress, CancellationToken cancelToken)
public async virtual Task DownloadReleaseEntry(ILogger logger, VelopackAsset releaseEntry, string localFile, Action<int> progress, CancellationToken cancelToken)
{
if (releaseEntry == null) throw new ArgumentNullException(nameof(releaseEntry));
if (localFile == null) throw new ArgumentNullException(nameof(localFile));

View File

@@ -29,7 +29,7 @@ namespace Velopack.Sources
public IFileDownloader Downloader { get; }
/// <inheritdoc />
public async Task<VelopackAssetFeed> GetReleaseFeed(ILogger logger, string channel, Guid? stagingId = null,
public async virtual Task<VelopackAssetFeed> GetReleaseFeed(ILogger logger, string channel, Guid? stagingId = null,
VelopackAsset? latestLocalRelease = null)
{
Uri baseUri = new(BaseUri, $"v1.0/manifest/");
@@ -65,7 +65,7 @@ namespace Velopack.Sources
}
/// <inheritdoc />
public async Task DownloadReleaseEntry(ILogger logger, VelopackAsset releaseEntry, string localFile, Action<int> progress, CancellationToken cancelToken = default)
public async virtual Task DownloadReleaseEntry(ILogger logger, VelopackAsset releaseEntry, string localFile, Action<int> progress, CancellationToken cancelToken = default)
{
if (releaseEntry is null) throw new ArgumentNullException(nameof(releaseEntry));
if (releaseEntry is not VelopackFlowReleaseAsset velopackRelease) {