If a add the following attributes to my c# visual plugin:
[Plugin(Description=“Plugin description”, UserData=“User defined data”), VisualPlugin]
public partial class Plugin1 : VisualPlugin
{
public Plugin1()
{
InitializeComponent();
}
}
Can you provide an example how to retrieve these attributes for each plugin from inside the host .,
When you load the plugin you can access its type info (including attributes) using code like
var attributes = fCurrentPlugin.GetType().GetCustomAttributes(false);
foreach (var item in attributes)
{
System.Diagnostics.Debug.WriteLine(item.ToString());
if (item is RemObjects.Hydra.PluginAttribute)
{
var attribute = item as RemObjects.Hydra.PluginAttribute;
System.Diagnostics.Debug.WriteLine(attribute.Name);
System.Diagnostics.Debug.WriteLine(attribute.Description);
System.Diagnostics.Debug.WriteLine(attribute.UserData);
}
}
Here fCurrentPlugin is a plugin instance loaded via ModuleManager.