C# 클래스 NugetForUnity.NugetHelper

파일 보기 프로젝트 열기: GlitchEnzo/NuGetForUnity

공개 프로퍼티들

프로퍼티 타입 설명
NugetConfigFilePath string
PackOutputDirectory string

공개 메소드들

메소드 설명
DownloadImage ( string url ) : Texture2D

Downloads an image at the given URL and converts it to a Unity Texture2D.

GetInstalledPackages ( ) : List

Gets the list of packages that are actually installed in the project.

GetUpdates ( List packagesToUpdate, bool includePrerelease = false, bool includeAllVersions = false, string targetFrameworks = "", string versionContraints = "" ) : List

Queries the server with the given list of installed packages to get any updates that are available.

Install ( NugetPackage package, bool refreshAssets = true ) : void

Installs the given package.

LoadNugetConfigFile ( ) : void

Loads the NuGet.config file.

LogVerbose ( string format ) : void

Outputs the given message to the log only if verbose mode is active. Otherwise it does nothing.

Pack ( string nuspecFilePath ) : void

Calls "nuget.exe pack" to create a .nupkg file based on the given .nuspec file.

Push ( NuspecFile nuspec, string nuspecFilePath, string apiKey = "" ) : void

Calls "nuget.exe push" to push a .nupkf file to the the server location defined in the NuGet.config file. Note: This differs slightly from NuGet's Push command by automatically calling Pack if the .nupkg doesn't already exist.

Restore ( ) : void

Restores all packages defined in packages.config.

Search ( string searchTerm = "", bool includeAllVersions = false, bool includePrerelease = false, int numberToGet = 15, int numberToSkip ) : List

Gets a list of NuGetPackages via the HTTP Search() function defined by NuGet.Server and NuGet Gallery. This allows searching for partial IDs or even the empty string (the default) to list ALL packages. NOTE: See the functions and parameters defined here: https://www.nuget.org/api/v2/$metadata

Uninstall ( NugetPackageIdentifier package, bool refreshAssets = true ) : void

"Uninstalls" the given package by simply deleting its folder.

Update ( NugetPackageIdentifier currentVersion, NugetPackage newVersion, bool refreshAssets = true ) : void

Updates a package by uninstalling the currently installed version and installing the "new" version.

UpdateAll ( IEnumerable updates, List packagesToUpdate ) : void

Installs all of the given updates, and uninstalls the corresponding package that is already installed.

비공개 메소드들

메소드 설명
Clean ( NugetPackageIdentifier package ) : void

Cleans up a package after it has been installed. Since we are in Unity, we can make certain assumptions on which files will NOT be used, so we can delete them.

CopyStream ( Stream input, Stream output ) : void

Copies the contents of input to output. Doesn't close either stream.

DeleteAllFiles ( string directoryPath, string extension ) : void

Deletes all files in the given directory or in any sub-directory, with the given extension.

DeleteDirectory ( string directoryPath ) : void

Recursively deletes the folder at the given path. NOTE: Directory.Delete() doesn't delete Read-Only files, whereas this does.

DeleteFile ( string filePath ) : void

Deletes a file at the given filepath.

FixSpaces ( string directoryPath ) : void

Replace all %20 encodings with a normal space.

GetCachedPackage ( NugetPackageIdentifier packageId ) : NugetPackage

Tries to find an already cached package that matches (or is in the range of) the given package ID.

GetInstalledPackage ( NugetPackageIdentifier packageId ) : NugetPackage

Tries to find an already installed package that matches (or is in the range of) the given package ID.

GetOnlinePackage ( NugetPackageIdentifier packageId ) : NugetPackage

Tries to find an "online" (in the package sources - which could be local) package that matches (or is in the range of) the given package ID.

GetSpecificPackage ( NugetPackageIdentifier packageId ) : NugetPackage

Gets a NugetPackage from the NuGet server with the exact ID and Version given. If an exact match isn't found, it selects the next closest version available.

InstallIdentifier ( NugetPackageIdentifier package ) : void

Installs the package given by the identifer. It fetches the appropriate full package from the installed packages, package cache, or package sources and installs it.

IsInstalled ( NugetPackageIdentifier package ) : bool

Checks if a given package is installed.

NugetHelper ( ) : System

Static constructor used by Unity to initialize NuGet and restore packages defined in packages.config.

RunNugetProcess ( string arguments, bool logOuput = true ) : void

Runs nuget.exe using the given arguments.

메소드 상세

DownloadImage() 공개 정적인 메소드

Downloads an image at the given URL and converts it to a Unity Texture2D.
public static DownloadImage ( string url ) : Texture2D
url string The URL of the image to download.
리턴 UnityEngine.Texture2D

GetInstalledPackages() 공개 정적인 메소드

Gets the list of packages that are actually installed in the project.
public static GetInstalledPackages ( ) : List
리턴 List

GetUpdates() 공개 정적인 메소드

Queries the server with the given list of installed packages to get any updates that are available.
public static GetUpdates ( List packagesToUpdate, bool includePrerelease = false, bool includeAllVersions = false, string targetFrameworks = "", string versionContraints = "" ) : List
packagesToUpdate List The list of currently installed packages.
includePrerelease bool True to include prerelease packages (alpha, beta, etc).
includeAllVersions bool True to include older versions that are not the latest version.
targetFrameworks string The specific frameworks to target?
versionContraints string The version constraints?
리턴 List

Install() 공개 정적인 메소드

Installs the given package.
public static Install ( NugetPackage package, bool refreshAssets = true ) : void
package NugetPackage The package to install.
refreshAssets bool True to refresh the Unity asset database. False to ignore the changes (temporarily).
리턴 void

LoadNugetConfigFile() 공개 정적인 메소드

Loads the NuGet.config file.
public static LoadNugetConfigFile ( ) : void
리턴 void

LogVerbose() 공개 정적인 메소드

Outputs the given message to the log only if verbose mode is active. Otherwise it does nothing.
public static LogVerbose ( string format ) : void
format string The formatted message string.
리턴 void

Pack() 공개 정적인 메소드

Calls "nuget.exe pack" to create a .nupkg file based on the given .nuspec file.
public static Pack ( string nuspecFilePath ) : void
nuspecFilePath string The full filepath to the .nuspec file to use.
리턴 void

Push() 공개 정적인 메소드

Calls "nuget.exe push" to push a .nupkf file to the the server location defined in the NuGet.config file. Note: This differs slightly from NuGet's Push command by automatically calling Pack if the .nupkg doesn't already exist.
public static Push ( NuspecFile nuspec, string nuspecFilePath, string apiKey = "" ) : void
nuspec NuspecFile The NuspecFile which defines the package to push. Only the ID and Version are used.
nuspecFilePath string The full filepath to the .nuspec file to use. This is required by NuGet's Push command.
apiKey string The API key to use when pushing a package to the server. This is optional.
리턴 void

Restore() 공개 정적인 메소드

Restores all packages defined in packages.config.
public static Restore ( ) : void
리턴 void

Search() 공개 정적인 메소드

Gets a list of NuGetPackages via the HTTP Search() function defined by NuGet.Server and NuGet Gallery. This allows searching for partial IDs or even the empty string (the default) to list ALL packages. NOTE: See the functions and parameters defined here: https://www.nuget.org/api/v2/$metadata
public static Search ( string searchTerm = "", bool includeAllVersions = false, bool includePrerelease = false, int numberToGet = 15, int numberToSkip ) : List
searchTerm string The search term to use to filter packages. Defaults to the empty string.
includeAllVersions bool True to include older versions that are not the latest version.
includePrerelease bool True to include prerelease packages (alpha, beta, etc).
numberToGet int The number of packages to fetch.
numberToSkip int The number of packages to skip before fetching.
리턴 List

Uninstall() 공개 정적인 메소드

"Uninstalls" the given package by simply deleting its folder.
public static Uninstall ( NugetPackageIdentifier package, bool refreshAssets = true ) : void
package NugetPackageIdentifier The NugetPackage to uninstall.
refreshAssets bool True to force Unity to refesh its Assets folder. False to temporarily ignore the change. Defaults to true.
리턴 void

Update() 공개 정적인 메소드

Updates a package by uninstalling the currently installed version and installing the "new" version.
public static Update ( NugetPackageIdentifier currentVersion, NugetPackage newVersion, bool refreshAssets = true ) : void
currentVersion NugetPackageIdentifier The current package to uninstall.
newVersion NugetPackage The package to install.
refreshAssets bool True to refresh the assets inside Unity. False to ignore them (for now). Defaults to true.
리턴 void

UpdateAll() 공개 정적인 메소드

Installs all of the given updates, and uninstalls the corresponding package that is already installed.
public static UpdateAll ( IEnumerable updates, List packagesToUpdate ) : void
updates IEnumerable The list of all updates to install.
packagesToUpdate List The list of all packages currently installed.
리턴 void

프로퍼티 상세

NugetConfigFilePath 공개적으로 정적으로 프로퍼티

The path to the nuget.config file.
public static string NugetConfigFilePath
리턴 string

PackOutputDirectory 공개적으로 정적으로 프로퍼티

The path where to put created (packed) and downloaded (not installed yet) .nupkg files.
public static string PackOutputDirectory
리턴 string