public static void startupNotifications(Elite.MessageBus messageBus, int registryCheck) { // This returns null if the registry key is missing - that's ok if (registryCheck == 1) { addSpeech(messageBus, "Welcome to the Ocellus Assistant. Say configure plug in to begin.", null); } else if (registryCheck == 2 || registryCheck == 3) { addSpeech(messageBus, "New Configurations available. Say Configure Plug in to make modifications.", null); } else { string announcementType = PluginRegistry.getStringValue("startupNotification"); if (announcementType == "tts") { string voice = PluginRegistry.getStringValue("startupVoice"); addSpeech(messageBus, PluginRegistry.getStringValue("startupText"), voice); } else if (announcementType == "sound") { string file = PluginRegistry.getStringValue("startupSound"); playSound(file); } } if (Upgrade.needUpgrade()) { updateAnnouncement(messageBus); } }
private bool FileExists(string filePath) { IFileSystemPlugin fs = PluginRegistry.GetInstance().FindFileSystemForUri(filePath); ILogFileInfo info = fs.GetLogfileInfo(filePath); return(info.FileExists); }
/// <summary> /// Initializes the plugin log. /// </summary> /// <param name="p_mprManagedPluginRegistry">The <see cref="PluginRegistry"/> that contains the list /// of managed <see cref="Plugin"/>s.</param> /// <param name="p_plsSerializer">The object that serializes and deserializes /// data from an active plugin log permanent store.</param> /// <exception cref="InvalidOperationException">Thrown if the plugins log has already /// been initialized.</exception> public static ActivePluginLog Initialize(PluginRegistry p_mprManagedPluginRegistry, IActivePluginLogSerializer p_plsSerializer) { if (m_aplCurrent != null) throw new InvalidOperationException("The Active Plugin Log has already been initialized."); m_aplCurrent = new ActivePluginLog(p_mprManagedPluginRegistry, p_plsSerializer); return m_aplCurrent; }
private static void Main() { // This form created for obtain UI synchronization context only using (new Form()) { // Store the shared JoinableTaskContext ThreadHelper.JoinableTaskContext = new JoinableTaskContext(); } // required for translation PluginRegistry.Initialize(); // we will be instantiating a number of forms using their default .ctors // this would lead to InvalidOperationException thrown in GitModuleForm() // set the flag that will stop this from happening GitModuleForm.IsUnitTestActive = true; var neutralItems = TranslationHelpers.LoadNeutralItems(); string filename = Path.Combine(Translator.GetTranslationDir(), "English.xlf"); TranslationHelpers.SaveTranslation(null, neutralItems, filename); var translationsNames = Translator.GetAllTranslations(); foreach (var name in translationsNames) { var translation = Translator.GetTranslation(name); var translateItems = TranslationHelpers.LoadTranslation(translation, neutralItems); filename = Path.Combine(Translator.GetTranslationDir(), name + ".xlf"); TranslationHelpers.SaveTranslation(translation.First().Value.TargetLanguage, translateItems, filename); } }
/// <summary> /// Initializes the plugin log. /// </summary> /// <param name="p_mprManagedPluginRegistry">The <see cref="PluginRegistry"/> that contains the list /// of managed <see cref="Plugin"/>s.</param> /// <param name="p_posOrderSerializer">The object that serializes and deserializes /// data from an active plugin log permanent store.</param> /// <param name="p_povOrderValidator">The object that validates plugin order.</param> /// <exception cref="InvalidOperationException">Thrown if the plugin order log has already /// been initialized.</exception> public static PluginOrderLog Initialize(PluginRegistry p_mprManagedPluginRegistry, IPluginOrderLogSerializer p_posOrderSerializer, IPluginOrderValidator p_povOrderValidator) { if (m_polCurrent != null) throw new InvalidOperationException("The Plugin Order Log has already been initialized."); m_polCurrent = new PluginOrderLog(p_mprManagedPluginRegistry, p_posOrderSerializer, p_povOrderValidator); return m_polCurrent; }
private void FillPluginList() { this.pluginListBox.Items.Clear(); foreach (IContextMenuEntry entry in PluginRegistry.GetInstance().RegisteredContextMenuPlugins) { this.pluginListBox.Items.Add(entry); if (entry is ILogExpertPluginConfigurator) { (entry as ILogExpertPluginConfigurator).StartConfig(); } } foreach (IKeywordAction entry in PluginRegistry.GetInstance().RegisteredKeywordActions) { this.pluginListBox.Items.Add(entry); if (entry is ILogExpertPluginConfigurator) { (entry as ILogExpertPluginConfigurator).StartConfig(); } } foreach (IFileSystemPlugin entry in PluginRegistry.GetInstance().RegisteredFileSystemPlugins) { this.pluginListBox.Items.Add(entry); if (entry is ILogExpertPluginConfigurator) { (entry as ILogExpertPluginConfigurator).StartConfig(); } } this.configPluginButton.Enabled = false; }
private void LoadExtensions() { PluginRegistry = new PluginRegistry(); PluginLoader = new PluginLoader(Defaults.ManagerPluginDirectory, PluginRegistry); PluginLoader.LoadPlugins(); }
public void TestPlugins() { var registry = new PluginRegistry(); registry.Plugins.Should().NotBeNull(); registry.Plugins.Should().BeEmpty(); }
public void TestLoadEmptyRegistry() { var registry = new PluginRegistry(); registry.LoadAllOfType <ILogFileOutlinePlugin>().Should().BeEmpty(); registry.LoadAllOfType <ILogEntryParserPlugin>().Should().BeEmpty(); }
private void StartExtensions() { if (PluginRegistry == null || PluginRegistry.Count == 0) { Log.Info("No plugins loaded, skipping initalization."); return; } Log.Info("Initializing extensions..."); for (var i = 0; i < PluginRegistry.Count; i++) { var pluginHost = PluginRegistry[i]; try { var pluginInfo = PluginRegistry.GetPluginInfoByName(pluginHost.Manifest.FriendlyName); var isLastPlugin = (i == PluginRegistry.Count - 1); pluginHost.Instance.Initialize(this, pluginHost.Manifest.IPCIdentifier); PluginInitialized?.Invoke(this, new PluginInitializationEventArgs(pluginInfo, isLastPlugin)); Log.Info($"Plugin {pluginHost.Manifest.FriendlyName} initialized"); } catch (Exception ex) { Log.Error($"Plugin {pluginHost.Manifest.FriendlyName} failed to initialize. Exception has been caught, see the log for details."); Log.ExceptionSilent(ex); } } Log.Info("Extensions initialized."); }
private static void Main() { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); // This form created for obtain UI synchronization context only using (new Form()) { // Store the shared JoinableTaskContext ThreadHelper.JoinableTaskContext = new JoinableTaskContext(); } // required for translation PluginRegistry.Initialize(); string[] args = Environment.GetCommandLineArgs(); if (args.Length == 1) { Application.Run(new FormTranslate()); } else if (args.Length == 2 && args[1] == "update") { UpdateAllTranslations(); } else if (args.Length == 2 && args[1] == "status") { ShowStatus(); } }
private IPluginLoader CreatePluginLoader(IDataSourceAnalyserPlugin pluginObject) { var loader = new PluginRegistry(); loader.Register(pluginObject); return(loader); }
private static void RegisterPlugins(RegistryConfiguration configuration, IServiceCollection services) { var registry = new PluginRegistry(); var plugins = configuration.Plugins; foreach (var plugin in plugins) { var manufacturer = plugin.Manufacturer !; var namesElement = plugin.Names; foreach (var nameElement in namesElement) { var name = nameElement.Name !; var implicitAlias = manufacturer + " " + name; registry.Register(name, manufacturer, implicitAlias); if (nameElement.Aliases.Any()) { registry.Register(name, manufacturer, nameElement.Aliases); } } } services.AddSingleton <IPluginRegistry>(registry); }
private static IPluginLoader LoadWellKnownPlugins() { var registry = new PluginRegistry(); registry.Register(new HelpWidgetPlugin()); return(registry); }
/// <summary> /// Checks if the file name is a settings file. If so, the contained logfile name /// is returned. If not, the given file name is returned unchanged. /// </summary> /// <param name="fileName"></param> /// <returns></returns> private string FindFilenameForSettings(string fileName) { if (fileName.EndsWith(".lxp")) { PersistenceData persistenceData = Persister.LoadOptionsOnly(fileName); if (persistenceData == null) { return(fileName); } if (!string.IsNullOrEmpty(persistenceData.fileName)) { IFileSystemPlugin fs = PluginRegistry.GetInstance().FindFileSystemForUri(persistenceData.fileName); if (fs != null && !fs.GetType().Equals(typeof(LocalFileSystem))) { return(persistenceData.fileName); } // On relative paths the URI check (and therefore the file system plugin check) will fail. // So fs == null and fs == LocalFileSystem are handled here like normal files. if (Path.IsPathRooted(persistenceData.fileName)) { return(persistenceData.fileName); } // handle relative paths in .lxp files string dir = Path.GetDirectoryName(fileName); return(Path.Combine(dir, persistenceData.fileName)); } } return(fileName); }
/// <summary> /// A simple constructor that initializes the object with its dependencies. /// </summary> /// <param name="p_mprManagedPluginRegistry">The <see cref="PluginRegistry"/> that contains the list /// of managed <see cref="Plugin"/>s.</param> /// <param name="p_plsSerializer">The object that serializes and deserializes /// data from an active plugin log permanent store.</param> private ActivePluginLog(PluginRegistry p_mprManagedPluginRegistry, IActivePluginLogSerializer p_plsSerializer) { ManagedPluginRegistry = p_mprManagedPluginRegistry; LogSerializer = p_plsSerializer; LoadPluginLog(); m_rolActivePlugins = new ReadOnlyObservableList <Plugin>(m_ostActivePlugins); }
private void SavePluginSettings() { if (this.selectedPlugin != null) { this.selectedPlugin.HideConfigForm(); } foreach (IContextMenuEntry entry in PluginRegistry.GetInstance().RegisteredContextMenuPlugins) { if (entry is ILogExpertPluginConfigurator) { (entry as ILogExpertPluginConfigurator).SaveConfig(ConfigManager.ConfigDir); } } foreach (IKeywordAction entry in PluginRegistry.GetInstance().RegisteredKeywordActions) { if (entry is ILogExpertPluginConfigurator) { (entry as ILogExpertPluginConfigurator).SaveConfig(ConfigManager.ConfigDir); } } foreach (IFileSystemPlugin entry in PluginRegistry.GetInstance().RegisteredFileSystemPlugins) { if (entry is ILogExpertPluginConfigurator) { (entry as ILogExpertPluginConfigurator).SaveConfig(ConfigManager.ConfigDir); } } }
public void TestLoadEmptyRegistry() { var registry = new PluginRegistry(); registry.LoadAllOfType <IWidgetPlugin>().Should().BeEmpty(); registry.LoadAllOfType <ILogAnalyserPlugin>().Should().BeEmpty(); }
/// <summary> /// A simple constructor that initializes the object with its dependencies. /// </summary> /// <param name="p_mprManagedPluginRegistry">The <see cref="PluginRegistry"/> that contains the list /// of managed <see cref="Plugin"/>s.</param> /// <param name="p_posOrderSerializer">The object that serializes and deserializes /// data from a plugin order log permanent store.</param> /// <param name="p_povOrderValidator">The object that validates plugin order.</param> private PluginOrderLog(PluginRegistry p_mprManagedPluginRegistry, IPluginOrderLogSerializer p_posOrderSerializer, IPluginOrderValidator p_povOrderValidator) { ManagedPluginRegistry = p_mprManagedPluginRegistry; LogSerializer = p_posOrderSerializer; OrderValidator = p_povOrderValidator; LoadPluginOrder(); m_rolOrderedPlugins = new ReadOnlyObservableList <Plugin>(m_oclOrderedPlugins); }
/// <summary> /// Initializes the plugin log. /// </summary> /// <param name="p_mprManagedPluginRegistry">The <see cref="PluginRegistry"/> that contains the list /// of managed <see cref="Plugin"/>s.</param> /// <param name="p_posOrderSerializer">The object that serializes and deserializes /// data from an active plugin log permanent store.</param> /// <param name="p_povOrderValidator">The object that validates plugin order.</param> /// <exception cref="InvalidOperationException">Thrown if the plugin order log has already /// been initialized.</exception> public static PluginOrderLog Initialize(PluginRegistry p_mprManagedPluginRegistry, IPluginOrderLogSerializer p_posOrderSerializer, IPluginOrderValidator p_povOrderValidator) { if (m_polCurrent != null) { throw new InvalidOperationException("The Plugin Order Log has already been initialized."); } m_polCurrent = new PluginOrderLog(p_mprManagedPluginRegistry, p_posOrderSerializer, p_povOrderValidator); return(m_polCurrent); }
/// <summary> /// Initializes the plugin log. /// </summary> /// <param name="p_mprManagedPluginRegistry">The <see cref="PluginRegistry"/> that contains the list /// of managed <see cref="Plugin"/>s.</param> /// <param name="p_plsSerializer">The object that serializes and deserializes /// data from an active plugin log permanent store.</param> /// <exception cref="InvalidOperationException">Thrown if the plugins log has already /// been initialized.</exception> public static ActivePluginLog Initialize(PluginRegistry p_mprManagedPluginRegistry, IActivePluginLogSerializer p_plsSerializer) { if (m_aplCurrent != null) { throw new InvalidOperationException("The Active Plugin Log has already been initialized."); } m_aplCurrent = new ActivePluginLog(p_mprManagedPluginRegistry, p_plsSerializer); return(m_aplCurrent); }
public MainWindow() { this.InitializeComponent(); #if DEBUG this.AttachDevTools(); #endif using var initScope = new TimedScope(LoggingScope.Global($"{nameof(MainWindow)}.InitializeServices")); Session = new Session(); var menuProvider = new MenuProvider(); Services.AddService <IMenuProvider>(menuProvider); Session.EditorViewModel = new EditorViewModel(menuProvider); Session.Services = Services; Services.AddService <Window>(this); Services.AddService <Session>(Session); Services.AddService <IRootViewModelContainer>(Session); Services.AddService <ViewRegistry>(new ViewRegistry()); Services.AddService <IDialogService>(new DialogService(Services)); var viewDataTemplate = new ViewDataTemplate(Services); Services.AddService <IViewUpdater>(viewDataTemplate); DataTemplates.Add(viewDataTemplate); Services.AddService <IUndoService>(new UndoService()); Services.AddService <IMemberViewProvider <IViewBuilder> >(new MemberViewProvider(Services)); var commandDispatcher = new CommandDispatcher(Services); Services.AddService <ICommandDispatcher>(commandDispatcher); // after all synchronous code caused by user input has been executed // we begin the commands processing. InputManager.Instance.PostProcess.Subscribe(async(e) => await commandDispatcher.ProcessDispatchedCommands()); var tabManager = new SimpleTabManager(Services); Services.AddService <ITabManager>(tabManager); Services.AddService <SimpleTabManager>(tabManager); var assetManager = new AssetManager(Services); Services.AddService <IAssetManager>(assetManager); Services.AddService <IAssetEditorRegistry>(assetManager); var pluginRegistry = new PluginRegistry(Services); pluginRegistry.RefreshAvailablePlugins(); Services.AddService <PluginRegistry>(pluginRegistry); foreach (var initialPlugin in pluginRegistry.AvailablePlugins) { pluginRegistry.Register(initialPlugin); } // It will be rendered by the DataTemplate DataContext = Session.EditorViewModel; }
public void GetByAlias_WithNonExistingAlias_ReturnsCorrespondingPluginDescriptor() { var sut = new PluginRegistry(); sut.Register("n1", "m1", "a1"); var actual = sut["a2"]; actual.Should().Be(PluginDescriptor.NoPlugin); }
public void GetByAlias_WithExistingAlias_ReturnsCorrespondingPluginDescriptor() { var sut = new PluginRegistry(); sut.Register("n1", "m1", "a1"); var actual = sut["a1"]; actual.Should().Be(new PluginDescriptor("n1", "m1", PluginType.Unknown)); }
public void Setup() { _id = AnalysisId.CreateNew(); _template = new PageTemplate(); _analyser = new Mock <IAnalysis>(); _analysisStorage = new Mock <IAnalysisStorage>(); _pluginRegistry = new PluginRegistry(); }
private static IPluginLoader LoadWellKnownPlugins() { var registry = new PluginRegistry(); //registry.Register(new EventsLogAnalyserPlugin()); registry.Register(new HelpWidgetPlugin()); registry.Register(new QuickInfoAnalyserPlugin(), new QuickInfoWidgetPlugin()); registry.Register(new LogEntryCountAnalyserPlugin(), new LogEntryCountWidgetPlugin()); return(registry); }
private void FormPushLoad(object sender, EventArgs e) { _NO_TRANSLATE_Remotes.Select(); Text = string.Concat(_pushCaption.Text, " (", Module.WorkingDir, ")"); var gitHoster = PluginRegistry.TryGetGitHosterForModule(Module); _createPullRequestCB.Enabled = gitHoster != null; }
public void Setup() { _dispatcher = new ManualDispatcher(); _viewTemplate = new AnalysisViewTemplate(); _analyser = new Mock <IAnalysis>(); _id = AnalysisId.CreateNew(); _analyser.Setup(x => x.Id).Returns(_id); _analysisStorage = new Mock <IAnalysisStorage>(); _pluginRegistry = new PluginRegistry(); }
public void Instantiate_AnyFile_NotCrash(string fileName) { PluginRegistry.GetInstance().RegisteredColumnizers.Add(new Log4jXmlColumnizer()); LogTabWindow logTabWindow = new LogTabWindow(null, 0, false); LogWindow logWindow = new LogWindow(logTabWindow, fileName, false, false); Assert.True(true); }
private void EditWebVars_Load(object sender, EventArgs e) { bool moreVarsInRegistry = true; int counter = 1; while (moreVarsInRegistry == true) { string webVar = PluginRegistry.getStringValue("webVar" + counter.ToString()); if (webVar != null) { switch (counter) { case 1: txtJson1.Text = webVar; btnTest1.Enabled = true; break; case 2: txtJson2.Text = webVar; btnTest2.Enabled = true; break; case 3: txtJson3.Text = webVar; btnTest3.Enabled = true; break; case 4: txtJson4.Text = webVar; btnTest4.Enabled = true; break; case 5: txtJson5.Text = webVar; btnTest5.Enabled = true; break; } if (counter >= 5) { moreVarsInRegistry = false; } counter++; } else { moreVarsInRegistry = false; string haveWebVar = PluginRegistry.getStringValue("webVar"); if (haveWebVar == null) { txtJson1.Text = "http://ocellus.io/webvars_test"; } btnTest1.Enabled = true; } } }
private void btnSubmit_Click(object sender, EventArgs e) { bool error = false; try { var testEmail = new System.Net.Mail.MailAddress(txt_email.Text); lbl_validation_email.Visible = false; } catch { lbl_validation_email.Visible = true; error = true; } if (txt_password.Text.Length == 0) { lbl_validation_password.Visible = true; error = true; } else { lbl_validation_password.Visible = false; } if (!error) { PluginRegistry.setStringValue("email", txt_email.Text); PluginRegistry.setStringValue("password", txt_password.Text); CookieContainer cookieContainer = new CookieContainer(); Tuple <CookieContainer, string> tAuthentication = Companion.loginToAPI(cookieContainer); this.Cookie = tAuthentication.Item1; string loginResponse = tAuthentication.Item2; Debug.Write("loginResponse: " + loginResponse); if (loginResponse == "verification" || loginResponse == "ok") { this.LoginResponse = loginResponse; this.Close(); } else { MessageBox.Show("Invalid Credentials, please re-enter them and retry"); } } else { MessageBox.Show("Invalid Credentials, please re-enter them and retry"); } }
public void TestNoPlugin() { var services = new ServiceContainer(); var plugins = new PluginRegistry(); services.RegisterInstance <IPluginLoader>(plugins); var factory = new LogEntryParserFactory(services); factory.CreateParser(services, LogFileFormats.GenericText) .Should().BeOfType <GenericTextLogEntryParser>("because there's no plugin registered at all"); }
/// <summary> /// A simple constructor that initializes the object with its dependencies. /// </summary> /// <param name="p_mprManagedPluginRegistry">The <see cref="PluginRegistry"/> that contains the list /// of managed <see cref="Plugin"/>s.</param> /// <param name="p_plsSerializer">The object that serializes and deserializes /// data from an active plugin log permanent store.</param> private ActivePluginLog(PluginRegistry p_mprManagedPluginRegistry, IActivePluginLogSerializer p_plsSerializer) { ManagedPluginRegistry = p_mprManagedPluginRegistry; LogSerializer = p_plsSerializer; LoadPluginLog(); m_rolActivePlugins = new ReadOnlyObservableList<Plugin>(m_ostActivePlugins); }
/// <summary> /// A simple constructor that initializes the object with its dependencies. /// </summary> /// <param name="p_mprManagedPluginRegistry">The <see cref="PluginRegistry"/> that contains the list /// of managed <see cref="Plugin"/>s.</param> /// <param name="p_posOrderSerializer">The object that serializes and deserializes /// data from a plugin order log permanent store.</param> /// <param name="p_povOrderValidator">The object that validates plugin order.</param> private PluginOrderLog(PluginRegistry p_mprManagedPluginRegistry, IPluginOrderLogSerializer p_posOrderSerializer, IPluginOrderValidator p_povOrderValidator) { ManagedPluginRegistry = p_mprManagedPluginRegistry; LogSerializer = p_posOrderSerializer; OrderValidator = p_povOrderValidator; LoadPluginOrder(); m_rolOrderedPlugins = new ReadOnlyObservableList<Plugin>(m_oclOrderedPlugins); }