RhSolutions-AddIn/RhSolutions.AddIn/Tools/MergeTool.cs

18 lines
460 B
C#

namespace RhSolutions.Tools;
internal class MergeTool : ReaderWriterTool, ITool
{
public void Execute()
{
IFileDialog dialog = RhSolutionsAddIn.ServiceProvider.GetRequiredService<IFileDialog>();
string[] files = dialog.GetFiles();
if (files.Length > 0)
{
_reader = _readerFactory.GetReader("Excel");
var products = _reader.ReadProducts(files);
_writer = _writerFactory.GetWriter("NewPrice");
_writer.WriteProducts(products);
}
}
}