Show / Hide Table of Contents

Class ZeroInstallClient

Client for invoking Zero Install commands from within other applications.

Inheritance
Object
ZeroInstallClient
Implements
IZeroInstallClient
Namespace: ZeroInstall.Client
Assembly: ZeroInstall.Client.dll
Syntax
public class ZeroInstallClient : Object, IZeroInstallClient

Constructors

ZeroInstallClient(String, String)

Creates a new Zero Install client.

Declaration
public ZeroInstallClient(string commandLine, string guiCommandLine = null)
Parameters
Type Name Description
String commandLine

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

String guiCommandLine

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.

Declaration
public static IZeroInstallClient Detect { get; }
Property Value
Type Description
IZeroInstallClient

Methods

DownloadAsync(Requirements, Boolean)

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

Declaration
public Task<Selections> DownloadAsync(Requirements requirements, bool refresh = false)
Parameters
Type Name Description
Requirements requirements

The requirements describing the program.

Boolean refresh

Fetch fresh copies of all used feeds.

Returns
Type Description
Task<Selections>

The downloaded implementations.

Exceptions
Type Condition
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.

Declaration
public Task FetchAsync(Implementation implementation)
Parameters
Type Name Description
Implementation implementation

The implementations to download.

Returns
Type Description
Task
Exceptions
Type Condition
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, Boolean)

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

Declaration
public ISet<string> GetIntegration(FeedUri uri, bool machineWide = false)
Parameters
Type Name Description
FeedUri uri

The feed URI of the application.

Boolean machineWide

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

Returns
Type Description
ISet<String>

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

Exceptions
Type Condition
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, Boolean, Boolean, 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.

Declaration
public ProcessStartInfo GetRunStartInfo(Requirements requirements, bool refresh = false, bool needsTerminal = false, params string[] arguments)
Parameters
Type Name Description
Requirements requirements

The requirements describing the program.

Boolean refresh

Fetch fresh copies of all used feeds.

Boolean needsTerminal

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

String[] arguments

Additional arguments to pass to the program.

Returns
Type Description
ProcessStartInfo

IntegrateAsync(FeedUri, IEnumerable<String>, IEnumerable<String>, Boolean)

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

Declaration
public Task IntegrateAsync(FeedUri uri, IEnumerable<string> add = null, IEnumerable<string> remove = null, bool machineWide = false)
Parameters
Type Name Description
FeedUri uri

The feed URI of the application.

IEnumerable<String> add

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

IEnumerable<String> remove

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

Boolean machineWide

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

Returns
Type Description
Task
Exceptions
Type Condition
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, Boolean)

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

Declaration
public void Remove(FeedUri uri, bool machineWide = false)
Parameters
Type Name Description
FeedUri uri

The feed URI of the application.

Boolean machineWide

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

Exceptions
Type Condition
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, Boolean, Boolean, String[])

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

Declaration
public void Run(Requirements requirements, bool refresh = false, bool needsTerminal = false, params string[] arguments)
Parameters
Type Name Description
Requirements requirements

The requirements describing the program.

Boolean refresh

Fetch fresh copies of all used feeds.

Boolean needsTerminal

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

String[] arguments

Additional arguments to pass to the program.

Exceptions
Type Condition
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, Boolean, Boolean)

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

Declaration
public Task<Selections> SelectAsync(Requirements requirements, bool refresh = false, bool offline = false)
Parameters
Type Name Description
Requirements requirements

The requirements describing the program.

Boolean refresh

Fetch fresh copies of all used feeds.

Boolean offline

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
Type Description
Task<Selections>

The selected implementations.

Exceptions
Type Condition
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.

Declaration
public void TrustKey(string fingerprint, string domain)
Parameters
Type Name Description
String fingerprint

The fingerprint of the key to trust.

String domain

The domain the key should be trusted for.

UpdateAsync(Requirements)

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

Declaration
public Task<bool> UpdateAsync(Requirements requirements)
Parameters
Type Name Description
Requirements requirements

The requirements describing the program.

Returns
Type Description
Task<Boolean>

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

Exceptions
Type Condition
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.

Implements

IZeroInstallClient
In This Article
Back to top Copyright Bastian Eicher et al