diff --git a/build/config.props b/build/config.props
index 5bfb71e..66a01d4 100644
--- a/build/config.props
+++ b/build/config.props
@@ -21,8 +21,7 @@
git
https://github.com/emgarten/nuget.catalogreader
nuget nugetcatalog nugetfeed nugetv3
-
- https://emgartenstatic.blob.core.windows.net/nupkgs/icons/nuget.catalogreader.png
+ https://emgartenstatic.blob.core.windows.net/nupkgs/icons/nuget.catalogreader.png
diff --git a/src/NuGet.CatalogReader/CatalogPageEntry.cs b/src/NuGet.CatalogReader/CatalogPageEntry.cs
index 962311d..7afbd9b 100644
--- a/src/NuGet.CatalogReader/CatalogPageEntry.cs
+++ b/src/NuGet.CatalogReader/CatalogPageEntry.cs
@@ -60,7 +60,7 @@ public int CompareTo(CatalogPageEntry? other)
{
if (other == null)
{
- return -1;
+ return 1;
}
return CommitTimeStamp.CompareTo(other.CommitTimeStamp);
diff --git a/src/NuGet.CatalogReader/FeedReader/PackageEntry.cs b/src/NuGet.CatalogReader/FeedReader/PackageEntry.cs
index 4ba09d6..52d781a 100644
--- a/src/NuGet.CatalogReader/FeedReader/PackageEntry.cs
+++ b/src/NuGet.CatalogReader/FeedReader/PackageEntry.cs
@@ -297,7 +297,7 @@ public int CompareTo(PackageEntry? other)
{
if (other == null)
{
- return -1;
+ return 1;
}
var result = StringComparer.OrdinalIgnoreCase.Compare(Id, other.Id);
diff --git a/src/NuGet.CatalogReader/ProcessEntriesUtility.cs b/src/NuGet.CatalogReader/ProcessEntriesUtility.cs
index cf8ddea..952999b 100644
--- a/src/NuGet.CatalogReader/ProcessEntriesUtility.cs
+++ b/src/NuGet.CatalogReader/ProcessEntriesUtility.cs
@@ -18,13 +18,21 @@ public static Task> DownloadNuspecsAsync(string outputDi
throw new InvalidOperationException("Duplicate entries detected. Entries must be unique by id/version.");
}
- return RunAsync(
+ return RunAsyncCore(
apply: e => e.DownloadNuspecAsync(outputDirectory, mode, token),
maxThreads: maxConcurrentDownloads,
entries: entriesArray,
token: token);
}
+ [Obsolete("Use the overload with CancellationToken as the last parameter.")]
+#pragma warning disable CA1068 // CancellationToken parameters must come last
+ public static Task> DownloadNuspecsAsync(string outputDirectory, DownloadMode mode, int maxConcurrentDownloads, CancellationToken token, IEnumerable entries)
+#pragma warning restore CA1068
+ {
+ return DownloadNuspecsAsync(outputDirectory, mode, maxConcurrentDownloads, entries, token);
+ }
+
public static Task> DownloadNupkgsAsync(string outputDirectory, DownloadMode mode, int maxConcurrentDownloads, IEnumerable entries, CancellationToken token)
{
var entriesArray = entries.ToArray();
@@ -34,13 +42,21 @@ public static Task> DownloadNupkgsAsync(string outputDir
throw new InvalidOperationException("Duplicate entries detected. Entries must be unique by id/version.");
}
- return RunAsync(
+ return RunAsyncCore(
apply: e => e.DownloadNupkgAsync(outputDirectory, mode, token),
maxThreads: maxConcurrentDownloads,
entries: entriesArray,
token: token);
}
+ [Obsolete("Use the overload with CancellationToken as the last parameter.")]
+#pragma warning disable CA1068 // CancellationToken parameters must come last
+ public static Task> DownloadNupkgsAsync(string outputDirectory, DownloadMode mode, int maxConcurrentDownloads, CancellationToken token, IEnumerable entries)
+#pragma warning restore CA1068
+ {
+ return DownloadNupkgsAsync(outputDirectory, mode, maxConcurrentDownloads, entries, token);
+ }
+
///
/// Filter entry list to only the latest version of a package.
///
@@ -57,10 +73,33 @@ public static CatalogEntry[] FilterToLatestPerId(bool includePrerelease, IEnumer
///
/// Apply an async transform to each entry with throttled concurrency.
///
- ///
+ /// Result type of the transform.
/// Transform or action to apply to each catalog entry.
/// Max threads
- public static async Task> RunAsync(Func> apply, int maxThreads, IEnumerable entries, CancellationToken token)
+ /// Catalog entries to process.
+ /// Cancellation token.
+ public static Task> RunAsync(Func> apply, int maxThreads, IEnumerable entries, CancellationToken token)
+ {
+ return RunAsyncCore(apply, maxThreads, entries, token);
+ }
+
+ ///
+ /// Apply an async transform to each entry with throttled concurrency.
+ ///
+ /// Result type of the transform.
+ /// Transform or action to apply to each catalog entry.
+ /// Max threads
+ /// Cancellation token.
+ /// Catalog entries to process.
+ [Obsolete("Use the overload with CancellationToken as the last parameter.")]
+#pragma warning disable CA1068 // CancellationToken parameters must come last
+ public static Task> RunAsync(Func> apply, int maxThreads, CancellationToken token, IEnumerable entries)
+#pragma warning restore CA1068
+ {
+ return RunAsyncCore(apply, maxThreads, entries, token);
+ }
+
+ private static async Task> RunAsyncCore(Func> apply, int maxThreads, IEnumerable entries, CancellationToken token)
{
var entriesArray = entries.ToArray();