C# Класс Microsoft.PackageManagement.NuGetProvider.NuGetProvider

Given the overlap between how NuGet and Chcolatey work, it seemed prudent to combine these in one Assembly. The common code between the two providers is in this base class.
Показать файл Открыть проект

Открытые методы

Метод Описание
AddPackageSource ( string name, string location, bool trusted, NuGetRequest request ) : void

This is called when the user is adding (or updating) a package source If this PROVIDER doesn't support user-defined package sources, remove this method.

DownloadPackage ( string fastPackageReference, string destLocation, NuGetRequest request ) : void

Downloads a remote package file to a local location.

FindPackage ( string name, string requiredVersion, string minimumVersion, string maximumVersion, int id, NuGetRequest request ) : void

Searches package sources given name and version information Package information must be returned using request.YieldPackage(...) function.

FindPackageByFile ( string file, int id, NuGetRequest request ) : void

Finds packages given a locally-accessible filename Package information must be returned using request.YieldPackage(...) function.

GetDynamicOptions ( string category, Request request ) : void

Returns dynamic option definitions to the HOST example response: request.YieldDynamicOption( "MySwitch", OptionType.String.ToString(), false);

GetFeatures ( Request request ) : void

Returns a collection of strings to the client advertizing features this provider supports.

GetInstalledPackages ( string name, string requiredVersion, string minimumVersion, string maximumVersion, NuGetRequest request ) : void

Returns the packages that are installed. This method is called when a user type get-package, install-package and uninstall-package.

InitializeProvider ( NuGetRequest request ) : void

Performs one-time initialization of the $provider.

InstallPackage ( string fastPackageReference, NuGetRequest request ) : void

Installs a given package.

OnUnhandledException ( string methodName, Exception exception ) : void

This is just here as to give us some possibility of knowing when an unexception happens... At the very least, we'll write it to the system debug channel, so a developer can find it if they are looking for it.

RemovePackageSource ( string name, NuGetRequest request ) : void

Removes/Unregisters a package source

ResolvePackageSources ( NuGetRequest request ) : void

Resolves and returns Package Sources to the client. Specified sources are passed in via the request object (request.GetSources()). Sources are returned using request.YieldPackageSource(...)

UninstallPackage ( string fastPackageReference, NuGetRequest request ) : void

Uninstalls a package

Приватные методы

Метод Описание
IsNameMatch ( string packageName, string filePath ) : bool

True, if the package matches.

NormalizeVersion ( NuGetRequest request, string &requiredVersion, string &minimumVersion, string &maximumVersion ) : void

Описание методов

AddPackageSource() публичный Метод

This is called when the user is adding (or updating) a package source If this PROVIDER doesn't support user-defined package sources, remove this method.
public AddPackageSource ( string name, string location, bool trusted, NuGetRequest request ) : void
name string The name of the package source. If this parameter is null or empty the PROVIDER should use the location as the name (if the PROVIDER actually stores names of package sources)
location string The location (ie, directory, URL, etc) of the package source. If this is null or empty, the PROVIDER should use the name as the location (if valid)
trusted bool A boolean indicating that the user trusts this package source. Packages returned from this source should be marked as 'trusted'
request NuGetRequest An object passed in from the PackageManagement that contains functions that can be used to interact with its Provider
Результат void

DownloadPackage() публичный Метод

Downloads a remote package file to a local location.
public DownloadPackage ( string fastPackageReference, string destLocation, NuGetRequest request ) : void
fastPackageReference string
destLocation string
request NuGetRequest An object passed in from the PackageManagement that contains functions that can be used to interact with its Provider
Результат void

FindPackage() публичный Метод

Searches package sources given name and version information Package information must be returned using request.YieldPackage(...) function.
public FindPackage ( string name, string requiredVersion, string minimumVersion, string maximumVersion, int id, NuGetRequest request ) : void
name string a name or partial name of the package(s) requested
requiredVersion string A specific version of the package. Null or empty if the user did not specify
minimumVersion string A minimum version of the package. Null or empty if the user did not specify
maximumVersion string A maximum version of the package. Null or empty if the user did not specify
id int if this is greater than zero (and the number should have been generated using StartFind(...), the core is calling this multiple times to do a batch search request. The operation can be delayed until CompleteFind(...) is called
request NuGetRequest An object passed in from the PackageManagement that contains functions that can be used to interact with its Provider
Результат void

FindPackageByFile() публичный Метод

Finds packages given a locally-accessible filename Package information must be returned using request.YieldPackage(...) function.
public FindPackageByFile ( string file, int id, NuGetRequest request ) : void
file string the full path to the file to determine if it is a package
id int if this is greater than zero (and the number should have been generated using StartFind(...), the core is calling this multiple times to do a batch search request. The operation can be delayed until CompleteFind(...) is called
request NuGetRequest An object passed in from the PackageManagement that contains functions that can be used to interact with its Provider
Результат void

GetDynamicOptions() публичный Метод

Returns dynamic option definitions to the HOST example response: request.YieldDynamicOption( "MySwitch", OptionType.String.ToString(), false);
public GetDynamicOptions ( string category, Request request ) : void
category string The category of dynamic options that the HOST is interested in
request Request An object passed in from the PackageManagement that contains functions that can be used to interact with its Provider
Результат void

GetFeatures() публичный Метод

Returns a collection of strings to the client advertizing features this provider supports.
public GetFeatures ( Request request ) : void
request Request An object passed in from the PackageManagement that contains functions that can be used to interact with its Provider
Результат void

GetInstalledPackages() публичный Метод

Returns the packages that are installed. This method is called when a user type get-package, install-package and uninstall-package.
public GetInstalledPackages ( string name, string requiredVersion, string minimumVersion, string maximumVersion, NuGetRequest request ) : void
name string the package name to match. Empty or null means match everything
requiredVersion string the specific version asked for. If this parameter is specified (ie, not null or empty string) then the minimum and maximum values are ignored
minimumVersion string the minimum version of packages to return . If the requiredVersion parameter is specified (ie, not null or empty string) this should be ignored
maximumVersion string the maximum version of packages to return . If the requiredVersion parameter is specified (ie, not null or empty string) this should be ignored
request NuGetRequest An object passed in from the PackageManagement that contains functions that can be used to interact with its Provider
Результат void

InitializeProvider() публичный Метод

Performs one-time initialization of the $provider.
public InitializeProvider ( NuGetRequest request ) : void
request NuGetRequest An object passed in from the CORE that contains functions that can be used to interact with the CORE and HOST
Результат void

InstallPackage() публичный Метод

Installs a given package.
public InstallPackage ( string fastPackageReference, NuGetRequest request ) : void
fastPackageReference string A provider supplied identifier that specifies an exact package
request NuGetRequest An object passed in from the PackageManagement that contains functions that can be used to interact with its Provider
Результат void

OnUnhandledException() публичный Метод

This is just here as to give us some possibility of knowing when an unexception happens... At the very least, we'll write it to the system debug channel, so a developer can find it if they are looking for it.
public OnUnhandledException ( string methodName, Exception exception ) : void
methodName string
exception System.Exception
Результат void

RemovePackageSource() публичный Метод

Removes/Unregisters a package source
public RemovePackageSource ( string name, NuGetRequest request ) : void
name string The name or location of a package source to remove.
request NuGetRequest An object passed in from the PackageManagement that contains functions that can be used to interact with its Provider
Результат void

ResolvePackageSources() публичный Метод

Resolves and returns Package Sources to the client. Specified sources are passed in via the request object (request.GetSources()). Sources are returned using request.YieldPackageSource(...)
public ResolvePackageSources ( NuGetRequest request ) : void
request NuGetRequest An object passed in from the PackageManagement that contains functions that can be used to interact with its Provider
Результат void

UninstallPackage() публичный Метод

Uninstalls a package
public UninstallPackage ( string fastPackageReference, NuGetRequest request ) : void
fastPackageReference string
request NuGetRequest An object passed in from the PackageManagement that contains functions that can be used to interact with its Provider
Результат void