允许多标记
This commit is contained in:
@@ -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;
|
||||
|
||||
@@ -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))
|
||||
|
||||
Reference in New Issue
Block a user