コード例 #1
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;
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 private static bool VersionMismatch(PackageViewModel package)
 {
     return package.LocalVersion != package.RemoteVersion;
 }
コード例 #4
0
 private static bool HasSamePackageInDifferentVersion(IEnumerable<PackageViewModel> packages, PackageViewModel package)
 {
     return packages.Any(p => p.NugetId == package.NugetId && p.LocalVersion != package.LocalVersion);
 }
コード例 #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);
        }
コード例 #6
0
 private static bool VersionMismatch(PackageViewModel package)
 {
     return(package.LocalVersion != package.RemoteVersion);
 }
コード例 #7
0
 private static bool HasSamePackageInDifferentVersion(IEnumerable <PackageViewModel> packages, PackageViewModel package)
 {
     return(packages.Any(p => p.NugetId == package.NugetId && p.LocalVersion != package.LocalVersion));
 }