允许多标记
This commit is contained in:
@@ -25,7 +25,7 @@ namespace SpineViewer.Exporter
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// 导出实现类标记
|
/// 导出实现类标记
|
||||||
/// </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 class ExportImplementationAttribute(ExportType exportType) : Attribute, IImplementationKey<ExportType>
|
||||||
{
|
{
|
||||||
public ExportType ImplementationKey { get; private set; } = 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);
|
var impTypes = Assembly.GetExecutingAssembly().GetTypes().Where(t => baseType.IsAssignableFrom(t) && !t.IsAbstract);
|
||||||
foreach (var type in impTypes)
|
foreach (var type in impTypes)
|
||||||
{
|
{
|
||||||
var attr = type.GetCustomAttribute<TAttr>();
|
foreach (var attr in type.GetCustomAttributes<TAttr>())
|
||||||
if (attr is not null)
|
|
||||||
{
|
{
|
||||||
var key = attr.ImplementationKey;
|
var key = attr.ImplementationKey;
|
||||||
if (ImplementationTypes.ContainsKey(key))
|
if (ImplementationTypes.ContainsKey(key))
|
||||||
|
|||||||
Reference in New Issue
Block a user