public void LoadPlugin() { OpenFileDialog open_dialog = new OpenFileDialog(); if (open_dialog.ShowDialog() == DialogResult.OK) { try { Assembly asm = Assembly.LoadFrom(open_dialog.FileName); Type[] types = asm.GetTypes(); foreach (Type t in types) { PluginAttribute attr = Attribute.GetCustomAttribute(t, typeof(PluginAttribute)) as PluginAttribute; if (attr != null) { FiguresType.Add(t); this.Figures.Items.Add(attr.Name); } } } catch { DialogResult rezult = MessageBox.Show("Невозможно открыть выбранный файл", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
/// <summary> /// Implementation of the IGreenshotPlugin.Initialize /// </summary> /// <param name="greenshotHost">Use the IGreenshotPluginHost interface to register events</param> /// <param name="myAttributes">My own attributes</param> /// <returns>true if plugin is initialized, false if not (doesn't show)</returns> public virtual bool Initialize(IGreenshotHost greenshotHost, PluginAttribute myAttributes) { Log.Debug("Initialize called of " + myAttributes.Name); _myAttributes = myAttributes; var ocrDirectory = Path.GetDirectoryName(myAttributes.DllFile); if (ocrDirectory == null) { return(false); } _ocrCommand = Path.Combine(ocrDirectory, "greenshotocrcommand.exe"); if (!HasModi()) { Log.Warn("No MODI found!"); return(false); } // Load configuration config = IniConfig.GetIniSection <OCRConfiguration>(); if (config.Language != null) { config.Language = config.Language.Replace("miLANG_", "").Replace("_", " "); } return(true); }
public bool Initialize(IGreenshotHost host, PluginAttribute pluginAttribute) { this.host = host; this.pluginAttribute = pluginAttribute; config = IniConfig.GetIniSection <DemoConfiguration>(); return(true); }
/// <summary> /// Implementation of the IGreenshotPlugin.Initialize /// </summary> /// <param name="host">Use the IGreenshotPluginHost interface to register events</param> /// <param name="pluginAttribute">My own attributes</param> public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes) { this.host = (IGreenshotHost)pluginHost; Attributes = myAttributes; // Register configuration (don't need the configuration itself) config = IniConfig.GetIniSection <FlickrConfiguration>(); resources = new ComponentResourceManager(typeof(FlickrPlugin)); ToolStripMenuItem itemPlugInRoot = new ToolStripMenuItem(); itemPlugInRoot.Text = "Flickr"; itemPlugInRoot.Tag = host; itemPlugInRoot.Image = (Image)resources.GetObject("flickr"); ToolStripMenuItem itemPlugInHistory = new ToolStripMenuItem(); itemPlugInHistory.Text = lang.GetString(LangKey.History); itemPlugInHistory.Tag = host; itemPlugInHistory.Click += new System.EventHandler(HistoryMenuClick); itemPlugInRoot.DropDownItems.Add(itemPlugInHistory); ToolStripMenuItem itemPlugInConfig = new ToolStripMenuItem(); itemPlugInConfig.Text = lang.GetString(LangKey.Configure); itemPlugInConfig.Tag = host; itemPlugInConfig.Click += new System.EventHandler(ConfigMenuClick); itemPlugInRoot.DropDownItems.Add(itemPlugInConfig); PluginUtils.AddToContextMenu(host, itemPlugInRoot); return(true); }
private XmlSchemaObject MakePluginFacet(PluginAttribute pluginAttribute, Type type) { var facet = new XmlSchemaEnumerationFacet(); facet.Value = pluginAttribute.Name; // Lame: For actions, everyone expects title case (SetProperty) but // the schema expects camel case (setProperty). if (pluginAttribute.Type == typeof(Peach.Core.Dom.Action)) { facet.Value = Char.ToLowerInvariant(facet.Value[0]) + facet.Value.Substring(1); } var descAttr = type.GetAttributes <DescriptionAttribute>().FirstOrDefault(); if (descAttr != null) { facet.Annotate(descAttr.Description); } else { facet.Annotate(type); } return(facet); }
private void LoadAssemblies() { if (!Directory.Exists(PLUGIN_DIR)) { Directory.CreateDirectory(PLUGIN_DIR); } foreach (string file in Directory.GetFiles(PLUGIN_DIR, "*.dll", SearchOption.AllDirectories)) { Assembly assembly = Assembly.LoadFile(Path.GetFullPath(file)); foreach (Type type in assembly.GetExportedTypes()) { PluginAttribute pluginAttribute = null; try { pluginAttribute = type.GetCustomAttribute <PluginAttribute>(); } catch (Exception) { }; if (pluginAttribute == null) { continue; } plugins.Add(new Plugin(pluginAttribute.name, assembly.GetName().Version, Activator.CreateInstance(type))); } } foreach (Plugin plugin in plugins) { plugin.Init(); } }
private static void CheckGuid(IEnumerable <Plugin> plugins) { Dictionary <Guid, Plugin> @using = new Dictionary <Guid, Plugin>(); foreach (var plugin in plugins) { PluginAttribute attribute = plugin.GetType().GetCustomAttribute <PluginAttribute>(); if (@using.TryGetValue(attribute.Guid, out var used)) { var pluginLangs = plugin.GetType().GetCustomAttributes <PluginSdk.Attributes.LanguageAttribute>(); var usedLangs = used.GetType().GetCustomAttributes <PluginSdk.Attributes.LanguageAttribute>(); Console.WriteLine($"Guid {attribute.Guid} in"); foreach (var lang in pluginLangs) { Console.WriteLine($"\t{lang.Name}"); } Console.WriteLine($"Already used in"); foreach (var lang in usedLangs) { Console.WriteLine($"\t{lang.Name}"); } Environment.Exit(1); } @using.Add(attribute.Guid, plugin); } }
/// <summary> /// Load a specific plugin into program memory. /// </summary> /// <param name="pluginType">The System.Type object representing the plugin.</param> /// <param name="newPlugin">The plugin as an object.</param> /// <param name="attribute">The attribute representing the plugin's details.</param> private static void LoadPlugin(Type pluginType, Plugin newPlugin, PluginAttribute attribute) { bool enablePlugin = newPlugin.Settings .Element("enabled") .Value.ToLower() == "true"; if (enablePlugin) { if (attribute != null) { AddPluginToList(newPlugin, attribute.PluginName, attribute.PluginVersion, attribute.PluginAuthor); } else { Events.Enqueue("Missing attributes for " + pluginType.Name); } } else { Events.Enqueue("Plugin disabled: " + pluginType.Name); } }
/// <summary> /// 添加一个属性到ListView上 /// </summary> /// <param name="listview"></param> /// <param name="att"></param> private void AddAttToListView(ListView listview, PluginAttribute att) { ListViewItem tmp = new ListViewItem(new string[] { att.Name, att.MainVersion, att.Company, att.IsGlobalization.ToString(), "启用" }); tmp.Tag = att; listview.Items.Add(tmp); }
public virtual void Init() { Enabled = true; if (m_server == null) { //ERROR! No Server Running! Console.WriteLine("No Running Server found!"); OnDisable(); } PluginAttribute pluginAttribute = Attribute.GetCustomAttribute(GetType(), typeof(PluginAttribute), true) as PluginAttribute; if (pluginAttribute != null) { GetName = pluginAttribute.Name; Version = pluginAttribute.Version; Description = pluginAttribute.Description; Author = pluginAttribute.Author; API = pluginAttribute.API; Aillias = pluginAttribute.Alliais; } else { Enabled = false; Console.ForegroundColor = ConsoleColor.Red; Console.WriteLine("Plugin Invalid! No Plugin Attribute Found!"); Console.ResetColor(); return; } Console.WriteLine("Plugin Loaded!"); //#TODO add Logger }
internal void LoadPlugins() { if (Config.GetProperty("PluginDisabled", false)) { return; } string pluginDirectory = Path.GetDirectoryName(new Uri(Assembly.GetExecutingAssembly().CodeBase).LocalPath); pluginDirectory = Config.GetProperty("PluginDirectory", pluginDirectory); if (pluginDirectory != null) { pluginDirectory = Path.GetFullPath(pluginDirectory); AppDomain currentDomain = AppDomain.CurrentDomain; currentDomain.AssemblyResolve += MyResolveEventHandler; foreach (string pluginPath in Directory.GetFiles(pluginDirectory, "*.dll", SearchOption.AllDirectories)) { Assembly newAssembly = Assembly.LoadFile(pluginPath); Type[] types = newAssembly.GetExportedTypes(); foreach (Type type in types) { try { // If no PluginAttribute and does not implement IPlugin interface, not a valid plugin if (!type.IsDefined(typeof(PluginAttribute), true) && !typeof(IPlugin).IsAssignableFrom(type)) { continue; } if (type.IsDefined(typeof(PluginAttribute), true)) { PluginAttribute pluginAttribute = Attribute.GetCustomAttribute(type, typeof(PluginAttribute), true) as PluginAttribute; if (pluginAttribute != null) { if (!Config.GetProperty(pluginAttribute.PluginName + ".Enabled", true)) { continue; } } } var ctor = type.GetConstructor(Type.EmptyTypes); if (ctor != null) { var plugin = ctor.Invoke(null); _plugins.Add(plugin); LoadCommands(type); LoadPacketHandlers(type); } } catch (Exception ex) { Log.WarnFormat("Failed loading plugin type {0} as a plugin.", type); Log.Debug("Plugin loader caught exception, but is moving on.", ex); } } } } }
/// <summary> /// Implementation of the IGreenshotPlugin.Initialize /// </summary> /// <param name="pluginHost">Use the IGreenshotPluginHost interface to register events</param> /// <param name="captureHost">Use the ICaptureHost interface to register in the MainContextMenu</param> /// <param name="pluginAttribute">My own attributes</param> /// <returns>true if plugin is initialized, false if not (doesn't show)</returns> public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes) { LOG.Debug("Initialize called of " + myAttributes.Name); this.host = pluginHost; this.myAttributes = myAttributes; return(true); }
public PluginAssembly(string path) { Path = path; Title = Author = Description = Version = Name = string.Empty; if (File.Exists(path)) { try { assembly = Assembly.Load(File.ReadAllBytes(path)); AssemblyName name = assembly.GetName(); AssemblyTitleAttribute customAttribute = (AssemblyTitleAttribute)Attribute.GetCustomAttribute(assembly, typeof(AssemblyTitleAttribute)); AssemblyCompanyAttribute attribute2 = (AssemblyCompanyAttribute)Attribute.GetCustomAttribute(assembly, typeof(AssemblyCompanyAttribute)); AssemblyDescriptionAttribute attribute3 = (AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(assembly, typeof(AssemblyDescriptionAttribute)); Version = name.Version.ToString(); if (customAttribute != null) { Title = customAttribute.Title; } if (attribute2 != null) { Author = attribute2.Company; } if (attribute3 != null) { Description = attribute3.Description; } Name = Title + Version + "(" + path.GetHashCode().ToString("X") + ")"; foreach (Type type in assembly.GetTypes()) { try { if (ValidateType(type)) { PluginAttribute pluginAtt = Attribute.GetCustomAttribute(type, T_PLUGINATTRIBUTE) as PluginAttribute; if (pluginAtt != null) { string pluginID = Name + "+" + type.FullName; PluginInformation info = new PluginInformation(pluginAtt, path, pluginID, type.FullName); GetImageFromAssembly(assembly, type, info); dicPluginInformations[pluginID] = info; } else { QTUtility2.MakeErrorLog(null, "failed attribute"); } } } catch { } } } catch (ReflectionTypeLoadException exception) { QTUtility2.MakeErrorLog(exception, "Failed to load plugin assembly.\r\n" + exception.LoaderExceptions.StringJoin("\r\n") + "\r\n" + path); } catch (Exception exception) { QTUtility2.MakeErrorLog(exception, "Failed to load plugin assembly.\r\n" + path); } } }
/// <summary> /// Implementation of the IGreenshotPlugin.Initialize /// </summary> /// <param name="host">Use the IGreenshotPluginHost interface to register events</param> /// <param name="captureHost">Use the ICaptureHost interface to register in the MainContextMenu</param> /// <param name="pluginAttribute">My own attributes</param> /// <returns>true if plugin is initialized, false if not (doesn't show)</returns> public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes) { this.host = (IGreenshotHost)pluginHost; jiraPluginAttributes = myAttributes; // Register configuration (don't need the configuration itself) config = IniConfig.GetIniSection <JiraConfiguration>(); resources = new ComponentResourceManager(typeof(JiraPlugin)); return(true); }
public PluginInformation(PluginAttribute pluginAtt, string path, string pluginID, string typeFullName) { this.Author = pluginAtt.Author; this.Name = pluginAtt.Name; this.Version = pluginAtt.Version; this.Description = pluginAtt.Description; this.PluginType = pluginAtt.PluginType; this.Path = path; this.PluginID = pluginID; this.TypeFullName = typeFullName; }
private static string GetPluginName(Type plugin) { string name = string.Empty; PluginAttribute pluginAttribute = (PluginAttribute)Attribute.GetCustomAttribute(plugin, typeof(PluginAttribute)); if (pluginAttribute != null) { name = pluginAttribute.Name; } return(name); }
public PluginInformation(PluginAttribute pluginAtt, string path, string pluginID, string typeFullName) { Author = pluginAtt.Author; Name = pluginAtt.Name; Version = pluginAtt.Version; Description = pluginAtt.Description; PluginType = pluginAtt.PluginType; Path = path; PluginID = pluginID; TypeFullName = typeFullName; }
public PluginAssembly(string path) { this.Path = path; this.Title = this.Author = this.Description = this.Version = this.Name = string.Empty; if (File.Exists(path)) { try { this.assembly = Assembly.Load(File.ReadAllBytes(path)); AssemblyName name = this.assembly.GetName(); AssemblyTitleAttribute customAttribute = (AssemblyTitleAttribute)Attribute.GetCustomAttribute(this.assembly, typeof(AssemblyTitleAttribute)); AssemblyCompanyAttribute attribute2 = (AssemblyCompanyAttribute)Attribute.GetCustomAttribute(this.assembly, typeof(AssemblyCompanyAttribute)); AssemblyDescriptionAttribute attribute3 = (AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(this.assembly, typeof(AssemblyDescriptionAttribute)); this.Version = name.Version.ToString(); if (customAttribute != null) { this.Title = customAttribute.Title; } if (attribute2 != null) { this.Author = attribute2.Company; } if (attribute3 != null) { this.Description = attribute3.Description; } this.Name = this.Title + this.Version + "(" + path.GetHashCode().ToString("X") + ")"; foreach (Type type in this.assembly.GetTypes()) { try { if (ValidateType(type)) { PluginAttribute pluginAtt = Attribute.GetCustomAttribute(type, T_PLUGINATTRIBUTE) as PluginAttribute; if (pluginAtt != null) { string pluginID = this.Name + "+" + type.FullName; PluginInformation info = new PluginInformation(pluginAtt, path, pluginID, type.FullName); GetImageFromAssembly(this.assembly, type, info); this.dicPluginInformations[pluginID] = info; } else { QTUtility2.MakeErrorLog(null, "failed attribute"); } } } catch { } } } catch (Exception exception) { QTUtility2.MakeErrorLog(exception, "failed get asm\r\n" + path); } } }
public void ConfigureSelectedItem(ListView listview) { if (listview.SelectedItems.Count > 0) { PluginAttribute pluginAttribute = (PluginAttribute)listview.SelectedItems[0].Tag; if (pluginAttribute != null) { IGreenshotPlugin plugin = plugins[pluginAttribute]; plugin.Configure(); } } }
public bool isSelectedItemConfigurable(ListView listview) { if (listview.SelectedItems.Count > 0) { PluginAttribute pluginAttribute = (PluginAttribute)listview.SelectedItems[0].Tag; if (pluginAttribute != null) { return(pluginAttribute.Configurable); } } return(false); }
private void SetPluginMetadata(PluginMetadata metadata, PluginAttribute attribute, Type type) { metadata.DisplayName = string.IsNullOrWhiteSpace(attribute?.DisplayName) ? type.Name : attribute.DisplayName; metadata.Description = string.IsNullOrWhiteSpace(attribute?.Description) ? null : attribute.Description; }
private static async Task SaveGames(IEnumerable <Plugin> plugins) { var dst = Path.Join(Core.FakeDir, "api", "plugins", "games"); Directory.CreateDirectory(dst); var games = AppDomain.CurrentDomain.GetAssemblies() .SelectMany(a => a.GetTypes()) .Where(t => t.IsDefined(typeof(GameAttribute))) .Select(entry => entry.GetCustomAttribute <GameAttribute>().Guid) .ToDictionary(key => key, _ => new List <object>()); foreach (var plugin in plugins) { PluginAttribute attribute = plugin.GetType().GetCustomAttribute <PluginAttribute>(); if (plugin is GitSharedPlugin sharedGit) { foreach (var type in sharedGit.Games) { var game = type.GetCustomAttribute <GameAttribute>(); games[game.Guid].Add(new { guid = attribute.Guid, dependencies = attribute.Dependencies.Select(t => t.GetCustomAttribute <PluginAttribute>().Guid), }); } } else if (plugin is GitPlugin git) { foreach (var entity in git.Entities) { foreach (var type in entity.Games) { var game = type.GetCustomAttribute <GameAttribute>(); games[game.Guid].Add(new { guid = attribute.Guid, dependencies = attribute.Dependencies.Select(t => t.GetCustomAttribute <PluginAttribute>().Guid), }); } } } } foreach (var(guid, entities) in games) { await File.WriteAllTextAsync(Path.Join(dst, $"{guid}.json"), JsonSerializer.Serialize(entities)); } }
/// <summary> /// Implementation of the IGreenshotPlugin.Initialize /// </summary> /// <param name="pluginHost">Use the IGreenshotPluginHost interface to register events</param> /// <param name="myAttributes">My own attributes</param> /// <returns>true if plugin is initialized, false if not (doesn't show)</returns> public bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes) { // Register configuration (don't need the configuration itself) _config = IniConfig.GetIniSection <JiraConfiguration>(); // Make sure the loggin is enable for the corect level. if (Log.IsDebugEnabled) { LogSettings.RegisterDefaultLogger <Log4NetLogger>(LogLevels.Verbose); } else if (Log.IsInfoEnabled) { LogSettings.RegisterDefaultLogger <Log4NetLogger>(LogLevels.Info); } else if (Log.IsWarnEnabled) { LogSettings.RegisterDefaultLogger <Log4NetLogger>(LogLevels.Warn); } else if (Log.IsErrorEnabled) { LogSettings.RegisterDefaultLogger <Log4NetLogger>(LogLevels.Error); } else if (Log.IsErrorEnabled) { LogSettings.RegisterDefaultLogger <Log4NetLogger>(LogLevels.Error); } else { LogSettings.RegisterDefaultLogger <Log4NetLogger>(LogLevels.Fatal); } // Add a SVG converter, although it doesn't fit to the Jira plugin there is currently no other way ImageHelper.StreamConverters["svg"] = (stream, s) => { stream.Position = 0; try { return(SvgImage.FromStream(stream).Image); } catch (Exception ex) { Log.Error("Can't load SVG", ex); } return(null); }; return(true); }
/// <summary> /// Attempts to load a plugin from a System.Type object. /// This checks to see whether the Type represents a Plugin object first. /// Then it extracts its attributes, creates a Plugin object from it and calls LoadPlugin(). /// </summary> /// <param name="pluginType">The System.Type object representing the plugin.</param> private static void LoadPlugin(Type pluginType) { if (pluginType.BaseType == typeof(Plugin)) { Plugin newPlugin = Activator.CreateInstance(pluginType) as Plugin; PluginAttribute attribute = pluginType.GetCustomAttribute <PluginAttribute>(); newPlugin.Settings = GetSettingsElementFor(newPlugin, attribute); if (newPlugin.Settings != null) { LoadPlugin(pluginType, newPlugin, attribute); } else { Events.Enqueue("Plugin skipped: " + pluginType.Name); } } }
/// <summary> /// Implementation of the IGreenshotPlugin.Initialize /// </summary> /// <param name="pluginHost">Use the IGreenshotPluginHost interface to register events</param> /// <param name="myAttributes">My own attributes</param> public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes) { // Register configuration (don't need the configuration itself) _config = IniConfig.GetIniSection <ConfluenceConfiguration>(); if (_config.IsDirty) { IniConfig.Save(); } try { TranslationManager.Instance.TranslationProvider = new LanguageXMLTranslationProvider(); //resources = new ComponentResourceManager(typeof(ConfluencePlugin)); } catch (Exception ex) { LOG.ErrorFormat("Problem in ConfluencePlugin.Initialize: {0}", ex.Message); return(false); } return(true); }
/// <summary> /// Implementation of the IGreenshotPlugin.Initialize /// </summary> /// <param name="pluginHost">Use the IGreenshotPluginHost interface to register events</param> /// <param name="myAttributes">My own attributes</param> /// <returns>true if plugin is initialized, false if not (doesn't show)</returns> public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes) { _host = pluginHost; Attributes = myAttributes; // Get configuration _config = IniConfig.GetIniSection <ImgurConfiguration>(); _resources = new ComponentResourceManager(typeof(ImgurPlugin)); ToolStripMenuItem itemPlugInRoot = new ToolStripMenuItem("Imgur") { Image = (Image)_resources.GetObject("Imgur") }; _historyMenuItem = new ToolStripMenuItem(Language.GetString("imgur", LangKey.history)) { Tag = _host }; _historyMenuItem.Click += delegate { ImgurHistory.ShowHistory(); }; itemPlugInRoot.DropDownItems.Add(_historyMenuItem); _itemPlugInConfig = new ToolStripMenuItem(Language.GetString("imgur", LangKey.configure)) { Tag = _host }; _itemPlugInConfig.Click += delegate { _config.ShowConfigDialog(); }; itemPlugInRoot.DropDownItems.Add(_itemPlugInConfig); PluginUtils.AddToContextMenu(_host, itemPlugInRoot); Language.LanguageChanged += OnLanguageChanged; // retrieve history in the background Thread backgroundTask = new Thread(CheckHistory) { Name = "Imgur History", IsBackground = true }; backgroundTask.SetApartmentState(ApartmentState.STA); backgroundTask.Start(); return(true); }
/// <summary> /// Implementation of the IGreenshotPlugin.Initialize /// </summary> /// <param name="host">Use the IGreenshotPluginHost interface to register events</param> /// <param name="captureHost">Use the ICaptureHost interface to register in the MainContextMenu</param> /// <param name="pluginAttribute">My own attributes</param> public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes) { this.host = (IGreenshotHost)pluginHost; Attributes = myAttributes; // Get configuration config = IniConfig.GetIniSection <PicasaConfiguration>(); resources = new ComponentResourceManager(typeof(PicasaPlugin)); itemPlugInRoot = new ToolStripMenuItem(); itemPlugInRoot.Text = Language.GetString("picasa", LangKey.Configure); itemPlugInRoot.Tag = host; itemPlugInRoot.Image = (Image)resources.GetObject("Picasa"); itemPlugInRoot.Click += new System.EventHandler(ConfigMenuClick); PluginUtils.AddToContextMenu(host, itemPlugInRoot); Language.LanguageChanged += new LanguageChangedHandler(OnLanguageChanged); return(true); }
public void LoadPlugins(Assembly assembly) { List <PluginClass> pluginClassList = new List <PluginClass>(); foreach (var type in assembly.GetTypes()) { bool isAPlugin = false; PluginAttribute pluginAttribute = null; var dependsOnAttributes = new List <DependsOnAttribute>(); foreach (var customAttribute in type.GetCustomAttributes(true)) { if (customAttribute is PluginAttribute) { isAPlugin = true; pluginAttribute = customAttribute as PluginAttribute; } if (customAttribute is DependsOnAttribute) { dependsOnAttributes.Add(customAttribute as DependsOnAttribute); } } if (isAPlugin) { if (typeof(TPlugin).IsAssignableFrom(type)) { var pluginClass = new PluginClass { Type = type, PluginAttribute = pluginAttribute, }; pluginClassList.Add(pluginClass); foreach (var dependsOnAttribute in dependsOnAttributes) { pluginClass.DependsOn.Add(dependsOnAttribute.Type); } } } } pluginClassList = ResolvPluginClassOrder(pluginClassList); foreach (var pluginClass in pluginClassList) { LoadPlugin(pluginClass.Type, pluginClass.PluginAttribute); } }
/// <summary> /// Implementation of the IGreenshotPlugin.Initialize /// </summary> /// <param name="host">Use the IGreenshotPluginHost interface to register events</param> /// <param name="pluginAttribute">My own attributes</param> public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute myAttributes) { this.host = (IGreenshotHost)pluginHost; Attributes = myAttributes; // Register configuration (don't need the configuration itself) config = IniConfig.GetIniSection <DropboxPluginConfiguration>(); resources = new ComponentResourceManager(typeof(DropboxPlugin)); itemPlugInConfig = new ToolStripMenuItem(); itemPlugInConfig.Text = Language.GetString("dropbox", LangKey.Configure); itemPlugInConfig.Tag = host; itemPlugInConfig.Click += new System.EventHandler(ConfigMenuClick); itemPlugInConfig.Image = (Image)resources.GetObject("Dropbox"); PluginUtils.AddToContextMenu(host, itemPlugInConfig); Language.LanguageChanged += new LanguageChangedHandler(OnLanguageChanged); return(true); }
/// <summary> /// Implementation of the IGreenshotPlugin.Initialize /// </summary> /// <param name="pluginHost">Use the IGreenshotPluginHost interface to register events</param> /// <param name="pluginAttribute">My own attributes</param> public virtual bool Initialize(IGreenshotHost pluginHost, PluginAttribute pluginAttribute) { _host = pluginHost; Attributes = pluginAttribute; // Register configuration (don't need the configuration itself) _config = IniConfig.GetIniSection <BoxConfiguration>(); _resources = new ComponentResourceManager(typeof(BoxPlugin)); _itemPlugInConfig = new ToolStripMenuItem { Image = (Image)_resources.GetObject("Box"), Text = Language.GetString("box", LangKey.Configure) }; _itemPlugInConfig.Click += ConfigMenuClick; PluginUtils.AddToContextMenu(_host, _itemPlugInConfig); Language.LanguageChanged += OnLanguageChanged; return(true); }
public PluginDetailForm(PluginAttribute att) : this() { this.att = att; }