/// <summary> /// Returns the packages that are installed. This method is called when a user type get-package, install-package and uninstall-package. /// </summary> /// <param name="name">the package name to match. Empty or null means match everything</param> /// <param name="requiredVersion">the specific version asked for. If this parameter is specified (ie, not null or empty string) then the minimum and maximum values are ignored</param> /// <param name="minimumVersion">the minimum version of packages to return . If the <code>requiredVersion</code> parameter is specified (ie, not null or empty string) this should be ignored</param> /// <param name="maximumVersion">the maximum version of packages to return . If the <code>requiredVersion</code> parameter is specified (ie, not null or empty string) this should be ignored</param> /// <param name="request">An object passed in from the PackageManagement that contains functions that can be used to interact with its Provider</param> public void GetInstalledPackages(string name, string requiredVersion, string minimumVersion, string maximumVersion, NuGetRequest request) { if (request == null) { throw new ArgumentNullException("request"); } request.Debug(Resources.Messages.DebugInfoCallMethod, PackageProviderName, string.Format(CultureInfo.InvariantCulture, "GetInstalledPackages' - name='{0}', requiredVersion='{1}',minimumVersion='{2}', maximumVersion='{3}'", name, requiredVersion, minimumVersion, maximumVersion)); // In the case of the package name is null or contains wildcards, error out if a user puts version info if (!String.IsNullOrWhiteSpace(requiredVersion) || !String.IsNullOrWhiteSpace(minimumVersion) || !String.IsNullOrWhiteSpace(maximumVersion)) { // A user provides the version info but missing name if (string.IsNullOrWhiteSpace(name)) { request.Warning(Constants.Messages.MissingRequiredParameter, "name"); return; } // A user provides the version info but the name containing wildcards if (WildcardPattern.ContainsWildcardCharacters(name)) { return; } } NormalizeVersion(request, ref requiredVersion, ref minimumVersion, ref maximumVersion); request.GetInstalledPackages(name, requiredVersion, minimumVersion, maximumVersion); }