26 lines
1.1 KiB
C#
26 lines
1.1 KiB
C#
namespace RhSolutions.Tools;
|
|
|
|
internal class ToolFactory
|
|
{
|
|
static ReaderFactory readerFactory = RhSolutionsAddIn.ServiceProvider.GetService<ReaderFactory>();
|
|
static WriterFactory writerFactory = RhSolutionsAddIn.ServiceProvider.GetService<WriterFactory>();
|
|
static FittingsCalculatorFactory fittingsCalculatorFactory = RhSolutionsAddIn.ServiceProvider.GetService<FittingsCalculatorFactory>();
|
|
|
|
public Tool GetTool(string toolName)
|
|
{
|
|
Tool tool = toolName switch
|
|
{
|
|
"export" => new ExportTool(readerFactory, writerFactory),
|
|
"convert" => new ConvertTool(readerFactory, writerFactory),
|
|
"merge" => new MergeTool(readerFactory, writerFactory),
|
|
"dxfexport" => new DxfTool(readerFactory, writerFactory),
|
|
"guess" => new GuessTool(readerFactory, writerFactory),
|
|
"fillsleeves" => new FittingsTool(readerFactory, writerFactory, fittingsCalculatorFactory, "Sleeves"),
|
|
"fillcouplings" => new FittingsTool(readerFactory, writerFactory, fittingsCalculatorFactory, "Couplings"),
|
|
"ocr" => new OcrTool(readerFactory, writerFactory),
|
|
_ => throw new Exception($"Неизвестный инструмент {toolName}"),
|
|
};
|
|
return tool;
|
|
}
|
|
}
|