Example #1
0
        /// <summary> Loads all plugins from the given .dll path. </summary>
        public static bool LoadPlugin(string path, bool auto)
        {
            try {
                Assembly      lib     = LoadAssembly(path);
                List <Plugin> plugins = IScripting.LoadTypes <Plugin>(lib);

                foreach (Plugin plugin in plugins)
                {
                    if (!Plugin.Load(plugin, auto))
                    {
                        return(false);
                    }
                }
                return(true);
            } catch (Exception ex) {
                Logger.LogError("Error loading plugins from " + path, ex);
                return(false);
            }
        }
Example #2
0
        /// <summary> Automatically loads all .dll commands specified in the autoload file. </summary>
        public static void Autoload()
        {
            if (!File.Exists(AutoloadFile))
            {
                File.Create(AutoloadFile); return;
            }
            string[] list = File.ReadAllLines(AutoloadFile);

            foreach (string cmdName in list)
            {
                if (cmdName.Length == 0)
                {
                    continue;
                }
                string error = IScripting.Load("Cmd" + cmdName);
                if (error != null)
                {
                    Logger.Log(LogType.Warning, error); continue;
                }

                Logger.Log(LogType.SystemActivity, "AUTOLOAD: Loaded Cmd{0}.dll", cmdName);
            }
        }