/// <summary> /// Performs plugin system initialization. Should be called before this /// class or any Mono.Addins class is used. The ordering is very delicate. /// </summary> public static void Initialize() { // Initialize Mono.Addins. try { AddinManager.Initialize(UserPluginsDirectory.Path); } catch (InvalidOperationException e) { Log <PluginManager> .Error("AddinManager.Initialize: {0}", e.Message); Log <PluginManager> .Warn("Rebuild Addin.Registry and reinitialize AddinManager"); AddinManager.Registry.Rebuild(null); AddinManager.Shutdown(); AddinManager.Initialize(UserPluginsDirectory.Path); } AddinManager.Registry.Update(null); // parse the addin config files for extended metadata AddinMetadata = new Dictionary <Addin, Dictionary <string, string> > (); DockServices.System.RunOnThread(() => { AllAddins.ToList().ForEach(a => ParseAddinConfig(a)); }); // Add feedback when addin is loaded or unloaded AddinManager.AddinLoaded += AddinManagerAddinLoaded; AddinManager.AddinUnloaded += AddinManagerAddinUnloaded; Log <PluginManager> .Debug("Plugin manager initialized."); }
private void AddAddinExec() { var file = SelectAddin(); var addinExist = AllAddins.FirstOrDefault(a => a.Addin.AddinFile.EqualsIgnoreCase(file)); if (addinExist != null) { ShowMessage("Такая сборка уже есть"); Addin = addinExist; return; } var addin = AddinManagerService.GetAddin(file); AllAddins.Insert(0, new AddinVM(addin)); fileData.Data.AddinFiles.Insert(0, file); }
/// <inheritdoc /> public override void OnClosing() { fileData.Data.AddinFiles = AllAddins.Select(s => s.Addin.AddinFile).ToList(); fileData.TrySave(); }