Продолжение работы над фундаментальным обновлением проекта (всё ещё без сборки)
This commit is contained in:
@@ -29,7 +29,7 @@ internal class ProcessorCollection
|
||||
|
||||
foreach (Type type in assembly.GetTypes())
|
||||
{
|
||||
if (type.GetCustomAttributes(typeof(ProcessAttribute), true).Length <= 0)
|
||||
if (type.GetCustomAttributes(typeof(ProcessorAttribute), true).Length <= 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
@@ -51,21 +51,15 @@ internal class ProcessorCollection
|
||||
if (!type.IsSubclassOf(typeof(IProcessor)))
|
||||
{
|
||||
throw new(
|
||||
$"'ProcessAttribute' attribute should only be applied to children of 'IProcessor' class. '{type.FullName}' is not."
|
||||
$"'ProcessorAttribute' attribute should only be applied to children of 'IProcessor' class. '{type.FullName}' is not."
|
||||
);
|
||||
}
|
||||
|
||||
ProcessAttribute processAttribute = type.GetCustomAttribute<ProcessAttribute>()!;
|
||||
DescriptionAttribute? descriptionAttribute =
|
||||
type.GetCustomAttribute<DescriptionAttribute>();
|
||||
ProcessorGroupAttribute? groupAttribute =
|
||||
type.GetCustomAttribute<ProcessorGroupAttribute>();
|
||||
ProcessorAttribute processorAttribute = type.GetCustomAttribute<ProcessorAttribute>()!;
|
||||
ProcessorDependenciesAttribute? dependenciesAttribute =
|
||||
type.GetCustomAttribute<ProcessorDependenciesAttribute>();
|
||||
ProcessorInnerTypeAttribute? innerTypeAttribute =
|
||||
type.GetCustomAttribute<ProcessorInnerTypeAttribute>();
|
||||
|
||||
bool isCollection = innerTypeAttribute is not null;
|
||||
bool isCollection = processorAttribute.InnerType is not null;
|
||||
|
||||
ConstructorInfo? constructor = isCollection
|
||||
? type.GetConstructor([])
|
||||
@@ -78,13 +72,13 @@ internal class ProcessorCollection
|
||||
|
||||
return new()
|
||||
{
|
||||
Name = processAttribute.Name,
|
||||
Name = processorAttribute.Name,
|
||||
Type = type,
|
||||
Description = descriptionAttribute?.Description ?? processAttribute.Name,
|
||||
Group = groupAttribute?.Group ?? ProcessorGroupEnum.General,
|
||||
Description = processorAttribute.Description,
|
||||
Group = processorAttribute.Group,
|
||||
Dependencies = dependenciesAttribute?.Dependencies ?? [],
|
||||
IsCollectionProcessor = isCollection,
|
||||
InnerType = innerTypeAttribute?.InnerType,
|
||||
InnerType = processorAttribute.InnerType,
|
||||
Constructor = constructor,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user