允许多标记

This commit is contained in:
ww-rm
2025-03-31 14:37:47 +08:00
parent 252f3a5bea
commit 9e27a19258
2 changed files with 2 additions and 3 deletions

View File

@@ -25,7 +25,7 @@ namespace SpineViewer.Exporter
/// <summary>
/// 导出实现类标记
/// </summary>
[AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = false)]
[AttributeUsage(AttributeTargets.Class, AllowMultiple = true, Inherited = false)]
public class ExportImplementationAttribute(ExportType exportType) : Attribute, IImplementationKey<ExportType>
{
public ExportType ImplementationKey { get; private set; } = exportType;

View File

@@ -32,8 +32,7 @@ namespace SpineViewer
var impTypes = Assembly.GetExecutingAssembly().GetTypes().Where(t => baseType.IsAssignableFrom(t) && !t.IsAbstract);
foreach (var type in impTypes)
{
var attr = type.GetCustomAttribute<TAttr>();
if (attr is not null)
foreach (var attr in type.GetCustomAttributes<TAttr>())
{
var key = attr.ImplementationKey;
if (ImplementationTypes.ContainsKey(key))