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

29 lines
759 B
C#
Raw Permalink Normal View History

2023-04-06 08:29:39 +03:00
#if !NET472
using System.Runtime.Versioning;
#endif
namespace RhSolutions.Tools;
#if !NET472
[SupportedOSPlatform("windows")]
#endif
2023-04-14 08:08:46 +03:00
internal class MergeTool : Tool
2023-04-06 08:29:39 +03:00
{
2023-06-20 11:51:52 +03:00
public MergeTool(ReaderFactory readerFactory, WriterFactory writerFactory) : base(readerFactory, writerFactory)
2023-04-17 08:49:26 +03:00
{
}
2023-04-06 08:29:39 +03:00
public override 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);
}
2023-04-06 08:29:39 +03:00
}
}