示例#1
0
        public static ExceptionListener GetExceptionListener()
        {
            if (TempData.exceptionListener == null)
            {
                ExceptionListener el = new ExceptionListener();
                TempData.exceptionListener = el;
                return(el);
            }

            return(TempData.exceptionListener);
        }
示例#2
0
        public static void loadPlugins(ExceptionListener exceptionListener = null)
        {
            string[]            importantPlugins = new ConfigManager().getConfig().plugins.important;
            string[]            normalPlugins    = new ConfigManager().getConfig().plugins.normal;
            List <PluginObject> pluginsList      = new List <PluginObject>();

            foreach (string i in importantPlugins)
            {
                string pluginsBaseDir = AppDomain.CurrentDomain.BaseDirectory + "plugins\\";
                try
                {
                    PluginObject pluginObject = new PluginObject(pluginsBaseDir + i + ".dll", true, i);
                    pluginsList.Add(pluginObject);
                    Log.i("Plugin \"" + i + "\" (important) load success");
                }
                catch (Exception e)
                {
                    Log.i("Plugin \"" + i + "\" (important) load unsuccess");
                    Log.i("Please put plugin in " + pluginsBaseDir);
                    GetExceptionListener().OnException(e);
                }
            }

            foreach (string i in normalPlugins)
            {
                string pluginsBaseDir = AppDomain.CurrentDomain.BaseDirectory + "plugins\\";
                try
                {
                    PluginObject pluginObject = new PluginObject(pluginsBaseDir + i + ".dll", false, i);
                    pluginsList.Add(pluginObject);
                    Log.i("Plugin \"" + i + "\" (normal) load success");
                }
                catch (Exception e)
                {
                    Log.i("Plugin \"" + i + "\" (normal) load unsuccess");
                    Log.i("Please put plugin in " + pluginsBaseDir);
                    GetExceptionListener().OnException(e);
                }
            }

            TempData.pluginsList = pluginsList;
        }