private void Apply(IEditorPlugin plugin) { Range _line = txt.GetLine(txt.Selection.Start.iLine); SelInfo _selInfo = new SelInfo() { Text = txt.Text, SelectedText = txt.SelectedText, CurrentLine = _line.Text }; try { if (!plugin.OmitResult) { plugin.Apply(_selInfo); txt.SelectedText = _selInfo.SelectedText; } else { plugin.Apply(_selInfo); } } catch (Exception) { } }
private void _menuItem_LeftClick(object sender, EventArgs e) { ToolStripItem _menuItem = sender as ToolStripItem; string key = _menuItem.Tag as string; IEditorPlugin _plugin = _Plugins.Get(key).GetPlugin(); PluginHelper _pluginSettingsHelper = new PluginHelper(_plugin); _pluginSettingsHelper.LoadSettings(); if (_plugin.IsExtension) { bool _result = _plugin.Configure(); if (!_result) { return; } _pluginSettingsHelper.SaveSettings(); } _pluginSettingsHelper.LoadSettings(); SelInfo _selInfo = new SelInfo() { Text = editor.Editor.Text, SelectedText = editor.Editor.SelectedText, CurrentLine = editor.Editor.CurrentLine() }; try { if (!_plugin.OmitResult) { _plugin.Apply(_selInfo); editor.Editor.SelectedText = _selInfo.SelectedText; } else { _plugin.Apply(_selInfo); } } catch (Exception) { } _pluginSettingsHelper.SaveSettings(); }