Table of Contents

Class ZeroInstallClient

Namespace
ZeroInstall.Client
Assembly
ZeroInstall.Client.dll

Client for invoking Zero Install commands from within other applications.

public class ZeroInstallClient : IZeroInstallClient
Inheritance
ZeroInstallClient
Implements
Inherited Members

Constructors

ZeroInstallClient(IProcessLauncher, IProcessLauncher?)

Client for invoking Zero Install commands from within other applications.

public ZeroInstallClient(IProcessLauncher launcher, IProcessLauncher? guiLauncher = null)

Parameters

launcher IProcessLauncher

Used to launch 0install as a child process.

guiLauncher IProcessLauncher

Used to launch 0install-win as a child process.

ZeroInstallClient(string, string?)

Creates a new Zero Install client.

public ZeroInstallClient(string commandLine, string? guiCommandLine = null)

Parameters

commandLine string

The command-line used to launch 0install. Whitespace must be properly escaped.

guiCommandLine string

The optional command-line used to launch 0install-win. Whitespace must be properly escaped.

Properties

Detect

Creates a Zero Install client by detecting the location of 0install using environment variables or the Windows registry.

public static IZeroInstallClient Detect { get; }

Property Value

IZeroInstallClient

Methods

AuditAsync()

Checks that all implementations in the cache are undamaged.

public Task AuditAsync()

Returns

Task

Exceptions

IOException

0install could not be launched or reported a problem accessing the filesystem.

UnauthorizedAccessException

0install reported that access to a resource was denied.

OperationCanceledException

The user canceled the operation.

TemporarilyUnavailableException

0install is temporarily unavailable. Try again in a few seconds.

ExitCodeException

0install returned another error.

DownloadAsync(Requirements, bool)

Downloads a program and compatible versions of all of its dependencies.

public Task<Selections> DownloadAsync(Requirements requirements, bool refresh = false)

Parameters

requirements Requirements

The requirements describing the program.

refresh bool

Fetch fresh copies of all used feeds.

Returns

Task<Selections>

The downloaded implementations.

Exceptions

IOException

0install could not be launched or reported a problem accessing the filesystem.

UnauthorizedAccessException

0install reported that access to a resource was denied.

WebException

0install reported a problem downloading a file.

InvalidDataException

0install reported a problem parsing a file, an invalid signature or digest mismatch.

InvalidOperationException

0install reported a solver error.

OperationCanceledException

The user canceled the operation.

TemporarilyUnavailableException

0install is temporarily unavailable. Try again in a few seconds.

ExitCodeException

0install returned another error.

FetchAsync(Implementation)

Downloads a set of Implementations.

public Task FetchAsync(Implementation implementation)

Parameters

implementation Implementation

The implementations to download.

Returns

Task

Exceptions

IOException

0install could not be launched or reported a problem accessing the filesystem.

UnauthorizedAccessException

0install reported that access to a resource was denied.

WebException

0install reported a problem downloading a file.

InvalidDataException

0install reported a problem parsing a file, an invalid signature or digest mismatch.

OperationCanceledException

The user canceled the operation.

TemporarilyUnavailableException

0install is temporarily unavailable. Try again in a few seconds.

ExitCodeException

0install returned another error.

GetIntegration(FeedUri, bool)

Returns the desktop integration categories that are currently applied for a specific feed.

public ISet<string> GetIntegration(FeedUri uri, bool machineWide = false)

Parameters

uri FeedUri

The feed URI of the application.

machineWide bool

Get machine-wide desktop integration instead of just for the current user.

Returns

ISet<string>

The access point categories (e.g., capability-registration, menu-entry, desktop-icon).

Exceptions

IOException

0install could not be launched or reported a problem accessing the filesystem.

UnauthorizedAccessException

0install reported that access to a resource was denied.

OperationCanceledException

The user canceled the operation.

TemporarilyUnavailableException

0install is temporarily unavailable. Try again in a few seconds.

ExitCodeException

0install returned another error.

GetRunStartInfo(Requirements, bool, bool, params string[])

Provides a ProcessStartInfo for running a program via Zero Install. This allows you to wait for the program to exit and/or to capture its output.

public ProcessStartInfo GetRunStartInfo(Requirements requirements, bool refresh = false, bool needsTerminal = false, params string[] arguments)

Parameters

requirements Requirements

The requirements describing the program.

refresh bool

Fetch fresh copies of all used feeds.

needsTerminal bool

Indicates that the program requires a terminal in order to run.

arguments string[]

Additional arguments to pass to the program.

Returns

ProcessStartInfo

IntegrateAsync(FeedUri, IEnumerable<string>?, IEnumerable<string>?, bool)

Adds an application to the application list (if missing) and integrates it into the desktop environment.

public Task IntegrateAsync(FeedUri uri, IEnumerable<string>? add = null, IEnumerable<string>? remove = null, bool machineWide = false)

Parameters

uri FeedUri

The feed URI of the application.

add IEnumerable<string>

The access point categories to add (e.g., capability-registration, menu-entry, desktop-icon).

remove IEnumerable<string>

The access point categories to remove (e.g., capability-registration, menu-entry, desktop-icon).

machineWide bool

Apply the operation machine-wide instead of just for the current user.

Returns

Task

Exceptions

NotAdminException

machineWide was set but the current process is not running with admin rights.

IOException

0install could not be launched or reported a problem accessing the filesystem.

UnauthorizedAccessException

0install reported that access to a resource was denied.

WebException

0install reported a problem downloading a file.

InvalidDataException

0install reported a problem parsing a file or an invalid signature.

InvalidOperationException

0install reported a conflict with existing desktop integration.

OperationCanceledException

The user canceled the operation.

TemporarilyUnavailableException

0install is temporarily unavailable. Try again in a few seconds.

ExitCodeException

0install returned another error.

Remove(FeedUri, bool)

Removes an application from the application list and undoes any desktop environment integration.

public void Remove(FeedUri uri, bool machineWide = false)

Parameters

uri FeedUri

The feed URI of the application.

machineWide bool

Apply the operation machine-wide instead of just for the current user.

Exceptions

NotAdminException

machineWide was set but the current process is not running with admin rights.

IOException

0install could not be launched or reported a problem accessing the filesystem.

UnauthorizedAccessException

0install reported that access to a resource was denied.

OperationCanceledException

The user canceled the operation.

TemporarilyUnavailableException

0install is temporarily unavailable. Try again in a few seconds.

ExitCodeException

0install returned another error.

Run(Requirements, bool, bool, params string[])

Runs a program via Zero Install. Does not wait for the program to exit.

public void Run(Requirements requirements, bool refresh = false, bool needsTerminal = false, params string[] arguments)

Parameters

requirements Requirements

The requirements describing the program.

refresh bool

Fetch fresh copies of all used feeds.

needsTerminal bool

Indicates that the program requires a terminal in order to run.

arguments string[]

Additional arguments to pass to the program.

Exceptions

IOException

0install could not be launched or reported a problem accessing the filesystem.

UnauthorizedAccessException

0install reported that access to a resource was denied.

WebException

0install reported a problem downloading a file.

InvalidDataException

0install reported a problem parsing a file, an invalid signature or digest mismatch.

InvalidOperationException

0install reported a solver or executor error.

OperationCanceledException

The user canceled the operation.

TemporarilyUnavailableException

0install is temporarily unavailable. Try again in a few seconds.

ExitCodeException

0install or the target program returned an error.

SelectAsync(Requirements, bool, bool)

Selects a program and compatible versions of all of its dependencies.

public Task<Selections> SelectAsync(Requirements requirements, bool refresh = false, bool offline = false)

Parameters

requirements Requirements

The requirements describing the program.

refresh bool

Fetch fresh copies of all used feeds.

offline bool

Do not refresh feeds even if they are out-of-date and don't select newer versions of programs for downloading even if they are already known.

Returns

Task<Selections>

The selected implementations.

Exceptions

IOException

0install could not be launched or reported a problem accessing the filesystem.

UnauthorizedAccessException

0install reported that access to a resource was denied.

WebException

0install reported a problem downloading a file.

InvalidDataException

0install reported a problem parsing a file or an invalid signature.

InvalidOperationException

0install reported a solver error.

OperationCanceledException

The user canceled the operation.

TemporarilyUnavailableException

0install is temporarily unavailable. Try again in a few seconds.

ExitCodeException

0install returned another error.

TrustKey(string, string)

Trusts feeds from a specific domain when signed with a specific key.

public void TrustKey(string fingerprint, string domain)

Parameters

fingerprint string

The fingerprint of the key to trust.

domain string

The domain the key should be trusted for.

UpdateAsync(Requirements)

Checks for updates to a program and downloads them if found.

public Task<bool> UpdateAsync(Requirements requirements)

Parameters

requirements Requirements

The requirements describing the program.

Returns

Task<bool>

true if updates where found and downloaded; false if no updates where found.

Exceptions

IOException

0install could not be launched or reported a problem accessing the filesystem.

UnauthorizedAccessException

0install reported that access to a resource was denied.

WebException

0install reported a problem downloading a file.

InvalidDataException

0install reported a problem parsing a file, an invalid signature or digest mismatch.

InvalidOperationException

0install reported a solver error.

OperationCanceledException

The user canceled the operation.

TemporarilyUnavailableException

0install is temporarily unavailable. Try again in a few seconds.

ExitCodeException

0install returned another error.