/// <summary>
        /// Constructs a plugin manager
        /// </summary>
        /// <param name="pluginRelativePath">The relative path to the plugins directory</param>
        /// <param name="autoReload">Should auto reload on file changes</param>
        public PluginManager(string pluginRelativePath = "plugins", bool autoReload = true)
        {
            this.autoReload = autoReload;

            PluginDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
            PluginDirectory = Path.Combine(PluginDirectory, pluginRelativePath);

            LocalLoader = new LocalLoader(PluginDirectory);

            // Add the most common references since plugin authors can't control which references they
            // use in scripts.  Adding a reference later that already exists does nothing.
            AddReference("Accessibility.dll");
            AddReference("Microsoft.Vsa.dll");
            AddReference("System.Configuration.Install.dll");
            AddReference("System.Data.dll");
            AddReference("System.Design.dll");
            AddReference("System.DirectoryServices.dll");
            AddReference("System.Drawing.Design.dll");
            AddReference("System.Drawing.dll");
            AddReference("System.EnterpriseServices.dll");
            AddReference("System.Management.dll");
            AddReference("System.Runtime.Remoting.dll");
            AddReference("System.Runtime.Serialization.Formatters.Soap.dll");
            AddReference("System.Security.dll");
            AddReference("System.ServiceProcess.dll");
            AddReference("System.Web.dll");
            AddReference("System.Web.RegularExpressions.dll");
            AddReference("System.Web.Services.dll");
            AddReference("System.Windows.Forms.Dll");
            AddReference("System.XML.dll");
            AddReference("SharpIRC.dll");
        }
Example #2
0
        /// <summary>
        /// Constructs a plugin manager
        /// </summary>
        /// <param name="pluginRelativePath">The relative path to the plugins directory</param>
        /// <param name="autoReload">Should auto reload on file changes</param>
        public PluginManager(string pluginRelativePath = "plugins", bool autoReload = true)
        {
            this.autoReload = autoReload;

            PluginDirectory = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
            PluginDirectory = Path.Combine(PluginDirectory, pluginRelativePath);

            LocalLoader = new LocalLoader(PluginDirectory);

            // Add the most common references since plugin authors can't control which references they
            // use in scripts.  Adding a reference later that already exists does nothing.
            AddReference("Accessibility.dll");
            AddReference("Microsoft.Vsa.dll");
            AddReference("System.Configuration.Install.dll");
            AddReference("System.Data.dll");
            AddReference("System.Design.dll");
            AddReference("System.DirectoryServices.dll");
            AddReference("System.Drawing.Design.dll");
            AddReference("System.Drawing.dll");
            AddReference("System.EnterpriseServices.dll");
            AddReference("System.Management.dll");
            AddReference("System.Runtime.Remoting.dll");
            AddReference("System.Runtime.Serialization.Formatters.Soap.dll");
            AddReference("System.Security.dll");
            AddReference("System.ServiceProcess.dll");
            AddReference("System.Web.dll");
            AddReference("System.Web.RegularExpressions.dll");
            AddReference("System.Web.Services.dll");
            AddReference("System.Windows.Forms.Dll");
            AddReference("System.XML.dll");
            AddReference("SharpIRC.dll");
        }
Example #3
0
        /// <summary>
        /// Reloads all plugins in the plugins directory
        /// </summary>
        public void ReloadPlugins()
        {
            if (!started)
            {
                throw new InvalidOperationException("PluginManager has not been started.");
            }
            lock (LockObject)
            {
                LocalLoader.Unload();
                LocalLoader = new LocalLoader(PluginDirectory);
                try
                {
                    LoadUserAssemblies();
                }
                catch (Exception exception)
                {
                    Log.Instance.Log(exception);
                }

                ChangeTime = new DateTime(0);
                if (PluginsReloaded != null)
                {
                    PluginsReloaded(this, new EventArgs());
                }
            }
        }
        /// <summary>
        /// Reloads all plugins in the plugins directory
        /// </summary>
        public void ReloadPlugins()
        {
            if (!started)
            {
                throw new InvalidOperationException("PluginManager has not been started.");
            }
            lock (LockObject)
            {
                LocalLoader.Unload();
                LocalLoader = new LocalLoader(PluginDirectory);
                try
                {
                    LoadUserAssemblies();
                }
                catch (Exception exception)
                {
                    Log.Instance.Log(exception);
                }

                ChangeTime = new DateTime(0);
                if (PluginsReloaded != null)
                {
                    PluginsReloaded(this, new EventArgs());
                }
            }
        }