C# Класс ChocoPM.Services.LocalChocolateyService

Наследование: ObservableBase, ILocalChocolateyService
Показать файл Открыть проект

Private Properties

Свойство Тип Описание
RefreshPackages void
WriteError void
WriteOutput void

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

Метод Описание
ExecutePackageCommand ( string commandString, bool refreshPackages = true ) : Task

Executes a PowerShell command and returns whether or not there was a result. Optionally calls RefreshPackages.

GetPackages ( bool logOutput = false ) : Task>

Retrives all the local packages.

InstallPackageAsync ( string id, string version = null ) : Task

Install the specific package. Optionally installs a specific version of the package.

IsInstalled ( string id, string version ) : bool

Checks wether the specified package is installed.

This method will only return true if: A) We've already retrieved the local packages and cached them. B) The package is found in the cache. This is to ensure that we're not pulling the local package list until the App specifically request it.

LocalChocolateyService ( IRemoteChocolateyService remoteService ) : System.Collections.ObjectModel
RunPackageCommand ( string commandString, bool refreshPackages = true, bool logOutput = true, bool clearBuffer = true ) : Task>

Executes a PowerShell Command.

UninstallPackageAsync ( string id, string version ) : Task

Uninstall the specified package.

UpdatePackageAsync ( string id ) : Task

Updates the installed package.

Chocolatey does not currently support updating an installed package to a specific version. There's a way to do this (basically uninstall and install specific version), but it's complex and error prone enough that we're avoiding it for now.

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

Метод Описание
RefreshPackages ( bool logOutput = false ) : void

Invalidates and refreshes the cache.

WriteError ( string message ) : void

Helper function to write error messages to the faux PowerShell console.

WriteOutput ( string message ) : void

Helper function to write output messages to the faux PowerShell console.

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

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

Executes a PowerShell command and returns whether or not there was a result. Optionally calls RefreshPackages.
public ExecutePackageCommand ( string commandString, bool refreshPackages = true ) : Task
commandString string The PowerShell command string.
refreshPackages bool Whether to call .
Результат Task

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

Retrives all the local packages.
public GetPackages ( bool logOutput = false ) : Task>
logOutput bool If true, writes messages out to the faux PowerShell console.
Результат Task>

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

Install the specific package. Optionally installs a specific version of the package.
public InstallPackageAsync ( string id, string version = null ) : Task
id string The Id of the package to be isntalled.
version string The specific Version string of the package to be installed.
Результат Task

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

Checks wether the specified package is installed.
This method will only return true if: A) We've already retrieved the local packages and cached them. B) The package is found in the cache. This is to ensure that we're not pulling the local package list until the App specifically request it.
public IsInstalled ( string id, string version ) : bool
id string The Id of the package.
version string The Version string of the package.
Результат bool

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

public LocalChocolateyService ( IRemoteChocolateyService remoteService ) : System.Collections.ObjectModel
remoteService IRemoteChocolateyService
Результат System.Collections.ObjectModel

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

Executes a PowerShell Command.
public RunPackageCommand ( string commandString, bool refreshPackages = true, bool logOutput = true, bool clearBuffer = true ) : Task>
commandString string The PowerShell command string.
refreshPackages bool Whether to call .
logOutput bool Whether the output should be logged to the faux PowerShell console or returned as results.
clearBuffer bool Whether the faux PowerShell console should be cleared.
Результат Task>

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

Uninstall the specified package.
public UninstallPackageAsync ( string id, string version ) : Task
id string The Id of the package to be removed.
version string The Version string of the package to be removed.
Результат Task

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

Updates the installed package.
Chocolatey does not currently support updating an installed package to a specific version. There's a way to do this (basically uninstall and install specific version), but it's complex and error prone enough that we're avoiding it for now.
public UpdatePackageAsync ( string id ) : Task
id string The Id of the package.
Результат Task