Add Magic Tool
This commit is contained in:
parent
d894c50ca3
commit
136aa7f238
@ -1,5 +1,4 @@
|
|||||||
using RhSolutions.AddIn;
|
#if !NET472
|
||||||
#if !NET472
|
|
||||||
using System.Runtime.Versioning;
|
using System.Runtime.Versioning;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
23
RhSolutions.AddIn/Tools/MagicTool.cs
Normal file
23
RhSolutions.AddIn/Tools/MagicTool.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
#if !NET472
|
||||||
|
using System.Runtime.Versioning;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
namespace RhSolutions.Tools;
|
||||||
|
|
||||||
|
internal class MagicTool : Tool
|
||||||
|
{
|
||||||
|
public MagicTool(IServiceProvider provider) : base(provider)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Execute()
|
||||||
|
{
|
||||||
|
Application app = RhSolutionsAddIn.Excel.Application;
|
||||||
|
Worksheet worksheet = app.ActiveWorkbook.ActiveSheet;
|
||||||
|
_reader = _readerFactory.GetReader("Magic");
|
||||||
|
var products = _reader.ReadProducts(new[] { worksheet });
|
||||||
|
_writer = _writerFactory.GetWriter("Excel");
|
||||||
|
_writer.WriteProducts(products);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -10,6 +10,7 @@ internal class ToolFactory
|
|||||||
"convert" => new ConvertTool(RhSolutionsAddIn.ServiceProvider),
|
"convert" => new ConvertTool(RhSolutionsAddIn.ServiceProvider),
|
||||||
"merge" => new MergeTool(RhSolutionsAddIn.ServiceProvider),
|
"merge" => new MergeTool(RhSolutionsAddIn.ServiceProvider),
|
||||||
"dxfexport" => new DxfTool(RhSolutionsAddIn.ServiceProvider),
|
"dxfexport" => new DxfTool(RhSolutionsAddIn.ServiceProvider),
|
||||||
|
"magicexport" => new MagicTool(RhSolutionsAddIn.ServiceProvider),
|
||||||
_ => throw new Exception("Неизвестный инструмент"),
|
_ => throw new Exception("Неизвестный инструмент"),
|
||||||
};
|
};
|
||||||
return tool;
|
return tool;
|
||||||
|
Loading…
Reference in New Issue
Block a user