Beispiel #1
0
        private void UpdateFromValues(PackageIndex index, string id, NuGetVersion version, IEnumerable <Version> assemblyVersions)
        {
            PackageInfo info = GetOrCreatePackageInfo(index, id);

            var packageVersion = VersionUtility.As3PartVersion(version.Version);

            // if we have a stable version, add it to the stable versions list
            if (!version.IsPrerelease)
            {
                info.StableVersions.Add(packageVersion);
            }

            if (assemblyVersions != null)
            {
                var assmVersions = new HashSet <Version>(assemblyVersions.Where(v => v != null));

                foreach (var assemblyVersion in assmVersions)
                {
                    info.AddAssemblyVersionInPackage(assemblyVersion, packageVersion);
                }

                // remove any assembly mappings which claim to be in this package version, but aren't in the assemblyList
                var orphanedAssemblyVersions = info.AssemblyVersionInPackageVersion
                                               .Where(pair => pair.Value == packageVersion && !assmVersions.Contains(pair.Key))
                                               .Select(pair => pair.Key)
                                               .ToArray();

                foreach (var orphanedAssemblyVersion in orphanedAssemblyVersions)
                {
                    info.AssemblyVersionInPackageVersion.Remove(orphanedAssemblyVersion);
                }
            }
        }
Beispiel #2
0
        private void UpdateFromValues(PackageIndex index, string id, NuGetVersion version, IEnumerable <Version> assemblyVersions)
        {
            PackageInfo info = GetOrCreatePackageInfo(index, id);

            var packageVersion = VersionUtility.As3PartVersion(version.Version);

            // if we have a stable version, add it to the stable versions list
            if (!version.IsPrerelease)
            {
                info.StableVersions.Add(packageVersion);
            }

            if (assemblyVersions != null)
            {
                foreach (var assemblyVersion in assemblyVersions.Where(v => v != null))
                {
                    info.AddAssemblyVersionInPackage(assemblyVersion, packageVersion);
                }
            }
        }