builds
This commit is contained in:
parent
ca079e1c47
commit
6f79be26d8
33 changed files with 554 additions and 369 deletions
|
|
@ -7,34 +7,28 @@ using NuGet.Versioning;
|
|||
|
||||
namespace isnd.Data.Catalog
|
||||
{
|
||||
public class RegistrationPage
|
||||
public class RegistrationPage : HappyIdOwner
|
||||
{
|
||||
[JsonProperty("@id")]
|
||||
[JsonRequired]
|
||||
public string Id { get; protected set;}
|
||||
|
||||
public string Id { get => GetId(); }
|
||||
private readonly string pkgid;
|
||||
private readonly List<PackageVersion> items;
|
||||
|
||||
protected string Bid { get ; private set; }
|
||||
protected string DlBase { get; }
|
||||
protected string ExternalUrl { get; }
|
||||
|
||||
public RegistrationPage (string bid, string dlBase)
|
||||
{
|
||||
Bid = bid;
|
||||
DlBase = dlBase;
|
||||
this.items = new List<PackageVersion>();
|
||||
}
|
||||
|
||||
public RegistrationPage (string bid, string pkgid, string dlBase, IEnumerable<PackageVersion> items)
|
||||
public RegistrationPage (string bid, string pkgid, string extUrl) : base(bid + "/" + pkgid + "/index.json")
|
||||
{
|
||||
Bid = bid;
|
||||
Parent = Bid + $"/{pkgid}/index.json";
|
||||
DlBase = dlBase;
|
||||
ExternalUrl = extUrl;
|
||||
this.items = new List<PackageVersion>();
|
||||
this.Id = Bid + "/" + pkgid + "/index.json";
|
||||
this.pkgid = pkgid;
|
||||
AddVersionRange(items);
|
||||
}
|
||||
|
||||
public RegistrationPage(string bid, string pkgid, string extUrl, List<PackageVersion> versions) : this(bid, pkgid, extUrl)
|
||||
{
|
||||
AddVersionRange(versions);
|
||||
}
|
||||
|
||||
public string GetPackageId()
|
||||
|
|
@ -43,12 +37,12 @@ namespace isnd.Data.Catalog
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// no The array of registration leaves and their associate metadata
|
||||
/// The array of registration leaves and their associate metadata
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[JsonProperty("items")]
|
||||
|
||||
public RegistrationLeaf[] Items { get => items.Select((p) => p.ToLeave(Bid, DlBase)).ToArray(); }
|
||||
public CatalogEntry[] Items { get => items.Select((p) => p.ToLeave(Bid, ExternalUrl)).ToArray(); }
|
||||
|
||||
public void AddVersionRange(IEnumerable<PackageVersion> vitems)
|
||||
{
|
||||
|
|
@ -62,11 +56,15 @@ namespace isnd.Data.Catalog
|
|||
long commitMax = 0;
|
||||
foreach (var p in vitems)
|
||||
{
|
||||
if (items.Contains(p))
|
||||
continue;
|
||||
if (upper == null || upper < p.NugetVersion) upper = p.NugetVersion;
|
||||
if (lower == null || lower > p.NugetVersion) lower = p.NugetVersion;
|
||||
if (p.CommitNId> commitMax) commitMax = p.CommitNId;
|
||||
if (items.Contains(p)) continue;
|
||||
|
||||
if (upper == null) upper = p.NugetVersion;
|
||||
else if ( upper < p.NugetVersion) upper = p.NugetVersion;
|
||||
|
||||
if (lower == null) lower = p.NugetVersion;
|
||||
else if (lower > p.NugetVersion) lower = p.NugetVersion;
|
||||
|
||||
if (p.CommitNId > commitMax) commitMax = p.CommitNId;
|
||||
items.Add(p);
|
||||
}
|
||||
Upper = upper.ToFullString();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue