Mono.Addins.AddinRegistry.GetAddin C# (CSharp) Method

GetAddin() public method

Returns an add-in from the registry.
The add-in identifier may optionally include a version number, for example: "TextEditor.Xml,1.2"
public GetAddin ( string id ) : Addin
id string /// Identifier of the add-in. ///
return Addin
		public Addin GetAddin (string id)
		{
			if (currentDomain == AddinDatabase.UnknownDomain)
				return null;
			Addin ad = database.GetInstalledAddin (currentDomain, id);
			if (ad != null && IsRegisteredForUninstall (ad.Id))
				return null;
			return ad;
		}
		

Same methods

AddinRegistry::GetAddin ( string id, bool exactVersionMatch ) : Addin

Usage Example

        /// <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)));
        }
All Usage Examples Of Mono.Addins.AddinRegistry::GetAddin