private void LoadPlugin(string name) { Logger.LogDebug(string.Format("{0} Loading plugin {1}.", brktname, name)); if (plugins.ContainsKey(name)) { Logger.LogError(string.Format("{0} {1} plugin is already loaded.", brktname, name)); throw new InvalidOperationException(string.Format("{0} {1} plugin is already loaded.", brktname, name)); } try { string text = GetPluginScriptText(name); DirectoryInfo dir = new DirectoryInfo(Path.Combine(pluginDirectory.FullName, name)); Plugin plugin = new Plugin(dir, name, text); plugin.InstallHooks(); plugins[name] = plugin; Logger.Log(string.Format("{0} {1} plugin was loaded successfuly.", brktname, name)); } catch (Exception ex) { Logger.LogError(string.Format("{0} {1} plugin could not be loaded.", brktname, name)); Logger.LogException(ex); } }