Class MetadataHelper
Helper class to use for retrieving metadata about a plugin, defined as attributes.
Syntax
public static class MetadataHelper
Methods
Gets the specified attributes of an instance, if they exist.
Declaration
public static IEnumerable<T> GetAttributes<T>(object plugin)
where T : Attribute
Parameters
Type | Name | Description |
---|---|---|
System.Object |
plugin |
The plugin instance. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<T> |
The attributes of the instance, if existing. |
Type Parameters
Name | Description |
---|---|
T |
The attribute type to retrieve. |
Gets the specified attributes of an assembly, if they exist.
Declaration
public static T[] GetAttributes<T>(Assembly assembly)
where T : Attribute
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.Assembly |
assembly |
The assembly. |
Returns
Type | Description |
---|---|
T[] |
The attributes of the type, if existing. |
Type Parameters
Name | Description |
---|---|
T |
The attribute type to retrieve. |
Gets the specified attributes of a reflection metadata type, if they exist.
Declaration
public static T[] GetAttributes<T>(MemberInfo member)
where T : Attribute
Parameters
Type | Name | Description |
---|---|---|
System.Reflection.MemberInfo |
member |
The reflection metadata instance. |
Returns
Type | Description |
---|---|
T[] |
The attributes of the instance, if existing. |
Type Parameters
Name | Description |
---|---|
T |
The attribute type to retrieve. |
Gets the specified attributes of a type, if they exist.
Declaration
public static T[] GetAttributes<T>(Type pluginType)
where T : Attribute
Parameters
Type | Name | Description |
---|---|---|
System.Type |
pluginType |
The plugin type. |
Returns
Type | Description |
---|---|
T[] |
The attributes of the type, if existing. |
Type Parameters
Name | Description |
---|---|
T |
The attribute type to retrieve. |
Retrieves the dependencies of the specified plugin type.
Declaration
public static IEnumerable<BepInDependency> GetDependencies(Type plugin)
Parameters
Type | Name | Description |
---|---|---|
System.Type |
plugin |
The plugin type. |
Returns
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<BepInDependency> |
A list of all plugin types that the specified plugin type depends upon. |
Retrieves the BepInPlugin metadata from a plugin instance.
Declaration
public static BepInPlugin GetMetadata(object plugin)
Parameters
Type | Name | Description |
---|---|---|
System.Object |
plugin |
The plugin instance. |
Returns
Type | Description |
---|---|
BepInPlugin |
The BepInPlugin metadata of the plugin instance. |
Retrieves the BepInPlugin metadata from a plugin type.
Declaration
public static BepInPlugin GetMetadata(Type pluginType)
Parameters
Type | Name | Description |
---|---|---|
System.Type |
pluginType |
The plugin type. |
Returns
Type | Description |
---|---|
BepInPlugin |
The BepInPlugin metadata of the plugin type. |