Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the PluginWrapper class.
 /// </summary>
 /// <param name="plugin">IFileSearchPlugin</param>
 /// <param name="assemblyPath">Fully qualified file path</param>
 /// <param name="assemblyName">Name of assembly</param>
 /// <param name="internalPlugin">If true the plugin is internal, False is external.</param>
 /// <param name="enabled">If true the plugin is enabled, False is disabled.</param>
 /// <history>
 /// [Curtis_Beard]		07/31/2006	Created
 /// </history>
 public PluginWrapper(IFileSearchPlugin plugin, string assemblyPath,
                      string assemblyName, bool internalPlugin, bool enabled)
 {
     __Plugin   = plugin;
     __Path     = assemblyPath;
     __Name     = assemblyName;
     __Internal = internalPlugin;
     __Enabled  = enabled;
 }
Exemple #2
0
 /// <summary>
 /// Initializes a new instance of the PluginWrapper class.
 /// </summary>
 /// <param name="plugin">IFileSearchPlugin</param>
 /// <param name="assemblyPath">Fully qualified file path</param>
 /// <param name="assemblyName">Name of assembly</param>
 /// <param name="internalPlugin">If true the plugin is internal, False is external.</param>
 /// <param name="enabled">If true the plugin is enabled, False is disabled.</param>
 /// <history>
 /// [Curtis_Beard]		07/31/2006	Created
 /// </history>
 public PluginWrapper(IFileSearchPlugin plugin, string assemblyPath, 
     string assemblyName, bool internalPlugin, bool enabled)
 {
     __Plugin = plugin;
      __Path = assemblyPath;
      __Name = assemblyName;
      __Internal = internalPlugin;
      __Enabled = enabled;
 }
Exemple #3
0
        /// <summary>
        /// Load a plugin from file.
        /// </summary>
        /// <param name="path">Full file path to plugin</param>
        /// <returns>PluginWrapper containing plugin</returns>
        /// <history>
        /// [Curtis_Beard]		09/08/2006	Created
        /// [Curtis_Beard]		06/28/2007	CHG: make all plugins external and enabled by default
        /// </history>
        private static PluginWrapper LoadPlugin(string path)
        {
            try
            {
                Assembly dll = Assembly.LoadFrom(path);

                Type objInterface;

                // Loop through each type in the DLL
                foreach (Type objType in dll.GetTypes())
                {
                    // Only look at public types
                    if (objType.IsPublic)
                    {
                        // Ignore abstract classes
                        if (!((objType.Attributes & TypeAttributes.Abstract) == TypeAttributes.Abstract))
                        {
                            // See if this type implements our interface
                            objInterface = objType.GetInterface("FileSearchBase.IFileSearchPlugin", true);
                            if (objInterface != null)
                            {
                                // Load dll
                                // Create and return class instance
                                object objPlugin = dll.CreateInstance(objType.FullName);

                                IFileSearchPlugin plugin  = (IFileSearchPlugin)objPlugin;
                                PluginWrapper     wrapper = new PluginWrapper(plugin, path, dll.FullName, false, true);

                                return(wrapper);
                            }
                        }
                    }
                }
            }
            catch {}

            return(null);
        }
Exemple #4
0
        /// <summary>
        /// Add a plugin to the collection.
        /// </summary>
        /// <param name="plugin">Plugin to add (IFileSearchPlugin)</param>
        /// <returns>Position of plugin in collection</returns>
        /// <history>
        /// [Curtis_Beard]		07/28/2006	Created
        /// </history>
        public static int Add(IFileSearchPlugin plugin)
        {
            PluginWrapper wrapper = new PluginWrapper(plugin, string.Empty, plugin.Name, true, true);

            return(__PluginCollection.Add(wrapper));
        }
Exemple #5
0
 /// <summary>
 /// Display the plugin details.
 /// </summary>
 /// <param name="plugin">IFileSearchPlugin to load</param>
 /// <history>
 /// [Curtis_Beard]		09/05/2006	Created
 /// </history>
 private void LoadPluginDetails(IFileSearchPlugin plugin)
 {
     lblPluginName.Text = plugin.Name;
      lblPluginVersion.Text = plugin.Version;
      lblPluginAuthor.Text = plugin.Author;
      lblPluginDescription.Text = plugin.Description;
 }
Exemple #6
0
 /// <summary>
 /// Add a plugin to the collection.
 /// </summary>
 /// <param name="plugin">Plugin to add (IFileSearchPlugin)</param>
 /// <returns>Position of plugin in collection</returns>
 /// <history>
 /// [Curtis_Beard]		07/28/2006	Created
 /// </history>
 public static int Add(IFileSearchPlugin plugin)
 {
     PluginWrapper wrapper = new PluginWrapper(plugin, string.Empty, plugin.Name, true, true);
      return __PluginCollection.Add(wrapper);
 }