25 lines
760 B
C#
25 lines
760 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Pf2e.Scrapper.Processors.Collection;
|
|
using Pf2e.Scrapper.Processors.Definitions;
|
|
|
|
namespace Pf2e.Scrapper.Processors.Factory;
|
|
|
|
public class SimpleProcessorFactory(ProcessorRecord item, IServiceProvider serviceProvider)
|
|
: AbstractProcessorFactory
|
|
{
|
|
public ProcessorRecord Item { get; } = item;
|
|
public IServiceProvider ServiceProvider { get; } = serviceProvider;
|
|
|
|
public override int Count() => 1;
|
|
|
|
public override IEnumerable<Tuple<string, IProcessor>> GetEnumerator()
|
|
{
|
|
yield return new(
|
|
Item.Description,
|
|
(IProcessor)ActivatorUtilities.CreateInstance(ServiceProvider, Item.Type)
|
|
);
|
|
}
|
|
}
|