public static ExceptionListener GetExceptionListener() { if (TempData.exceptionListener == null) { ExceptionListener el = new ExceptionListener(); TempData.exceptionListener = el; return(el); } return(TempData.exceptionListener); }
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; }