public static bool IsExactVersion(VersionConstraints versionConstraints) { return (versionConstraints.HasFlag(VersionConstraints.ExactMajor) && versionConstraints.HasFlag(VersionConstraints.ExactMinor) && versionConstraints.HasFlag(VersionConstraints.ExactPatch) && versionConstraints.HasFlag(VersionConstraints.ExactRelease)); }
private static bool MeetsVersionConstraints(NuGetVersion newVersion, NuGetVersion existingVersion, VersionConstraints versionConstraints) { return ((!versionConstraints.HasFlag(VersionConstraints.ExactMajor) || newVersion.Major == existingVersion.Major) && (!versionConstraints.HasFlag(VersionConstraints.ExactMinor) || newVersion.Minor == existingVersion.Minor) && (!versionConstraints.HasFlag(VersionConstraints.ExactPatch) || newVersion.Patch == existingVersion.Patch) && (!versionConstraints.HasFlag(VersionConstraints.ExactRelease) || newVersion.Release.Equals(existingVersion.Release, StringComparison.OrdinalIgnoreCase))); }