fix nuget
All checks were successful
Build / Compute Version (push) Successful in 5s
Build / Build Nuget package (CringeBootstrap.Abstractions) (push) Successful in 2m38s
Build / Build Nuget package (NuGet) (push) Successful in 2m24s
Build / Build Nuget package (CringePlugins) (push) Successful in 2m48s
Build / Build Nuget package (SharedCringe) (push) Successful in 2m29s
Build / Build Launcher (push) Successful in 3m50s

This commit is contained in:
zznty
2024-10-28 00:46:37 +07:00
parent f75e4e7b4a
commit 78be6bd837
20 changed files with 472 additions and 93 deletions

View File

@@ -6,12 +6,12 @@ namespace CringePlugins.Utils;
public class IntrospectionContext
{
public static IntrospectionContext Global { get; } = new();
private readonly ModuleContext _context = ModuleDef.CreateModuleContext();
internal readonly ModuleContext Context = ModuleDef.CreateModuleContext();
public IEnumerable<Type> CollectAttributedTypes<TAttribute>(Module module, bool allowAbstract = false) where TAttribute : Attribute
{
var moduleDef = ModuleDefMD.Load(module, _context);
var moduleDef = ModuleDefMD.Load(module, Context);
return moduleDef.GetTypes()
.Where(b => b.CustomAttributes.IsDefined(typeof(TAttribute).FullName) && (allowAbstract || !b.IsAbstract))
@@ -20,7 +20,7 @@ public class IntrospectionContext
public IEnumerable<Type> CollectDerivedTypes<T>(Module module, bool allowAbstract = false)
{
var moduleDef = ModuleDefMD.Load(module, _context);
var moduleDef = ModuleDefMD.Load(module, Context);
var token = moduleDef.ImportAsTypeSig(typeof(T));