diff --git a/Nuget/NugetExtensions.cs b/Nuget/NugetExtensions.cs
index 9d910f26..4ed7195a 100644
--- a/Nuget/NugetExtensions.cs
+++ b/Nuget/NugetExtensions.cs
@@ -4,8 +4,16 @@
using Ecng.Reflection;
+///
+/// NuGET extensions.
+///
public static class NugetExtensions
{
+ ///
+ /// Get the target frameworks for the package.
+ ///
+ ///
+ /// Target frameworks.
public static string[] GetTargetFrameworks(this PackageArchiveReader reader)
{
var targetFrameworks = reader
@@ -22,9 +30,23 @@ public static string[] GetTargetFrameworks(this PackageArchiveReader reader)
return [.. targetFrameworks];
}
+ ///
+ /// Remove the platform version.
+ ///
+ ///
+ /// The framework without the platform version.
public static NuGetFramework RemovePlatformVersion(this NuGetFramework fwk)
=> new(fwk.Framework, fwk.Version, fwk.Platform, FrameworkConstants.EmptyVersion);
+ ///
+ /// Get all versions.
+ ///
+ ///
+ /// The package ID.
+ ///
+ ///
+ ///
+ /// All versions ordered.
public static async Task GetAllVersionsOrderedAsync(this SourceRepository repo, string packageId, ILogger logger, SourceCacheContext cache, CancellationToken token)
{
var resource = await repo.GetResourceAsync(token);
@@ -32,6 +54,16 @@ public static async Task GetAllVersionsOrderedAsync(this SourceR
return [.. (await resource.GetAllVersionsAsync(packageId, cache, logger, token)).OrderBy(v => v)];
}
+ ///
+ /// Get the last version.
+ ///
+ ///
+ /// The package ID.
+ /// Allow preview versions.
+ ///
+ ///
+ ///
+ /// The last version.
public static async Task GetLastVersionAsync(this SourceRepository repo, string packageId, bool allowPreview, ILogger logger, SourceCacheContext cache, CancellationToken token)
{
var versions = await repo.GetAllVersionsOrderedAsync(packageId, logger, cache, token);
@@ -40,6 +72,16 @@ public static async Task GetLastVersionAsync(this SourceRepository
return versions.LastOrDefault(cond);
}
+ ///
+ /// Get the last version in the floating range.
+ ///
+ ///
+ /// The package ID.
+ /// The floating version.
+ ///
+ ///
+ ///
+ /// The last version in the floating range.
public static async Task GetLastVersionInFloatingRangeAsync(this SourceRepository repo, string packageId, string floatingVer, ILogger logger, SourceCacheContext cache, CancellationToken token)
{
if (!FloatRange.TryParse(floatingVer, out var range))
@@ -82,6 +124,9 @@ event EventHandler ISettings.SettingsChanged
void ISettings.SaveToDisk() => throw new NotSupportedException();
}
+ ///
+ /// Disable access to the nuget.config file.
+ ///
public static void DisableNugetConfig()
{
// disable access nuget.config file
@@ -93,6 +138,11 @@ public static void DisableNugetConfig()
lazy.SetValue(proxy);
}
+ ///
+ /// Increment the version.
+ ///
+ ///
+ /// The incremented version.
public static NuGetVersion Increment(this NuGetVersion version)
{
if (version is null)
@@ -101,6 +151,12 @@ public static NuGetVersion Increment(this NuGetVersion version)
return new(version.Major, version.Minor, version.Patch + 1);
}
+ ///
+ /// Add a suffix to the version.
+ ///
+ ///
+ /// The suffix to add.
+ /// The version with the suffix.
public static NuGetVersion WithSuffix(this NuGetVersion version, string suffix)
{
if (version is null)
@@ -112,6 +168,12 @@ public static NuGetVersion WithSuffix(this NuGetVersion version, string suffix)
return new(version.Major, version.Minor, version.Patch, suffix);
}
+ ///
+ /// Get the base URL for the repository.
+ ///
+ ///
+ ///
+ /// The base URL for the repository.
public static async Task GetBaseUrl(this SourceRepository repo, CancellationToken cancellationToken)
{
if (repo is null)
@@ -131,6 +193,11 @@ public static async Task GetBaseUrl(this SourceRepository repo, Cancellatio
return baseUrl;
}
+ ///
+ /// Create a private HTTP client.
+ ///
+ /// The API key.
+ /// The private HTTP client.
public static HttpClient CreatePrivateHttp(string apiKey)
{
var http = new HttpClient();
@@ -138,6 +205,15 @@ public static HttpClient CreatePrivateHttp(string apiKey)
return http;
}
+ ///
+ /// Get the nuspec file.
+ ///
+ ///
+ /// The base URL for the repository.
+ /// The package ID.
+ /// The package version.
+ /// The cancellation token.
+ /// The nuspec file.
public static Task GetNuspecAsync(this HttpClient http, Uri baseUrl, string packageId, NuGetVersion version, CancellationToken cancellationToken)
{
if (http is null) throw new ArgumentNullException(nameof(http));
@@ -147,4 +223,4 @@ public static Task GetNuspecAsync(this HttpClient http, Uri baseUrl, str
return http.GetStreamAsync(new Uri(baseUrl, $"{packageId}/{version}/{packageId}{NuGetConstants.ManifestExtension}".ToLowerInvariant()), cancellationToken);
}
-}
+}
\ No newline at end of file
diff --git a/Nuget/NugetLogger.cs b/Nuget/NugetLogger.cs
index 9d8eecaa..8354259a 100644
--- a/Nuget/NugetLogger.cs
+++ b/Nuget/NugetLogger.cs
@@ -1,9 +1,14 @@
namespace Ecng.Nuget;
+///
+/// The logger for Nuget.
+///
+///
public class NugetLogger(ILogReceiver logger) : LoggerBase
{
private readonly ILogReceiver _logger = logger ?? throw new ArgumentNullException(nameof(logger));
+ ///
public override void Log(ILogMessage message)
{
switch (message.Level)
@@ -20,6 +25,7 @@ public override void Log(ILogMessage message)
}
}
+ ///
public override Task LogAsync(ILogMessage message)
{
Log(message);
diff --git a/Nuget/NugetProviderFactory.cs b/Nuget/NugetProviderFactory.cs
index e7308726..527a8ca0 100644
--- a/Nuget/NugetProviderFactory.cs
+++ b/Nuget/NugetProviderFactory.cs
@@ -2,6 +2,11 @@
using Newtonsoft.Json.Linq;
+///
+/// The factory for the Nuget provider.
+///
+///
+/// The private Nuget token.
public class NugetProviderFactory(ILogReceiver log, SecureString privateNugetToken) : Repository.ProviderFactory
{
private class NugetRegistrationResourceProvider : ResourceProvider
@@ -111,6 +116,7 @@ public override async Task> TryCreate(SourceReposito
private readonly SecureString _privateNugetToken = privateNugetToken ?? throw new ArgumentNullException(nameof(privateNugetToken));
private readonly ILogReceiver _log = log ?? throw new ArgumentNullException(nameof(log));
+ ///
public override IEnumerable> GetCoreV3()
{
yield return new Lazy(() => new NugetHttpHandlerProvider(_log, _privateNugetToken));
diff --git a/Nuget/NugetRepoProvider.cs b/Nuget/NugetRepoProvider.cs
index 636c0870..0f92fd74 100644
--- a/Nuget/NugetRepoProvider.cs
+++ b/Nuget/NugetRepoProvider.cs
@@ -3,6 +3,7 @@ namespace Ecng.Nuget;
using Nito.AsyncEx;
///
+/// Nuget repository provider.
///
public class NugetRepoProvider : CachingSourceProvider
{
@@ -59,9 +60,24 @@ private PrivatePackageSource(string addr) : base(addr, PrivateRepoKey) {}
private static readonly AsyncLock _instanceLock = new();
private static NugetRepoProvider _instance;
+ ///
+ /// Get instance.
+ ///
+ /// Get auth token.
+ ///
+ ///
+ /// Task.
public static Task GetInstanceAsync(Func getAuthToken, string packagesFolder, CancellationToken token)
=> GetInstanceAsync("https://nuget.stocksharp.com/x/v3/index.json", getAuthToken, packagesFolder, token);
+ ///
+ /// Get instance.
+ ///
+ /// Private url.
+ /// Get auth token.
+ ///
+ ///
+ /// Task.
public static async Task GetInstanceAsync(string privateUrl, Func getAuthToken, string packagesFolder, CancellationToken token)
{
await PrivatePackageSource.GetAsync(privateUrl, token);
@@ -90,6 +106,7 @@ public static async Task GetInstanceAsync(string privateUrl,
private static readonly ISettings _settings = NullSettings.Instance;
///
+ /// Settings.
///
public ISettings Settings => ((PackageSourceProvider)PackageSourceProvider).Settings;
@@ -125,6 +142,15 @@ async Task initBaseUrl(SourceRepository repo)
await initBaseUrl(_privateRepo);
}
+ ///
+ /// Try to find version.
+ ///
+ /// The package id.
+ /// The version range.
+ ///
+ ///
+ ///
+ /// Found version, repository and base url.
public async Task<(NuGetVersion version, SourceRepository repo, Uri baseUrl)> TryFindVersion(string packageId, VersionRange versionRange, SourceCacheContext cache, ILogger logger, CancellationToken cancellationToken)
{
foreach (var (repo, baseUrl) in _repoUrls)
@@ -148,6 +174,16 @@ async Task initBaseUrl(SourceRepository repo)
throw new InvalidOperationException($"Package {packageId} for version range {versionRange} not found.");
}
+ ///
+ /// Get dependencies.
+ ///
+ /// The package identities.
+ /// The framework.
+ /// The local files.
+ ///
+ ///
+ ///
+ /// Dependencies.
public async Task>> GetDependenciesAsync(IEnumerable identities, NuGetFramework framework, IDictionary localFiles, SourceCacheContext cache, ILogger logger, CancellationToken cancellationToken)
{
if (identities is null) throw new ArgumentNullException(nameof(identities));