PackageRestore

public static class PackageRestore
Fetches the plugins a document needs but does not have.

This happens in two steps, deliberately. Offer(PluginRequirement) asks the package server what it can supply, which is what allows the user to be shown a button only when pressing it would achieve something. Restore(PackageOffer, bool, IProgress<string>) then acts on an offer without going back to the server to ask the same questions again.

A restore can be permanent, which is an ordinary installation the user keeps, or fleeting, which lasts only as long as this session and leaves the plugin's objects out of the icon panels — see FleetingPlugins. The mechanics are identical either way; only the bookkeeping differs.

Properties

Available

#
public static bool Available { get; }
Gets whether restoring is possible at all in this installation. False means Rhino's package assembly could not be found, and no offer will ever come to anything.

Methods

Offer

#
public static Task<PackageOffer> Offer(PluginRequirement requirement)
Ask the package server what it can do about a missing plugin.

This talks to a server and must not be awaited from the UI thread.

requirement (PluginRequirement)The missing plugin to enquire about.
An offer, which may or may not be actionable, but is never null.

Restore

#
public static Task<RestoreReport> Restore(PackageOffer offer, bool fleeting, IProgress<string> log = null)
Act on an offer: download the package, install it, and load the plugin.

This talks to a server and must not be awaited from the UI thread. The one part which does need the UI thread — loading a plugin, which makes the panels rebuild — is marshalled there internally.

offer (PackageOffer)An available offer from Offer(PluginRequirement).
fleeting (bool)True to install for the lifetime of this session only, false to install permanently.
log (IProgress<string> = null)Optional progress sink, one line per step.
What became of the attempt.