|
@@ -2,8 +2,8 @@
|
|
using System.Collections.Generic;
|
|
using System.Collections.Generic;
|
|
using System.IO;
|
|
using System.IO;
|
|
using System.Linq;
|
|
using System.Linq;
|
|
|
|
+using System.Reflection;
|
|
using BepInEx.Bootstrap;
|
|
using BepInEx.Bootstrap;
|
|
-using BepInEx.Core;
|
|
|
|
using Mono.Cecil;
|
|
using Mono.Cecil;
|
|
|
|
|
|
namespace BepInEx
|
|
namespace BepInEx
|
|
@@ -270,6 +270,17 @@ namespace BepInEx
|
|
}
|
|
}
|
|
|
|
|
|
/// <summary>
|
|
/// <summary>
|
|
|
|
+ /// Gets the specified attributes of an assembly, if they exist.
|
|
|
|
+ /// </summary>
|
|
|
|
+ /// <param name="assembly">The assembly.</param>
|
|
|
|
+ /// <typeparam name="T">The attribute type to retrieve.</typeparam>
|
|
|
|
+ /// <returns>The attributes of the type, if existing.</returns>
|
|
|
|
+ public static T[] GetAttributes<T>(Assembly assembly) where T : Attribute
|
|
|
|
+ {
|
|
|
|
+ return (T[])assembly.GetCustomAttributes(typeof(T), true);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /// <summary>
|
|
/// Gets the specified attributes of an instance, if they exist.
|
|
/// Gets the specified attributes of an instance, if they exist.
|
|
/// </summary>
|
|
/// </summary>
|
|
/// <typeparam name="T">The attribute type to retrieve.</typeparam>
|
|
/// <typeparam name="T">The attribute type to retrieve.</typeparam>
|