Fix merge of not selected files behaviour

This commit is contained in:
Serghei Cebotari 2023-12-26 00:03:25 +03:00
parent 3043756014
commit 17e1a1681e

View File

@ -17,9 +17,12 @@ internal class MergeTool : Tool
{
IFileDialog dialog = RhSolutionsAddIn.ServiceProvider.GetRequiredService<IFileDialog>();
string[] files = dialog.GetFiles();
_reader = _readerFactory.GetReader("Excel");
var products = _reader.ReadProducts(files);
_writer = _writerFactory.GetWriter("NewPrice");
_writer.WriteProducts(products);
if (files.Length > 0)
{
_reader = _readerFactory.GetReader("Excel");
var products = _reader.ReadProducts(files);
_writer = _writerFactory.GetWriter("NewPrice");
_writer.WriteProducts(products);
}
}
}