/// <summary>
/// Checks if the provided add-ins are installed, and requests the installation of those
/// which aren't.
/// </summary>
/// <param name="message">
/// Message to show to the user when new add-ins have to be installed.
/// </param>
/// <param name="addinIds">
/// List of IDs of the add-ins to be checked.
/// </param>
/// <remarks>
/// This method checks if the specified add-ins are installed.
/// If some of the add-ins are not installed, it will use
/// the installer assigned to the DefaultAddinInstaller property
/// to install them. If the installation fails, or if DefaultAddinInstaller
/// is not set, an exception will be thrown.
/// </remarks>
public void CheckInstalled(string message, params string[] addinIds)
{
ArrayList notInstalled = new ArrayList();
foreach (string id in addinIds)
{
Addin addin = Registry.GetAddin(id, false);
if (addin != null)
{
// The add-in is already installed
// If the add-in is disabled, enable it now
if (!addin.Enabled)
{
addin.Enabled = true;
}
}
else
{
notInstalled.Add(id);
}
}
if (notInstalled.Count == 0)
{
return;
}
if (installer == null)
{
throw new InvalidOperationException("Add-in installer not set");
}
// Install the add-ins
installer.InstallAddins(Registry, message, (string[])notInstalled.ToArray(typeof(string)));
}