RhSolutions-AddIn/RhSolutions.AddIn/Tools/Tool.cs
2023-04-20 09:37:07 +03:00

29 lines
623 B
C#

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