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); }
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 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)); }