2023-04-14 08:08:46 +03:00
|
|
|
|
namespace RhSolutions.Tools;
|
|
|
|
|
|
|
|
|
|
internal class ToolFactory
|
|
|
|
|
{
|
2023-06-20 11:51:52 +03:00
|
|
|
|
static ReaderFactory readerFactory = RhSolutionsAddIn.ServiceProvider.GetService<ReaderFactory>();
|
|
|
|
|
static WriterFactory writerFactory = RhSolutionsAddIn.ServiceProvider.GetService<WriterFactory>();
|
2023-11-02 23:07:06 +03:00
|
|
|
|
static IFittingsCalculator sleevesCaluculator = RhSolutionsAddIn.ServiceProvider.GetService<IFittingsCalculator>();
|
2023-06-20 11:51:52 +03:00
|
|
|
|
|
2023-04-14 08:08:46 +03:00
|
|
|
|
public Tool GetTool(string toolName)
|
|
|
|
|
{
|
|
|
|
|
Tool tool = toolName switch
|
|
|
|
|
{
|
2023-06-20 11:51:52 +03:00
|
|
|
|
"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),
|
2023-06-20 11:52:42 +03:00
|
|
|
|
"fillsleeves" => new SleevesTool(readerFactory, writerFactory, sleevesCaluculator),
|
2023-05-30 08:23:31 +03:00
|
|
|
|
_ => throw new Exception($"Неизвестный инструмент {toolName}"),
|
2023-04-14 08:08:46 +03:00
|
|
|
|
};
|
|
|
|
|
return tool;
|
|
|
|
|
}
|
|
|
|
|
}
|