public PackageSet Clone() { var newSet = new PackageSet(); newSet.Index.UnionWith(Index); return(newSet); }
private async Task CreateIndexAsync(string id, PackageSet packageSet) { // Get all versions var packages = await packageSet.GetPackagesByIdAsync(id); var versions = new SortedSet <NuGetVersion>(packages.Select(e => e.Version)); await CreateIndexAsync(id, versions); }
private static PackageSet GetPackageSetFromJson(JObject packagesNode) { var result = new PackageSet(); foreach (var property in packagesNode.Properties()) { var versions = (JArray)property.Value; var id = property.Name; foreach (var versionEntry in versions) { var packageVersion = NuGetVersion.Parse(versionEntry.ToObject <string>()); result.Index.Add(new PackageIdentity(id, packageVersion)); } } return(result); }
private static JObject CreatePackageSetJson(PackageSet packages) { var json = new JObject(); var groups = packages.Index.GroupBy(e => e.Id, StringComparer.OrdinalIgnoreCase).ToList(); foreach (var group in groups.OrderBy(e => e.Key, StringComparer.OrdinalIgnoreCase)) { var versionArray = new JArray(group.OrderByDescending(e => e.Version) .Select(e => e.Version.ToFullString())); if (versionArray.Count > 0) { json.Add(group.Key, versionArray); } } return(json); }