RegisterPlugin() public method

Registers the specified plugin.
public RegisterPlugin ( string p_strPluginPath ) : bool
p_strPluginPath string The path to the plugin to register.
return bool
		/// <summary>
		/// Searches for plugins in the specified path, and loads
		/// any plugins that are found into a registry.
		/// </summary>
		/// <param name="p_pftFactory">The factory to use to create <see cref="Plugin"/>s.</param>
		/// <param name="p_pdvDiscoverer">The discoverer to use to search for plugins.</param>
		/// <returns>A registry containing all of the discovered plugin formats.</returns>
		public static PluginRegistry DiscoverManagedPlugins(IPluginFactory p_pftFactory, IPluginDiscoverer p_pdvDiscoverer)
		{
			Trace.TraceInformation("Discovering Managed Plugins...");
			Trace.Indent();

			PluginRegistry pgrRegistry = new PluginRegistry(p_pftFactory);
            if (p_pdvDiscoverer != null)
			    foreach (string strPlugin in p_pdvDiscoverer.FindPlugins())
			    {
				    Trace.TraceInformation("Found: {0}", strPlugin);
				    if (pgrRegistry.RegisterPlugin(strPlugin))
				    {
					    Trace.Indent();
					    Trace.TraceInformation("Registered.");
					    Trace.Unindent();
				    }
			    }
			Trace.Unindent();
			return pgrRegistry;
		}
Example #2
0
        /// <summary>
        /// Searches for plugins in the specified path, and loads
        /// any plugins that are found into a registry.
        /// </summary>
        /// <param name="p_pftFactory">The factory to use to create <see cref="Plugin"/>s.</param>
        /// <param name="p_pdvDiscoverer">The discoverer to use to search for plugins.</param>
        /// <returns>A registry containing all of the discovered plugin formats.</returns>
        public static PluginRegistry DiscoverManagedPlugins(IPluginFactory p_pftFactory, IPluginDiscoverer p_pdvDiscoverer)
        {
            Trace.TraceInformation("Discovering Managed Plugins...");
            Trace.Indent();

            PluginRegistry pgrRegistry = new PluginRegistry(p_pftFactory);

            if (p_pdvDiscoverer != null)
            {
                foreach (string strPlugin in p_pdvDiscoverer.FindPlugins())
                {
                    Trace.TraceInformation("Found: {0}", strPlugin);
                    if (pgrRegistry.RegisterPlugin(strPlugin))
                    {
                        Trace.Indent();
                        Trace.TraceInformation("Registered.");
                        Trace.Unindent();
                    }
                }
            }
            Trace.Unindent();
            return(pgrRegistry);
        }