public static string GenerateBackgroundColor(IEnumerable<PackageViewModel> packages, PackageViewModel package, IColorConfiguration colors)
        {
            if (VersionMismatch(package))
            {
                return colors.VersionMismatchPackageColor;
            }

            if (HasSamePackageInDifferentVersion(packages, package))
            {
                return colors.PackageHasDifferentVersionsColor;
            }

            return colors.DefaultColor;
        }
        private static string DependencyNodeId(DependencyViewModel dep, IEnumerable <PackageViewModel> packages)
        {
            string targetId = dep.GraphId();

            // If version on dep is not explicitly stated, we should use an existing package with same nuget id.
            // This greatly minimizes the number of disconnected nodes.
            if (string.IsNullOrWhiteSpace(dep.Version))
            {
                PackageViewModel existingModel = packages.FirstOrDefault(x => x.NugetId == dep.NugetId);
                if (existingModel != null)
                {
                    targetId = existingModel.GraphId();
                }
            }
            return(targetId);
        }
 private static bool VersionMismatch(PackageViewModel package)
 {
     return package.LocalVersion != package.RemoteVersion;
 }
 private static bool HasSamePackageInDifferentVersion(IEnumerable<PackageViewModel> packages, PackageViewModel package)
 {
     return packages.Any(p => p.NugetId == package.NugetId && p.LocalVersion != package.LocalVersion);
 }
Beispiel #5
0
        public static string GenerateBackgroundColor(IEnumerable <PackageViewModel> packages, PackageViewModel package, IColorConfiguration colors)
        {
            if (VersionMismatch(package))
            {
                return(colors.VersionMismatchPackageColor);
            }

            if (HasSamePackageInDifferentVersion(packages, package))
            {
                return(colors.PackageHasDifferentVersionsColor);
            }

            return(colors.DefaultColor);
        }
Beispiel #6
0
 private static bool VersionMismatch(PackageViewModel package)
 {
     return(package.LocalVersion != package.RemoteVersion);
 }
Beispiel #7
0
 private static bool HasSamePackageInDifferentVersion(IEnumerable <PackageViewModel> packages, PackageViewModel package)
 {
     return(packages.Any(p => p.NugetId == package.NugetId && p.LocalVersion != package.LocalVersion));
 }