Table of Contents

Class IntegrationManager

Namespace
ZeroInstall.DesktopIntegration
Assembly
ZeroInstall.DesktopIntegration.dll

Manages an AppList and desktop integration via AccessPoints.

public class IntegrationManager : IntegrationManagerBase, IDisposable, IIntegrationManager
Inheritance
IntegrationManager
Implements
Derived
Inherited Members

Remarks

To prevent race-conditions there may only be one desktop integration class instance active at any given time. This class acquires a mutex upon calling its constructor and releases it upon calling Dispose().

Constructors

IntegrationManager(Config, ITaskHandler, bool)

Creates a new integration manager using the default AppList (creating a new one if missing). Performs Mutex-based locking!

public IntegrationManager(Config config, ITaskHandler handler, bool machineWide = false)

Parameters

config Config

User settings controlling network behaviour.

handler ITaskHandler

A callback object used when the the user is to be informed about the progress of long-running operations such as downloads.

machineWide bool

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

Exceptions

IOException

A problem occurred while accessing the AppList file.

UnauthorizedAccessException

Read or write access to the AppList file is not permitted or another desktop integration class is currently active.

InvalidDataException

A problem occurred while deserializing an XML file.

Fields

AppListPath

The storage location of the AppList file.

protected readonly string AppListPath

Field Value

string

ChangedWindowMessageID

The window message ID (for use with BroadcastMessage(int)) that signals integration changes to interested observers.

public static readonly int ChangedWindowMessageID

Field Value

int

Config

User settings controlling network behaviour.

protected readonly Config Config

Field Value

Config

Properties

MutexName

The name of the cross-process mutex used to signal that a desktop integration process class is currently active.

protected override string MutexName { get; }

Property Value

string

Methods

AddAccessPointsInternal(AppEntry, Feed, IReadOnlyCollection<AccessPoint>)

Applies AccessPoints for an application.

protected override void AddAccessPointsInternal(AppEntry appEntry, Feed feed, IReadOnlyCollection<AccessPoint> accessPoints)

Parameters

appEntry AppEntry

The application being integrated.

feed Feed

The feed providing additional metadata, icons, etc. for the application.

accessPoints IReadOnlyCollection<AccessPoint>

The access points to apply.

Exceptions

ArgumentException

Entries from appEntry is the same reference as accessPoints.

OperationCanceledException

The user canceled the task.

KeyNotFoundException

An AccessPoint reference to a Capability is invalid.

ConflictException

One or more of the accessPoints would cause a conflict with the existing AccessPoints in AppList.

WebException

A problem occurred while downloading additional data (such as icons).

IOException

A problem occurred while writing to the filesystem or registry.

UnauthorizedAccessException

Write access to the filesystem or registry is not permitted.

AddAppInternal(string, Requirements, Feed)

Creates a new named AppEntry and adds it to the AppList.

protected override AppEntry AddAppInternal(string petName, Requirements requirements, Feed feed)

Parameters

petName string

The user-defined pet-name of the application.

requirements Requirements

The requirements describing the application to add.

feed Feed

The feed providing additional metadata, capabilities, etc. for the application.

Returns

AppEntry

The newly created application entry (already added to AppList).

Exceptions

InvalidOperationException

An application with the same petName is already in the list.

IOException

A problem occurred while writing to the filesystem or registry.

UnauthorizedAccessException

Write access to the filesystem or registry is not permitted.

AddAppInternal(AppEntry, Converter<FeedUri, Feed>)

Creates a new AppEntry based on an existing prototype (applying any AccessPoints) and adds it to the AppList.

protected override void AddAppInternal(AppEntry prototype, Converter<FeedUri, Feed> feedRetriever)

Parameters

prototype AppEntry

An existing AppEntry to use as a prototype.

feedRetriever Converter<FeedUri, Feed>

Callback method used to retrieve additional Feeds on demand.

AddAppInternal(FeedTarget)

Creates a new unnamed AppEntry and adds it to the AppList.

protected override AppEntry AddAppInternal(FeedTarget target)

Parameters

target FeedTarget

The application to add.

Returns

AppEntry

The newly created application entry (already added to AppList).

Exceptions

InvalidOperationException

The application is already in the list.

IOException

A problem occurred while writing to the filesystem or registry.

UnauthorizedAccessException

Write access to the filesystem or registry is not permitted.

Finish()

To be called after integration operations have been completed to inform the desktop environment and save the AppList.

protected override void Finish()

GetDir(bool, params string[])

Returns a path for a directory that can be used for desktop integration.

public static string GetDir(bool machineWide, params string[] resource)

Parameters

machineWide bool

true if the directory should be machine-wide and machine-specific instead of roaming with the user profile.

resource string[]

The directory name of the resource to be stored.

Returns

string

A fully qualified directory path. The directory is guaranteed to already exist.

Remarks

If a new directory is created with machineWide set to true on Windows, ACLs are set to deny write access for non-Administrator users.

Exceptions

IOException

A problem occurred while creating a directory.

UnauthorizedAccessException

Creating a directory is not permitted.

RemoveAccessPointsInternal(AppEntry, IEnumerable<AccessPoint>)

Removes already applied AccessPoints for an application.

protected override void RemoveAccessPointsInternal(AppEntry appEntry, IEnumerable<AccessPoint> accessPoints)

Parameters

appEntry AppEntry

The AppEntry containing the accessPoints.

accessPoints IEnumerable<AccessPoint>

The access points to unapply.

Exceptions

KeyNotFoundException

An AccessPoint reference to a Capability is invalid.

IOException

A problem occurred while writing to the filesystem or registry.

UnauthorizedAccessException

Write access to the filesystem or registry is not permitted.

RemoveAppInternal(AppEntry)

Removes an AppEntry from the AppList while unapplying any remaining AccessPoints.

protected override void RemoveAppInternal(AppEntry appEntry)

Parameters

appEntry AppEntry

The application to remove.

Exceptions

KeyNotFoundException

An AccessPoint reference to a Capability is invalid.

IOException

A problem occurred while writing to the filesystem or registry.

UnauthorizedAccessException

Write access to the filesystem or registry is not permitted.

RepairAppInternal(AppEntry, Feed)

Reapplies all AccessPoints for a specific AppEntry.

protected override void RepairAppInternal(AppEntry appEntry, Feed feed)

Parameters

appEntry AppEntry

The application entry to repair.

feed Feed

The feed providing additional metadata, capabilities, etc. for the application.

Exceptions

OperationCanceledException

The user canceled the task.

ConflictException

appEntry conflicts with the rest of the AppList.

WebException

A problem occurred while downloading additional data (such as icons).

IOException

A problem occurred while writing to the filesystem or registry.

UnauthorizedAccessException

Write access to the filesystem or registry is not permitted.

UpdateAppInternal(AppEntry, Feed)

Updates an AppEntry with new metadata and capabilities from a Feed. This may unapply and remove some existing AccessPoints.

protected override void UpdateAppInternal(AppEntry appEntry, Feed feed)

Parameters

appEntry AppEntry

The application entry to update.

feed Feed

The feed providing additional metadata, capabilities, etc. for the application.

Exceptions

KeyNotFoundException

An AccessPoint reference to a Capability is invalid.