public static bool Exists(this IPackageRepository repository, string packageId, SemanticVersion version) { IPackageLookup packageLookup = repository as IPackageLookup; if ((packageLookup != null) && !String.IsNullOrEmpty(packageId) && (version != null)) { return(packageLookup.Exists(packageId, version)); } return(repository.FindPackage(packageId, version) != null); }
/// <summary> /// Checks whether a package exists in the wrapped <see cref="IPackageRegistry"/> or <see cref="IPackageLookup"/>. /// </summary> /// <returns>True, if found; False, otherwise.</returns> public bool Exists(string packageId, SemanticVersion version) { return(_packageRegistry.Exists(packageId, version) || _packageLookup.Exists(packageId, version)); }
public static bool Exists(this IPackageRepository repository, string packageId, SemanticVersion version) { IPackageLookup lookup = repository as IPackageLookup; return(((lookup == null) || (string.IsNullOrEmpty(packageId) || (version == null))) ? (repository.FindPackage(packageId, version) != null) : lookup.Exists(packageId, version)); }