RhSolutions-AddIn/RhSolutions.AddIn/Tools/Tool.cs
2023-05-22 07:39:48 +03:00

30 lines
680 B
C#

#if !NET472
using System.Runtime.Versioning;
#endif
namespace RhSolutions.Tools;
#if !NET472
[SupportedOSPlatform("windows")]
#endif
internal abstract class Tool : IDisposable
{
protected readonly ReaderFactory _readerFactory;
protected readonly WriterFactory _writerFactory;
protected IReader _reader;
protected IWriter _writer;
public Tool(IServiceProvider provider)
{
_readerFactory = provider.GetRequiredService<ReaderFactory>();
_writerFactory = provider.GetRequiredService<WriterFactory>();
}
public void Dispose()
{
_reader.Dispose();
_writer.Dispose();
}
public abstract void Execute();
}