Продолжение работы

This commit is contained in:
2025-05-13 19:22:41 +04:00
parent aad2081912
commit 83ee914991
64 changed files with 1252 additions and 1229 deletions
+6 -18
View File
@@ -48,7 +48,7 @@ internal class ProcessorCollection
/// <returns></returns>
private ProcessorCollectionItem CreateItem(Type type)
{
if (!type.IsSubclassOf(typeof(IProcessor)))
if (!type.IsAssignableTo(typeof(IProcessor)))
{
throw new(
$"'ProcessorAttribute' attribute should only be applied to children of 'IProcessor' class. '{type.FullName}' is not."
@@ -61,15 +61,6 @@ internal class ProcessorCollection
bool isCollection = processorAttribute.InnerType is not null;
ConstructorInfo? constructor = isCollection
? type.GetConstructor([])
: type.GetConstructor([typeof(ProcessorInput)])!;
if (constructor is null)
{
throw new($"Не удаётся определить конструктор класса {type}");
}
return new()
{
Name = processorAttribute.Name,
@@ -79,7 +70,6 @@ internal class ProcessorCollection
Dependencies = dependenciesAttribute?.Dependencies ?? [],
IsCollectionProcessor = isCollection,
InnerType = processorAttribute.InnerType,
Constructor = constructor,
};
}
@@ -111,7 +101,7 @@ internal class ProcessorCollection
{
foreach (ProcessorCollectionItem item in Items)
{
if (item.Priority > 0)
if (item.Priority >= 0)
{
continue;
}
@@ -125,7 +115,10 @@ internal class ProcessorCollection
continue;
}
item.Priority = dependencyPriorities.Any() ? dependencyPriorities.Max() + 1 : 1;
item.Priority = Math.Min(
dependencyPriorities.Any() ? dependencyPriorities.Max() + 1 : 1,
(int)item.Group * 100
);
priorities.Add(item.Name, item.Priority);
}
}
@@ -215,9 +208,4 @@ internal class ProcessorCollectionItem
/// Флаг, указывающий внутренний тип коллекции обрабатываемых элементов.
/// </summary>
public string? InnerType { get; init; }
/// <summary>
/// Конструктор обработчика.
/// </summary>
public required ConstructorInfo Constructor { get; init; }
}